This is my doubt:
I’m trying to write a text-adventure game with nested statements and functions.
And the problem is that I don’t know how to declare a function that will then go in a nested function. An example will be easier.
- I’m a character and I have to choose where to go. (1st function)
- I choose to go to open a door. (2nd function)
- I try to open it, but it is closed, so I call a function that will take me back to the point where I have to choose what to do. (to first function)
- I would like that if I choose to go again to open the door, the program will say “Hey, you already tried to do that” and then takes me back to the point to choose where to go.
So how can I do to insert a variable, that will make the program behave differently in the same function?
I hope I was clear enough. If not I will try to write some code directly here. Thank you