GMS 2 instance_position(xLocation,yLocation,all); returning 100099

For some reason instance_position(xLocation,yLocation,all) is returning 100099 instead of -4 (or noone) like it should. It appears that the first time the code is run it returns -4. However, the second time it returns 100099 which is not the ID of any object and causes issues further down the line.
My full code is
Code:
    temporary_id = instance_position(x,y+128,all);
    show_debug_message(instance_position(x,y+128,all));
    if(temporary_id == noone) {
       yGoal=y;
      xGoal=x+128;
      moving = true;
    }
This code is within a 'step' event
 

The-any-Key

Member
Check what it is:
Code:
temporary_id = instance_position(x,y+128,all);
if temporary_id>-1
{
    show_debug_message(string(object_get_name(temporary_id.object_index)))
}
 

The-any-Key

Member
double equals
I am a old VB5 coder. We never double equals :)
We are lazy. We save 100,000 keystrokes by avoiding typing double = :)

One thing you could try is:
1# Export the project.
2# Open a new empty project.
3# Import the project.
4# Run. (this fix strange bugs in GMs project files)

Also make sure you dont have any "Undefined" instances in the room editor:
upload_2017-2-26_14-20-31.png
 
I am a old VB5 coder. We never double equals :)
We are lazy. We save 100,000 keystrokes by avoiding typing double = :)

One thing you could try is:
1# Export the project.
2# Open a new empty project.
3# Import the project.
4# Run. (this fix strange bugs in GMs project files)

Also make sure you dont have any "Undefined" instances in the room editor:
View attachment 7304
The issue has solved itself now. I turned off my computer and gave it a break then came back 20 mins later, ran the code and bam! it worked fine
 
Top