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

GM8.1 > GM:S Import, Strange Runtime Error

M

MineAndCraft12

Guest
So I've been writing a game for about a year now, a top-down game with some car racing.

I recently upgraded to GM:S (Humble Bundle!) and imported my .gm81 into Studio.

While I understand there should be and will be errors, I had a very strange error that I'm having a hard time tracing. Perhaps the community would be a bit help here.

When the cars crash, I have them respawn after a few seconds, grabbing some variables from the crashed debris and the finish line, which keeps track of the laps.

On respawn, the cars give me this error:
Unable to find any instance for object index '54' name 'sb_parent'
at gml_Object_player_CreateEvent_11 (line 5) - lapsDone = finish.one

This is where I began to get confused. While it is correct that no instance of sb_parent exists in the room, there is no reference in the Create code for the player object to sb_parent... Here's Action 11 in the Create Event, which I've recreated as text using the descriptions of the events...
11: if number of objects p_dead is larger than 0
12: start of a block
13: set variable lapsDone to finish.one
14: end of a block

As you can see, no reference to
sb_parent is made anywhere in this code. (p_dead is the player debris, lapsDone is just used for display purposes, and finish.one is the finish line's player lap count)

In fact, the only reference to
sb_parent anywhere in the player object is in a Collision event. The Collision event could not possibly have fired, since there are no instances of that object in the current room.

The
finish object makes no references to sb_parent.

The sb_parent object and its children have no events. They are simply obects for the player to collide with, and the player handles everything after that.

From all the code I've looked through, player never makes any attempts to count how many sb_parents there are, either.

The error also occurs in rooms that do contain instances of sb_parent, but the error changes...
Variable sb_parent.<unknown variable>(100008, -2147483648) not set before reading it.
at gml_Object_player_CreateEvent_11 (line 5) - lapsDone = finish.one

Am I reading these error messages wrong? Or is this some bug with the gm81 > gmx import? Big thanks for anyone who can pitch in.
 

jo-thijs

Member
Hi and welcome to the GMC!

The error message is saying 'finish' isn't an object, but rather a variable that holds the value 54, which is the object index of 'sb_parent'.
Is this correct?

If not, could you give us the object information (text that appears when you click on "object information" when editing an object) of the player object and the finish object?
 
M

Misu

Guest
... The Collision event could not possibly have fired, since there are no instances of that object in the current room.
What object is parent of sb_parent?
You never did specify that in your explanation...

You could add this in the first line of the collision code:
Code:
if instance_number(sb_parent) == 0 exit
Although it wont help solve your problem exactly but you need to revise if any objects using that parent are in the room at all, otherwise, you will get that error. It is saying that instance does not exist and the other error says that a variable does not exist because it was not executed for use yet.
 
M

MineAndCraft12

Guest
sb_parent is used as the parent of 4 other objects (sb_l, sb_u, sb_d, and sb_r). No instances of any of these objects exist in this room, and the player object never checks for any instances of them. The only reference to sb_parent is a Collision event (Collision with sb_parent, event handled by player), and even within that event, no mention to sb_parent is made.

Also, the code provided would cause an instant exit on 6 of the 7 rooms.
 

jo-thijs

Member
Yup, importing gm81 to GM:S is causing trouble.
You've got multiple resource called finish.
You've got an object and a sprite called finish.
Your code is taking the sprite ID as object ID, which is messing stuff up.

The solution is easy, call the sprite finsh spr_finish and the object finish obj_finish
and adjust your code to it.
 
M

MineAndCraft12

Guest
Ah, this makes some sense. Thank you! I'll get back after the changes.
 
M

MineAndCraft12

Guest
Strange, I changed the target to HTML5 (now that I have GMS, I can export for my intended end product), and the errors no longer appear. I'm guessing HTML5 is using the older 8.1 variable handling system? Sadly, when I entered into the finish object to rename it, I got errors about the object already existing... I went back into the game and the entire finish object was corrupted... Seems, however, that HTML5 mode (my intended delivery) did fix the issue, and I did manage to export the project before I destroyed it.
 

jo-thijs

Member
That doesn't sound good...
It could be sheer coincidence HTML5 worked well,
which might turn against you later.

You say the project got destroyed?
Do you have backups of it in the backup folder?
If so, how do those behave?
Do you still have the gm81 file?
Does the project behave the same way if you try to import it again?
 
M

MineAndCraft12

Guest
Alright, I re-imported the entire project, and renamed all of the sprites before doing anything else. The project is working again, thanks!
 
Top