• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Why is this simple script not working (beginner)

D

Desmae

Guest
alarm[0] = 60 * 60 * 5
alarm[1] = 60 * 60 * 5 * 52
weektime = 1
yeartime = 1
draw_set_font(arcade)
draw_text(719, 47, "Week" + weektime + "Year" + yeartime);

(in alarm 0)
// what im hoping to do is to make the weeks go on after 5 minutes in game time
weektime = weektime + 1
(in alarm 1)
// what im hoping to do is to make the years go on after 5 times 52 minutes in game time
 
G

Ggd07

Guest
Hey, where did you put:
Code:
alarm[0] = 60 * 60 * 5
alarm[1] = 60 * 60 * 5 * 52
If you did that in the step event/draw event, this alarm will set itself every step, meaning it will never trigger the event.
 
D

Desmae

Guest
Hey, where did you put:
Code:
alarm[0] = 60 * 60 * 5
alarm[1] = 60 * 60 * 5 * 52
If you did that in the step event/draw event, this alarm will set itself every step, meaning it will never trigger the event.
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object oTimer:

DoAdd :: Execution Error
at gml_Object_oTimer_Draw_0 (line 5) - draw_text(719, 47, "Week" + weektime + "Year" + yeartime);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oTimer_Draw_0 (line 5)

error code ^^^ if that can help...
 
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object oTimer:

DoAdd :: Execution Error
at gml_Object_oTimer_Draw_0 (line 5) - draw_text(719, 47, "Week" + weektime + "Year" + yeartime);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oTimer_Draw_0 (line 5)

error code ^^^ if that can help...
It is because you are trying to add a string to an integer
Try doing this:
draw_text(719, 47, "Week" + string(weektime) + "Year" + string(yeartime));

I am a bit confused on where you have the draw_text() function. Where you set the alarms should be in the create event, or something similar. The draw functions should be in the draw events
 
Top