Help with Resetting Turn Scrips
Stone Rose
10 Aug 2012, 03:12When my player exits the pond, I would like for his clothes to dry after a set period of time. I currently have it set to where, 5 turns after leaving the pond, the player will get a message that says "Your clothes have dried." The problem I am having is that if the player reenters the pond before those 5 turns, the timer will not reset. This leads to confusing situations. (For example, if the player leaves the pond and then goes back in 4 turns later, when he leaves on his next turn, he will get a message saying "You are soaking wet. You clothes have dried.") How can I have the message appear only after the player has remained out of the water for 5 consecutive turns?

Pertex
10 Aug 2012, 06:14The easiest way to do it is to delete an existing timer before creating a new one. The problem is, that the command "run script after a number of times" doesn't provide a counter name. So the first created turnscript in the game is named "turnscript", the second "turnscript1"... when they are created simultaneously. But if I am right you don't have simultaneously running turnscripts in your game so you can destroy this timer. I did it in your game:
Stone Rose
11 Aug 2012, 03:48Thanks. Now the only problem is if the player enters the pond on the 5th turn. Upon entering the pond on the 5th turn, it says the clothes have dried and the player is unable to continue talking to the mouse (an action they can only do while wet). It works fine on any other turn, just not on the turn that the clothes are supposed to dry.
sgreig
11 Aug 2012, 09:31Would it not be easier to create an attribute like game.countturnswet, and then in the turnscript have it check that variable? If it's less than 5 increment the value by one, and if the value is 5 display that message UNLESS the player is currently in the water, in which case reset the counter? Something like:
if (game.countturnswet < 5) {
game.countturnswet = game.countturnswet + 1
}
else if (game.countturnswet = 5) {
if (player.parent = water) {
game.countturnswet = 0
}
else {
msg ("Your clothes are now dry.")
}
}

Pertex
11 Aug 2012, 12:50no problem. add this command to the enter script of the pond
if (not GetObject ( "turnscript" ) = null) {
destroy ("turnscript")
}
Stone Rose
11 Aug 2012, 23:53Perfect. Thank you guys!