It looks like you're new here. If you want to get involved, click one of these buttons!
The calls to variables like PLAYER and CITY work fine in this passage, but when addressing them in other passages like the below:<%
var start = prompt("Type 'start' to continue...")
alert("Let's gather some information about yourself.")
var PLAYER = prompt("What's your name?")
var AGE = prompt("How old are you? (This will determine whether profanity is used or not ONLY.)")
var SEX = prompt("Are you a boy? or a girl?")
var CITY = prompt("What city are you from?")
if (start === "start") {
print(" You are " + PLAYER + ". You live in "+CITY+". You are a "+SEX+". You are "+AGE+" years old.");
}
else {
close();
}
%>
Chapter 1
I get an error message that reads:You decide to go to the bank. While Frances is on her phone, your friends start walking off. <% print("Wait up " + PLAYER + " !") %> You and your friends wait for her to catch up. You head towards the bank. As you are walking, Josh suddenly stops. "Yo, whats up Josh? You alright?" asks Trevor. Josh pukes on the ground. "Holy <% if (AGE < 13) {
print("shit josh!");
}
else {
print("cow josh!");
}
%>
⚠ Uncaught ReferenceError: PLAYER is not defined (file:///C:/Users/Alec/AppData/Local/Temp/nw5500_29090/index.html#stories/fff4c9b3-e354-dd95-3290-56d6e1dd92d9/test: 4)
Comments
a. The passage from your example modified to use the s variable, I have not modified/corrected any other potential issues with the code. b. An example of a possible Chapter 1 passage outputting the current values store within the s variable.
note: The reasons you cant directly reference variables created in one passage from another is that those variables are created within a local scope and that local scope was destroyed once the next passage is rendered.