Sequence in Correct Order or Reset - Problem, please help!
I have a problem and can think of a long-winded solution but wonder if anyone can come up with a simple way to do this.
Simplified here is the problem:
I have an attribute PLAYERNUMBER, this attribute changes depending on which button the player presses.
Now if the player presses the buttons in the correct combination the PLAYERNUMBER attribute value will change in this sequence for example: 5, 15, 72, 64, 102, 53...
So, I want a way of changing a BOOLEAN attribute to TRUE if the correct sequence is produced.
BUT if incorrect I want it to reset and the player to have to start the sequence from scratch.
Any ideas guys?
Simplified here is the problem:
I have an attribute PLAYERNUMBER, this attribute changes depending on which button the player presses.
Now if the player presses the buttons in the correct combination the PLAYERNUMBER attribute value will change in this sequence for example: 5, 15, 72, 64, 102, 53...
So, I want a way of changing a BOOLEAN attribute to TRUE if the correct sequence is produced.
BUT if incorrect I want it to reset and the player to have to start the sequence from scratch.
Any ideas guys?
Comments
Also, how do I actually concatenate the playernumber attribute into a text attribute?
change attribute game.text to "hello ".."world" or
game.sequence to game.sequence .. ",72"
You shouldn't have a problem with the text attribute (thousands of characters are possible) and just reset it often to increase performance and keep things manageable.
I'll give this a go and see how I get on.
Am I right in thinking then that:
change game.sequence to game.sequence .. ",72" - will add the ,72 to the string of numbers already there?... therefore 59,64,33 would become 59,64,33,72
And one further question then - how do I reset/clear the text attribute?
Thanks so much for you help. How do you know and where do you find this info?!
Hopefully you figured that YES ,72 would be added to your string.
To clear an attribute just change attribute and leave blank !! Although for the sake of later debugging/reading you may want to use something sensible.
I can't remember when the .. operator was first discovered (!) but it was quite a while ago, I'm afraid there is a fair bit of stuff that hasn't made it to any official docs yet.
http://gamesalad.com/wiki/
http://gamesalad.com/wiki/reference_library