Create Event launched twice

Spongyoshi

Member
Sooooo I have a weird bug in Game Maker 8.1 where my create event gets initiated twice (I checked, there was only one instance of said object in the room) Anyone would have any idea as to how or why would it occur? I can give additional details about this problem if needed!
 

Finn

Member
How are you creating your instances?
By placing them in the room or through a script?
Did you check that the instances are not duplicated in different layers maybe?
 

TheouAegis

Member
How did you verify that there was only one instance in the room?

if you could legit verify that there was only one instance in the room, then that would suggest that some other object was running that same code through some invalid pointers.
 

Spongyoshi

Member
@Finn I put them in the room myself, I even deleted it and re-put it myself multiple times in the room just to be sure!
@TheouAegis I checked by checking all instances when running my .exe in debug mode. All the instances this object creates were doubled but not this particular object.
@Relic Thanks for the help but I checked that thread already before sending this message here and it sadly didn't help :(
If this help, here's a link to an image of some screens of my objects: https://scontent-mrs1-1.xx.fbcdn.net/v/t1.0-9/48397681_2141733612543974_8246287330864791552_o.jpg?_nc_cat=106&_nc_ht=scontent-mrs1-1.xx&oh=29412200a8b062e06a4ab583ee1d188f&oe=5CA51082
 

TheouAegis

Member
You didn't put the same code in the Instance Creation code, did you?

You didn't put similar code in the Room Creation Code of the room, did you?

The fact that it supposedly happens AFTER the sleep is odd.

So there are 2 Mario OR Sonic (but not both), 2 AI1, 2 AI2, 2 AI3, 2 skateman1, 2 skateman2, and 2 Ready, only 1 PisteCourte? Are there any other instances in there? If so, did you check through all of their codes as well? Did you make sure none of them have PisteCourte as a parent?

You didn't use event_perform() in a code block somewhere, did you?
 

Spongyoshi

Member
Thanks a lot for asking all of theses questions since it's the first time such an error happened to me, so:
- I never used Instance Creation nor Room Creation
- There is either 2 Mario or 2 Sonic but there is also either 2 skaterun1 or 2 skaterun2 since one is related to Mario and the other is related to Sonic. The rest is exact! There is other instances as well in the room and I checked again to be sure, couldn't find anything of particular interest, they do not interact with PisteCourteStarter in any way nor are parents.
- I never used event_perform()
Also, just to be sure, I deleted the PisteCourteStarter of the room as a test and the objects it spawns never appeared. Then, put a fresh one, the error came back...
 

samspade

Member
Don't know what the debugger is like for your version, but it seems like the best solution would be to put a break point in the first create event of the first instance created and literally step through every line of code and watch how the program runs.
 

Relic

Member
Don’t know if break points can be added to drag and drop.

I think there is a way to convert your drag and drop to gml code in a text file. If you can provide this file it may give more clues- because nothing appears out of the norm in your screen capture.
 

TheouAegis

Member
Also, just to be sure, I deleted the PisteCourteStarter of the room as a test and the objects it spawns never appeared. Then, put a fresh one, the error came back...
Unless you are double clicking (which would appear in the debugger), then that is disconcerting.

Do you have Change Instance anywhere? Like, maybe you didn't even mean to use it but accidentally did, or you meant to and picked the wrong object. If you change any instance and set it to run Create Events, then this could happen.

After checking that, try NOT spawning each object one at a time. Take out the Mario line, test, put Mario back in. Take out each AI speedskating line one at a time, test, put it back in. See if removing any one object spawn fixes this issue.
 

Spongyoshi

Member
I have checked all the objects in the room but they don't use Change Instance. I'll try those tests right now plus some others and I'll post again the results! Hope I can localize where it's from! (And thanks a lot for the help so far btw!)
I couldn't find any breakpoints in Game Maker 8.1 but here is the object in text form:
Information about object: PisteCourteStarterPack
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Mask:
Create Event:
for all Settings: if CharacterPick is equal to 0
create instance of object skaterun1 at position (0,0)
create instance of object Mario_Start5 at relative position (0,+100)
for all Settings: if CharacterPick is equal to 1
create instance of object skaterun2 at position (0,0)
create instance of object Sonic_Start5 at relative position (0,+100)
create instance of object AI1_SpeedSkating at relative position (0,-50)
create instance of object AI2_SpeedSkating at relative position (0,0)
create instance of object AI3_SpeedSkating at relative position (0,+50)
create instance of object Ready at relative position (+215,0)
Step Event:
for all Settings: if CharacterPick is equal to 0
jump to position (Mario_Start5.x,Mario_Start5.y)
for all Settings: if CharacterPick is equal to 1
jump to position (Sonic_Start5.x,Sonic_Start5.y)
if number of objects EventFinish is Larger than 0
jump to position (Finish.x,Finish.y)
 

Spongyoshi

Member
Well that was an excellent idea @TheouAegis
It seems like the "Ready" object is the problem! When I get rid of it, I get no copies! But when I add it back, the problem comes back (right after the sleep) however I cannot find anything suspicious, especially since this object doesn't trigger any error in another room I used it!
Just in case, I'm sharing the text version of "Ready"'s code as well if it can help!
Information about object: Ready
Sprite: Ready
Solid: false
Visible: true
Depth: -9000
Persistent: false
Parent:
Mask:
Create Event:
play sound StartMario; looping: false
sleep 3000 milliseconds; redrawing the screen: true
play sound CountdownMario; looping: false
set the sprite to 3 with subimage 0 and speed 1
set variable Start to 97
Step Event:
set variable Start relative to -1
if Start is equal to -31
set the sprite to Undefinied with subimage 0 and speed 1
if Start is equal to 0
set the sprite to GO with subimage 0 and speed 1
if Start is equal to 33
set the sprite to 1 with subimage 0 and speed 1
if Start is equal to 66
set the sprite to 2 with subimage 0 and speed 1
if Start is equal to -40
create instance of object Music at position (0,0)
execute code:

if (self.Start == 0)
{ LakituStart.sprite_index = LakituFeuVert; CharmyStart.sprite_index = CharmyFeuVert; }
 

TheouAegis

Member
Put Ready back in. Remove the Sleep action. Test.

It shouldn't change anything, but it's my only hypothesis right now.
 

Relic

Member
Ready code looks fine.

Ready is also responsible for creating an instance of the Music objects. If removing sleep has no effect, please give the code for Music too. (My thinking is with no Ready there is no Music which could be where the issue is hiding)
 

TheouAegis

Member
Ready code looks fine.

Ready is also responsible for creating an instance of the Music objects. If removing sleep has no effect, please give the code for Music too. (My thinking is with no Ready there is no Music which could be where the issue is hiding)
But with no Music, there is no Joy in this world!
 

Spongyoshi

Member
@Relic You are correct, without "Ready" there is no "Music" but this isn't an instant spawn so the object is created AFTER the instances are doubled!

And what do you know, getting rid of the sleep function actually fixes the problem! So I'll just have to program a workaround to add some sort of custom waiting function as I want to let a little time pass before the event actually starts to let a jingle play before it but still, thank you very much for your help everyone!! And sorry if I took a while to respond..

(Although maybe should I share this?)
Information about object: Joy
Sprite:
Solid: false
Visible: false
Depth: 9999
Persistent: false
Parent: This world!
Mask:
Create Event:
execute code:

if (forumyoyogames.HelpfulCommunity == true)
{ Spongyoshi.GameProjectWorking = true;
show_message ("Thanks a lot LOT for your help everyone!!"); }
 
Top