Legacy GM [Solved] if String = otherString not working !

Enreeper

Member
Hi,
I have an Problem.

i Have written an Car Ai Test Game Were Cars Race each other. but you have to open it in Multiply Windows

thats not the Problem. The Problem is that i have to click on start on each of them.

but if i do that they startet at different times.

Now i want that all Cars Start at The Same Time like for example. 14:35 o Clock

Here is my Code
Code:
Obj_TImer [Create Event:]

global.Min = get_string("Wich Minute should the race start ?","");
txt = "";
alarm[0] = 1;
time_m=0
time_h=0
_____________________________________________-

Code:
obj_Timer Step Event

///Check Time
if (global.Min = m){
    room_goto(r_play); 
    }
_______________________________

Code:
obj_Timer Alarm[0]

//store the current time
t = date_current_datetime();

//get the hour portion of that time
h = date_get_hour(t);

//get the minute portion of the time.
m = date_get_minute(t);

//get the second potion of the time
s = date_get_second(t);

//show the time
txt = "The current time is: " + string(h) + ":" + string(m) + ":" + string(s);

alarm[0] = room_speed;
___________________________

Code:
obj_Timer Step Event:

///Check Time
if (global.Min = m){
    room_goto(r_play);
    }
____________________________

It Shows the time it is. and the time to start. but When global.Min = m.

it doesn´t work :(

pls help.
 
Last edited:

Simon Gust

Member
You have to be aware of what the functions you are using return.
get_string() will return a string (i.e. "hello", "5.00")
date_get_minute() will return a real (i.e. 0, 4.50, 12)

You can't compare a real to a string.
if (global.Min = m)
here, global.Min is a string and m is a real.
You have to use the string() function to convert m.
Code:
if (global.Min == string(m))
or convert global.Min to a real
Code:
if (real(global.Min) == m)
 
Top