D
Darth Binary 1010
Guest
Code:
var test = noone
if (is_real(test)) {
show_debug_message("rawr")
}
var test = noone
if (is_real(test)) {
show_debug_message("rawr")
}
Probably not, you usually use noone when you know that the variable will hold an instance id at one pointWhy does this if statement return true? Should I be using "noone" for blank variables and resetting a variable to nothing? Also, should I be using is_real to check if a variable is a number or not?Code:var test = noone if (is_real(test)) { show_debug_message("rawr") }
Why does this if statement return true? Should I be using "noone" for blank variables and resetting a variable to nothing? Also, should I be using is_real to check if a variable is a number or not?Code:var test = noone if (is_real(test)) { show_debug_message("rawr") }
//In the create event
//when I tap this instance it will hold the id of the tapped instance
global.id_store = noone;
//in the tap event
global.id_store = id;
//this is a string
player = "John";
//this is a real
player_score = 4550;
//now in order to get a string that reads "John: 4550" we need to change player score into a string.
string_score = string(4550);
//now we can make a string for displaying
display_string = player + ":\n"+string score;
//the \n adds a line break so you would get John: and the score would be drawn on the next line.
//maybe you save there string on a database and need to turn it back into a real then check to make sure it's a real so you don't get a crashing error because you can't add a string to a real
/*
the below would be set to some data received from the database and not typed out more like:
incoming_string = path;
maybe taken from the http async event and as such we wouldn't be entirely sure what the variable path held until we test it
but for an example
*/
incoming_string = "4550";
if !is_real(incoming_string){
//if it is not real we turn it into a real here
real_score = real(incoming_string);
}