Hi again! Basically, I am making an interactive mobile phone for my game, and any mobile phone needs to be able to call numbers. I have the buttons 0-9 layed out, but have no idea how I will script it to remember which combination of numbers have been clicked. How could I do this in JavaScript? In case it helps, one of the callable numbers in my game is 01632960000.
If its a string, you can simply add any number to it. I have provided a script below to set an example, please read the comments:
var phoneNumber : String;
function Update()
{
// Check what key was pressed down.
if(Input.GetKeyDown("0")) {
// If 0, append it to phoneNumber.
phoneNumber += 0;
Debug.Log(phoneNumber);
}
else if(Input.GetKeyDown("1")) {
phoneNumber += 1;
Debug.Log(phoneNumber);
}
else if(Input.GetKeyDown("2")) {
phoneNumber += 2;
Debug.Log(phoneNumber);
}
// etc.
};