(Solved) Scripts won't run after changing rooms? (Sierra Template)

Started by skooperstooper, Sun 31/07/2022 23:39:22

Previous topic - Next topic

skooperstooper

I've been working on an intro. I set it up where room 0 has no background so it's black. There's a room size gui with a start button. When you press start, the gui disappears to reveal the room.

Then I used the "on key press" function to trigger text I wrote with "display at" so I can alternate between it being located on one side of the room and the other to imply different people talking.

I then used the "player change room" property to change to room 1. Since I'm still learning, I kept the tutorial room built into the template as room 1.

It does what I want. You press start to begin the game, press space/enter/whatever to advance the text, then it fades to reveal room 1 with the player standing in the same location as desired.

The problem is nothing happens after that. I started both room scripts with "after fade in" from events, but with room 1, no code I add in that function actually happens except placing characters. I can't even move.

For example, I tried using display at again and the text doesn't show up. I tossed in a bunch of functions to test. No response. I don't get any compiler errors, room 1 just fades in and sits there.

Is there something I'm specifically supposed to start and end rooms with to make sure each subsequent room works? I put "player change room" inside the "on key press" function of room 0 just because that was the last function in the room. Could that be messing things up somehow? Thanks!
Yes, I did the tutorial, went through the manual, and searched the forums and web. If I'm asking, it's because I missed it, forgot, or still don't get it.

skooperstooper

I finally figured it out! Two things were wrong...

1) I had the start menu gui property set to visible. I thought setting it to invisible by pressing start in room 0's script would override that for room 0 and every room I moved to after, but it didn't.

The gui was still in room 1 even though I couldn't see it, blocking input. No code I tried in either room script or in global worked to remove it from room 1. I had to change the gui's property to invisible to gain full control of it through scripting.

2) The "after fade in" event wasn't linked in room 1 so none of the functions I placed in it were getting called. I could've sworn I clicked on room events to create that function like I did with all the others but I guess not (laugh) Linking it after the fact fixed the problem.
Yes, I did the tutorial, went through the manual, and searched the forums and web. If I'm asking, it's because I missed it, forgot, or still don't get it.

Khris

GUIs are global objects that exist independently of rooms. Merely changing the player's room does nothing to a GUI.
Setting a GUI's .Transparency to 100 means it's invisible but catches all clicks.
Setting its .Visible to false means it's turned off globally.

SMF spam blocked by CleanTalk