Forum Discussion
True/False Triggers with Random Variables?
Hi everyone, I'm looking for help. I have used Russell Killips Snakes and Ladders game to create one for lightning safety. What I am trying to figure out is how to have a question appear automatically when the man finishes moving to the correct square.
The man moves based on the roll of a dice (random variable), and will move x number of spaces between 1 and 6. If I use a true/false variable, I get the question as soon as the man moves off the current square, and he never gets to where he is supposed to go. I am sure that there is a way to get the correct question to show up (light box) automatically, based on the square he is supposed to move to. But, I am at a loss as to where to start. I have tried about a dozen different ways, but can't make it work. Right now, I set it so that you have to click the man to get the question, but would like some help on at least getting started with figuring out how to make this work. (I have signed up for the true/false variables webinar tomorrow)
- WaltHamiltonSuper Hero
Your problem isn't a variable problem, it is a timing problem. The answer is here:
when the man finishes moving to the correct square.
How do you know the man has finished moving? Is it a motion path that moves him? Is it an intercept? Whatever it is, that is the timing to put in your trigger to initiate showing the question. Variables seem unlikely candidates to help, as they are merely sticky notes that keep track of a condition. You could use them like "Show question 17 if man is on square 17 ([locationVariable = 17] when motion path 3 ends"
For more definitive help, attach your .story file here.
- DianeBrochuCommunity Member
Hi Walt, the problem is that the motion path moves the man 1 square at a time, but based on the roll, he may move 2, 3 or more squares, one motion path at a time. I did try that trigger, but it just showed the question for the "square" after the one he was on, and not the one for the final square he should end up at.
Thank you!
- WaltHamiltonSuper Hero
Try this trigger on the Moving layer:
- DianeBrochuCommunity Member
Hi Walt,
I tried that, and it works fine for the most part, but it means the layers for snakes and the layers for ladders never show. The character just stays where he lands. That's why I figured I would need a variable that determines which layer gets shown because I wasn't able to make triggers work based on the nMove or the PositionValue variable.
HOWEVER, based on your suggestion, I added conditions to the trigger so it only works when it shouldn't go to any other layer and voila! It does what I wanted.
Thanks so much for making me look at that again!
- WaltHamiltonSuper HeroGlad you got it going. PIAWYC (Pass it along when you can).
- DianeBrochuCommunity Member
You bet!