Windows [Fatal Error] x and y not working anymore...

A

Ash2o

Guest
Hello everyone !

Let me tell you all a little story...
I was working on a Pong-Like project ( yes, beginner thing ) and, suddenly, I got an Error Message which was telling me that I didn't set variables before the program reads them. I was kinda puzzled, the Message was about an object I haven't even touched since a long time. With a closer look, I noticed that the problem in the object is the x or y. And I also noticed that EVERY object with a code which changes its x and y wasn't working anymore. I asked for some help to people who were used to GML. We conclude that the most probable issue was that the project had been corrupted for some reason.
Well, fair enough, I was motivated to make my game so I decided to remake the project. Here we are. I have barely created some objects, I want to try if the problem is still a thing or not. So I created a simple object with one line in Step, which is :
y = y + 2;
I run the game. It didn't even launch, and, the a Fatal Error is always here. I don't understand at all what can cause an error like this. So, here is the Error Message :


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object objTest:

Variable objTest.(null)(100004, -2147483648) not set before reading it.
at gml_Object_objTest_Step_0 (line 1) - y = y + 2;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_objTest_Step_0 (line 1)


So it looks to forbid me to use x and y. For movement, it's okay, I still have hspeed and vspeed but... I can't even use a place_meeting(x,y,object)

I looked on the Internet for somebody who had had a Fatal Error such this one ( with the "(null)" thing ) but I didn't find. Maybe one of you knows this issue and a solution to make my projects revive :/

Thanks for reading guys and sorry for my English skill which is not perfect
 
Last edited by a moderator:

FrostyCat

Redemption Seeker
Post your exact GMS IDE and runtime versions (e.g. IDE 2.2.1.375 + Runtime 2.2.1.287), and provide that one-line sample project as an export.

As a wild guess, if your symptom is being unable to use x, y and place_meeting(), first you should make sure that the physics system is OFF.
 
A

Ash2o

Guest
I am using the GMS IDE Version 2.2.1.375 and the Current Runtime is 2.2.1.287
Regarding the the physics system, if you're talking about the square "Uses Physics" in the Object window, this is Off
 
D

Danei

Guest
I get errors that look like that when I try to access data structures that don't exist. You don't have any other objects or room creation code whatsoever?
 
A

Ash2o

Guest
I've tried something with this project. I've deleted all the objects, sounds, fonts, sprites except the object which has the code y = y +2; . So the only things which were still here were this object, a room which had only the object in its center and the object's sprite ( a 32*32 white square ). And the same Error appeared. I am using the normal x and y and not the global ones

Hm I want to try something, if you're okay of course. Unfortunately I deleted this project but I still have my Pong one. I will put this project on UptoBox, then you will be able to download and try it. Maybe the problem is from my GMS I dont' really know. So if you're okay, I'd really appreaciate that you try to run the Game Project on your computer to see if the problem is the same for everyone. I'll post the link in 2 hours I think
 

TheouAegis

Member
GMS1 won't even compile if you try to redeclare x or y, so I'd assume GMS2 wouldn't either.

You verified the object didn't have physics enabled. Verify the room doesn't either.

Verify the object is on the right layer (if it's even possible to put objects on the wrong layer, lol).

Did you clean the project cache already?
 
A

Ash2o

Guest
Hm I don't redeclare anything. I can't check right now if the physics are enabled in the room but I am pretty sure I did't change anything. This is in the right layer, yes x)
And I've already cleaned it several times

So, here is the link for thoses who wants to try the "glitch" on their own computer, and thanks for your help

https ://uptobox.com/t0yia167ef7w
(without the space after https of course)
 
Last edited by a moderator:
Hm I don't redeclare anything
I just opened one of your objects and you have redeclared x and y. In the Create Event of Obj_Global1 (or Obj_Global1_1, not sure as I am looking through the objects outside of the IDE) you have set done the following:
Code:
global.y = 0;
global.x = 0;
As has already been mentioned you cannot set up global variables with the same names as internally defined variables. Change you global.x and global.y to some other names, and then make sure you have set all of the references to these to be the new names and then try again.
 
A

Ash2o

Guest
global.x and global.y are in this project since a long time ago and the game was running perfectly. The problem popped up several days later. Unfortunately I don't have it anymore but in the second Project, the only object was an object with the only code y = y + 2; and the game also crashed
 
A

Ash2o

Guest
Oh my god, I am so sorry ! You are fully right ! It was the global.x and global.y which were making all this mess ! Thank you so such, you saved my game ! I swear I will never use global.x and y ever !
Hm it's kinda strange I was pretty sure game was working even with those guys... But it seems I am wrong sorry.
Thank you again !
 
Hm it's kinda strange I was pretty sure game was working even with those guys... But it seems I am wrong sorry.
In earlier runtimes you could define global variables and I think they possibly could work, but in one of the runtimes this was stopped from being allowed as it is exceptionally bad practice.
 
Top