Hi there!
I would like to implement a "telephone" into my game which can be used to call NPCs. I used the inputbox command to let the player enter a number. I also tried to make an if/else statement to check if the player has entered an existing number and let the game react accordingly. However, the latter does not seem to work.
Here is the code I wrote:
string buffer;
InputBox("Enter number", number);
if (number == "1234") Display("Hello.");
Maybe anyone can help me? Many thanks in advance.
The string you declared is named 'buffer', and yet the string where you try to enter the number is called 'number'.
It should be:
string number;
InputBox("Enter number", number);
if (number == "1234") Display("Hello.");
You're right. That was a typo ;)... I previously used a string called "buffer". However, the script still does not work.
That's because you can't compare strings with the == bit. You have to use StrComp() or something like that. :)
Thank you VERY much - StrComp did work...