SOLVED local variable xorigin(100011) not set before reading it.

Hi, good people.
Today, I faced a weird error, which is in the title.
Full error log:
Code:
___________________________________________
############################################################################################
ERROR in
action number 1
of  Step Event0
for object obj_menu:

local variable xorigin(100011) not set before reading it.
at gml_Object_obj_menu_Step_0 (line 10) - var _move = _up - _down
############################################################################################
gml_Object_obj_menu_Step_0 (line 10)
This is the full code:

Code:
///@desc basic menu stuff
#region //get input
var _up keyboard_check_pressed(vk_up)
var _down keyboard_check_pressed(vk_down);
var _back keyboard_check_pressed(vk_escape);
var _select keyboard_check_pressed(vk_enter);
#endregion

#region //move index
var _move = _up - _down
if _move != 0{
    index += _move;
}
#endregion
Sorry if it is a futile error, but I have just started programming, and I really can't find what is wrong here.
I await a response. c:
OBS: I am using the latest version of GMS 2.
 
Last edited:

Nocturne

Friendly Tyrant
Forum Staff
Admin
You are missing a semi-colon at the end of the var declaration. GameMaker is generally forgiving about these things, but not always and not usually when it comes to declaring local variables. So:
GML:
var _move = _up - _down;
 
You are missing a semi-colon at the end of the var declaration. GameMaker is generally forgiving about these things, but not always and not usually when it comes to declaring local variables. So:
GML:
var _move = _up - _down;
I put the semi-colon, but it is giving me the exact same error.
 

Chourando

Member
What about:
GML:
var _up = keyboard_check_pressed(vk_up)
var _down = keyboard_check_pressed(vk_down);
var _back = keyboard_check_pressed(vk_escape);
var _select = keyboard_check_pressed(vk_enter);
 

Ommn

Member
try this:
GML:
#region //get input
var _up = keyboard_check_pressed(vk_up)
var _down = keyboard_check_pressed(vk_down);
var _back = keyboard_check_pressed(vk_escape);
var _select = keyboard_check_pressed(vk_enter);
#endregion
The equal sign must be used when using var.
var is not as a #macro
GML:
#macro _SS 1
var _SS = 1
 
Last edited:
try this:
GML:
#region //get input
var _up = keyboard_check_pressed(vk_up)
var _down = keyboard_check_pressed(vk_down);
var _back = keyboard_check_pressed(vk_escape);
var _select = keyboard_check_pressed(vk_enter);
#endregion
The equal sign must be used when using var.
var is not as a #macro
GML:
#macro _SS 1
var _SS = 1
It worked!!! Thank you guys for helping me. At the end, I just had to put an equal sign before the inputs. Sorry for the lack of attention lmao
 
Top