• 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!

Legacy GM Q:Unknown object.unknown variable

Z

zendraw

Guest
why does this code
Code:
if (place_meeting(x, y, par_alien))
{
    with (par_alien)
    {
        if (place_meeting(x, y, other))
        {
            var abz=abs(z-other.z);
            if (abz<other.targ_range)
            {
                other.targ_range=abz;
                other.target=id;
            }
        }
    }
}
give me this error?
Code:
ERROR!!! :: ############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object o_ctrl:


Variable <unknown_object>.<unknown variable>(100091, -2147483648) not set before reading it.
 at gml_Script_scr_damage_fighter (line 17) -             if (abz<other.targ_range) ############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_damage_fighter (line 17)
called from - gml_Object_o_ctrl_StepNormalEvent_1 (line 250) -     with (o_dmg) {scr_damage_fighter()};
Compile finished: 16:49:28
this happens when i try to room_goto_next(); otherwise during gameplay there is no problem. what is happening that i am missing? also this started happening when i put all the code in scripts and then just run the scripts in the controller object as seen in the error message. is this a GMS bug or? how do i fix it?
 

jo-thijs

Member
why does this code
Code:
if (place_meeting(x, y, par_alien))
{
    with (par_alien)
    {
        if (place_meeting(x, y, other))
        {
            var abz=abs(z-other.z);
            if (abz<other.targ_range)
            {
                other.targ_range=abz;
                other.target=id;
            }
        }
    }
}
give me this error?
Code:
ERROR!!! :: ############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object o_ctrl:


Variable <unknown_object>.<unknown variable>(100091, -2147483648) not set before reading it.
 at gml_Script_scr_damage_fighter (line 17) -             if (abz<other.targ_range) ############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_damage_fighter (line 17)
called from - gml_Object_o_ctrl_StepNormalEvent_1 (line 250) -     with (o_dmg) {scr_damage_fighter()};
Compile finished: 16:49:28
this happens when i try to room_goto_next(); otherwise during gameplay there is no problem. what is happening that i am missing? also this started happening when i put all the code in scripts and then just run the scripts in the controller object as seen in the error message. is this a GMS bug or? how do i fix it?
The error is saying that there is an instance of o_dmg that hasn't set their variable targ_range to anything yet at the point where this code executes.

The reason for the <unknown ...> is just that depending on how you access the variables (through other),
the part of GameMaker that creates the error messages gets confused and can't find which object or variable it was.
Luckily though, it does know which line caused the problem.
 
Z

zendraw

Guest
i know the error i just cant figure out why its giving it? there is no clear reason for it to not get the variable, and also like i sayd it happens only when i try to switch rooms with room_goto_next();
what exactly confuses it?
 

jo-thijs

Member
i know the error i just cant figure out why its giving it? there is no clear reason for it to not get the variable, and also like i sayd it happens only when i try to switch rooms with room_goto_next();
what exactly confuses it?
We'd need more information.
In what code do you initialize targ_range in o_dmg?
What are other relevant codes you use?
 
Z

zendraw

Guest
i initilize it in its create event also when i create it for safety measure. also theres no other code really, i mean all the instances step events are runed in the controller with (obj) {run script};
what worries me is the stack overflow part so im trying a thing now that 'disables' the instances before switching rooms, my guess is it just runs 2 much code at one time.
 

jo-thijs

Member
i initilize it in its create event also when i create it for safety measure. also theres no other code really, i mean all the instances step events are runed in the controller with (obj) {run script};
what worries me is the stack overflow part so im trying a thing now that 'disables' the instances before switching rooms, my guess is it just runs 2 much code at one time.
Stack overflow part?
There's nothing about a stack overflow in what you posted.

Does o_dmg have any child objects?
 
Z

zendraw

Guest
i meant stack frame... my bad.

edit:
so i did this before runing the room go to code and so far i get no errors
Code:
            with (par_elements) {step=empty_script; instance_destroy(id, 0)};
            room_goto_next();
par_elements is simply a parent of all elements in the gameplay part. like damage, enemies player etc and step is a variable that holds the script that is the step event code for the specific instance.
 

jo-thijs

Member
i initilize it in its create event also when i create it for safety measure. also theres no other code really, i mean all the instances step events are runed in the controller with (obj) {run script};
what worries me is the stack overflow part so im trying a thing now that 'disables' the instances before switching rooms, my guess is it just runs 2 much code at one time.
i meant stack frame... my bad.
I'm not sure what worries you about the stack frame.

Does o_dmg have any child objects?
Does it?
 

jo-thijs

Member
how do you do that? i dont really use the debugger.
You run your game in debug mode (red arrow).
The game will start with an additional window.
Ignore this window for now and reproduce the error in the game.
A prompt with the error will pop up.
Close it.
Now look at the additional window that appeared at the start.
It should have some subwindows with blue title bars.
Right click on the title bar of one of those subwindows.
Select "Locals".
Expand ".Other".
Investigate its contents.
 
Z

zendraw

Guest
well so far with the fix i posted i culdnt recreate this error. so i guess the problem was it had 2 much to do in a single frame which caused it to not be able to get the variable and instance.
 
Top