I'm trying to create a system that will execute a certain command for 10 times, each for everytime the player tries to speak or use that object, and after the 10 times, it will execute afterwards an alternative command in which it will execute no matter how many times the user tries to speak to it again.
The problem here is how am I gonna initialize a numeric variable here and how to increment that variable.
Here's the code for the portion of the "speak to" command I'm trying to create:
drinks = NewStringList()
list add (drinks, "milk")
list add (drinks, "coffee")
list add (drinks, "juice")
list add (drinks, "water")
if (increment<10) {
firsttime {
msg ("<br/>Hello, I'm the decision making robot.<br/><br/>My function is to act as an ordinary human but I will respond in different ways to different answers that you make. <br/><br/>Some of those responses that you'll make, will be stored in my memory drive, so be very careful in making your decisions.<br/><br/>I will only give you a limited time and after at least 10 tries, I'll shut down completely.<br/><br/>Choose wisely and have fun testing!")
}
otherwise {
msg ("<br/>Hello, I'm the decision making robot.")
}
msg ("So, what kind of drink would I interest you:")
ShowMenu ("", drinks, false) {
switch (result) {
case ("milk") {
msg ("test 1 complete")
}
case ("coffee") {
msg ("test 2 complete")
}
case ("juice") {
msg ("test 3 complete")
}
case ("water") {
msg ("test 4 complete")
}
}
}
}
else {
msg ("<br/>You tried speaking to it,<br/><br/>But the Robot gave no response.")
}
This code is part of the text adventure game I'm currently working on as a debug room to help me learn the ropes here.
I also have a great background in programming.
Answers are greatly appreciated, especially relevant ones.
Thanks in advance.