I'm trying a game with a lot of rules, and I have a problem: There is an adult character, there is a child character, and the child is supposed to go along with the adult, as long as the child is not too scared and the adult is grabbing her hand.
For some reason, when I go to get her in the starter room, grab her hand, then exit, she shows up only if I remain in the new room for a turn (if I reload). She should show up the first time the page is loaded. What should I do?
Comments
My suspicion is that it has something to do with the fact that changes to variables only seem to affect text if they are set *before* the text is rendered. So in a passage like this
(if: $dude is true)["Dude!"]
(set: $dude to true)
The "Dude!" will not show first time because the variable is not set until after the (if:). But if you come back to that room, the variable will have been set and it will show.
I somewhat fixed it by hinting that the child is slower than the adult, but I would like to really solve this issue.
One thing to look out for is that the two (elseif:)'s are assuming that $takechild can only have two states ("yes" & "no"), if for some reason $takechild has some other value (like unassigned) then both of the (elseif:)'s will fail.
I would suggest that you replace the two (elseif:)'s and structure the second half of the code like you did the (if:) part, that would make it easier to read and cover the case of $takechild having some other state. .. reformatted for readability
Each room is done in a different passage. To move around the "house", the players is really just visitting the passages. There are variables used to keep track of where the character is, where the child is, and where the chaser is.
The player variable is changed depending on which passage is being used. The room where the child is depends on many things: It changes along with the adult room if the child is being guided, or stays the same if the child is left alone. It can randomly change if the child gets panicked and "flees" to another "room".