S
SlFinn
Guest
The error is this: Variable obj_button._click(100041, -2147483648) not set before reading it. I have only been using GML and Game Maker for 5 days so I am not certain what this means or how to fix it. I will insert the code I have used below that is supposedly has this error. I am hoping someone can help me understand what needs fixing and how. I'd really appreciate it!
The code for my User Event 0 (which has the error):
Also in case you need to see my create and step events to give you more info on my UI manager, I will print them below:
Button Manager Create event:
menuOpen = false;
Button Manager Step event:
Btw these are my create, step and draw gui events for my obj_button in case you need this information:
Create:
Step:
Draw Gui:
The code for my User Event 0 (which has the error):
GML:
var _width = 300;
var _height = 100;
create_button(40, 40, _width, _height, "Play", on_click);
create_button(40, 40 + _height + 40, _width, _height, "Options", on_click);
create_button(40, 40 + (_height + 40) * 2, _width, _height, "Quit", on_click);
Button Manager Create event:
menuOpen = false;
Code:
menuOpen = false;
Code:
if(keyboard-check_pressed(ord("M"))) {
menuOpen = !menuOpen;
if(menuOpen)
event_user(0);
else
event_user(1);
}
Create:
GML:
width = 280;
height = 80;
text = "Start Game";
hover = 0;
script = -1;
Code:
var _hover = get_hover();
var_click = _hover && mouse_check_button_pressed(mb_left);
hover = lerp(hover, _hover, 0.1);
y = lerp(y, ystart - _hover *8, 0.1);
if(_click && script >= 0) {
script_execute(script);
}
Code:
draw_set_color(merge_color(c_ltgray, c_red, hover));
draw_roundrect(x, y, x + width, y + height, 0);
draw_set_color(c_red);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(x + width/2, y + height/2, text);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_color(c_red);