Jump to content


Photo

room_goto doesn't always fire


  • Please log in to reply
12 replies to this topic

#1 Klassic

Klassic

    Magnesium Ninja

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 21 May 2012 - 07:06 PM

Hey guys, I have what I'm hoping is a simple question.

I have it set up so that when the animation of a door opening ends (a specific instance of a door object) this code is executed:

obj_player.x=X
obj_player.y=Y
room_goto(RM) 

X, Y and RM are all local variables defined in the creation code of the instance. The first two lines execute every single time without fail, but every once in a while the room fails to change. Is there any specific reason for this, or any better way I can go about doing this?

Thanks!
  • 0

#2 @Alex@

@Alex@

    Retired GMC Reviewer

  • Reviewer
  • 3075 posts
  • Version:Unknown

Posted 21 May 2012 - 07:14 PM

Can you run this before the room_goto

show_message(room_get_name(RM)) ; and make sure that it is displaying the name of the room you actually need to go to in all instances.
  • 1

#3 Klassic

Klassic

    Magnesium Ninja

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 21 May 2012 - 08:49 PM

I ran a test and it is indeed calling the correct room names. I tried putting the code into a script and calling just that, but it doesn't seem to make a difference. The room change still only fires about 40% of the time.

EDIT: I've noticed that this issue happens consistently with two doors, while it never happens with others.

Edited by Klassic, 21 May 2012 - 09:01 PM.

  • 0

#4 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 4749 posts
  • Version:GM8

Posted 21 May 2012 - 11:42 PM

Delete those doors and try again
  • 0

#5 Klassic

Klassic

    Magnesium Ninja

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 22 May 2012 - 03:52 AM

Deleting the doors and recreating them had no effect, it still refuses to execute occasionally. I did a test and made the room/coordinate change immediately upon using the door, instead of at the end of the animation. The same issue exists; the door will work most of the time but every once in a while there is no correct room change.

One thing I wanted to look at was whether or not GM was still registering a Room End event, and it is. I'm not entirely sure what that implies, though. Perhaps the room is changing and then immediately reverting?
  • 0

#6 wakeskater_X

wakeskater_X

    GMC Member

  • GMC Member
  • 450 posts

Posted 22 May 2012 - 03:54 AM

That could be it. Klassic, do you have some event from the other room that could have been paused when you swapped rooms and makes you go back immediately?
  • 0

#7 Klassic

Klassic

    Magnesium Ninja

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 22 May 2012 - 04:46 AM

Nothing that would logically have that effect.

Also, I tentatively retract the idea that it switches to a new room and returns. It was happening earlier and now it isn't. This problem is ludicrously inconsistent :\
  • 0

#8 GMKn00b

GMKn00b

    GMC Member

  • GMC Member
  • 150 posts
  • Version:Unknown

Posted 22 May 2012 - 07:19 AM

Hey guys, I have what I'm hoping is a simple question.

I have it set up so that when the animation of a door opening ends (a specific instance of a door object) this code is executed:

obj_player.x=X
obj_player.y=Y
room_goto(RM) 

X, Y and RM are all local variables defined in the creation code of the instance. The first two lines execute every single time without fail, but every once in a while the room fails to change. Is there any specific reason for this, or any better way I can go about doing this?

Thanks!

Hmmm....I had the same problem.
Try change your room name to rm_room (something like that)
Then just modify your code to room_goto(rm_room)

I just started using GML so i'm not sure if i'm right :sweat:

EDIT: I realized it won't do a thing.....but try if it works....

Edited by GMKn00b, 22 May 2012 - 07:23 AM.

  • 0

#9 Klassic

Klassic

    Magnesium Ninja

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 23 May 2012 - 03:44 AM

Doesn't really solve my problem, but I appreciate the interest.

I'm assuming it has something to do with the game trying to read the variable "RM", because otherwise there's no reason for the code to not execute 100% of the time. I just don't see why GM would disregard the code rather than error if it was unable to read the variable properly.
  • 0

#10 @Alex@

@Alex@

    Retired GMC Reviewer

  • Reviewer
  • 3075 posts
  • Version:Unknown

Posted 23 May 2012 - 10:20 AM

If its always displaying the correct name it shouldn't be a problem with reading the variable. Put some sort of alert after the room_goto statment and see it fires when you don't move rooms.
  • 0

#11 Klassic

Klassic

    Magnesium Ninja

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 23 May 2012 - 11:17 PM

Found something interesting while running that test: I had the door object give an alert on room end AND room start. What I found is that when the room failed to change, it displayed the room end message but not the room start message. Colour me confused.

EDIT: I'm getting the feeling that it's not the objects reacting, it's the room. Would room persistency have any impact on this?

Edited by Klassic, 23 May 2012 - 11:22 PM.

  • 0

#12 wakeskater_X

wakeskater_X

    GMC Member

  • GMC Member
  • 450 posts

Posted 26 May 2012 - 03:50 AM

Yes. If a room is persistent It does not START again, when you go back it continues exactly as it was left. So enemy positions / movement, etc stays frozen until you return.
  • 0

#13 Klassic

Klassic

    Magnesium Ninja

  • GMC Member
  • 236 posts
  • Version:GM8

Posted 31 May 2012 - 04:36 AM

Understood, but what I'm getting at is that when the room change successfully fires, it displays a room end and a room start notification. When it doesn't fire, the room merely ends and nothing appears to start. I'm not sure what that implies.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users