This USED TO work! Now getting black screen on change room.

Started by Zephyr, Sat 25/01/2020 12:46:08

Previous topic - Next topic

Zephyr

Hi, Everyone,

           I really hope I'm not being too much of a nuisance but I've just been doing some game testing and I've come across a new error for something that was working perfectly until recently.  I have several books scattered throughout the game which, on interaction, change the room to show the books' texts (with no visible character).  In each case the previous room is restored on mouse click. 

I've coded each of these almost exactly the same (the only difference being room coordinates I want the character to go to) and they're all working perfectly - except for this one!  Can anyone see any errors in my script for this room please?

Code: ags

Overlay *textOverlay;

function room_Load()
{
         gStatus.Visible = false;
         textOverlay = Overlay.CreateTextual (155, 187, 200, eFontNormal, 53248, "Click to continue...");
}

function on_mouse_click(MouseButton button) 
{
       cChristian.ChangeRoom (cChristian.PreviousRoom);
       gStatus.Visible = true;
}


Thanks for your time and sorry to bother you again!

- Zephyr.    (roll)
<3 Zephyr <3

Cassiebsg

Try moving this line to after_fade in:

textOverlay = Overlay.CreateTextual (155, 187, 200, eFontNormal, 53248, "Click to continue...");

Not sure you display text before fade_in.
There are those who believe that life here began out there...

Zephyr

Hi Cassiebsg,

           That part definitely still works.  I can enter the room that shows the text and says "click to continue".  It still displays just fine.  The problem is in the transition BACK to the original room.  On mouse click it just goes to black screen, although I do still have sound.

- Zephyr.
<3 Zephyr <3

Crimson Wizard

Is it possible to tell which room are you in after it turns to black?

Doing SetNextScreenTransition(eTransitionInstant); before the ChangeRoom will probably disable fadeout (if you have it as transition).

Then it will be clear whether it gets stuck in this room, or there's some error upon returning to the previous one.

Also, to double check, is cChristian a player character?

Zephyr

Crimson Wizard, you're amazing!

            I put that line in and it works great!  I still don't understand WHY it worked or where my problem was, but I sure am glad to have it working again.  And yes, cChristian is my main player character.

Thank you very much for your time.

- Zephyr.   :-*
<3 Zephyr <3

Crimson Wizard

Quote from: Zephyr on Sat 25/01/2020 17:08:57
            I put that line in and it works great!  I still don't understand WHY it worked or where my problem was, but I sure am glad to have it working again.

So, how does it work exacty now? What has changed? Was the error in same room or in previous room? All this seem pretty important to find out...

The line that I suggested was not meant to fix things, but simply to test them.

Zephyr

Oh, right!  I don't know how to tell in which room the problem was occurring.  All I know is that the game was loading fine into the text room, displaying the "click to continue" etc., but after clicking - instant blackness, no cursor, no status bar, just music. 

I just don't get it!  But weirdly, your diagnostic has definitely fixed the issue.  And, as I said before, I have a few rooms like this that are working fine with my original scripting!

- Zephyr.   (wtf)
<3 Zephyr <3

Khris

It sounds like you have custom room transition code that fails to fade in in that specific room?

The only other explanation I can think of is that the click interacts with something else, and AGS doesn't call your room's on_mouse_click but some other interaction (that leads to the black room/GUI).

You can also try pressing Ctrl+D to see which room you're in.

Zephyr

OK, thanks Khris,

            It's very strange because the original code that I put in for a similar "book" room came from you and worked really well.  Since then, every time I've done similar rooms I've pretty much copy/pasted everything you taught me and it's been just fine until now. I'll have another play around with it and see if I can get to the bottom of it.

- Zephyr.
<3 Zephyr <3

Matti

Just a thought: It may be easier to have a (screen-sized) GUI showing the book instead of having to change the room each time.

Zephyr

Hi Matti,

          We can do that? Screen-sized??  Really?? Hmmm...I'm wondering now if I could make it look as good as what I have with a room...but the only little experiments I've made with GUIs haven't been terribly successful.  They always end up looking crappy to be honest - especially with text - but then again I didn't know you could work it that big.

Thanks, Matti. If nothing else, you've given me something to think about here.  Maybe I'll play with it.

- Zephyr.   (nod)
<3 Zephyr <3

Matti

If the room with the book is just a background image you can easily replicate it with a screen-sized GUI that uses the same image.

Zephyr

Hi Matti,

          I've had a good old play with your GUI idea and it works a treat - and so much simpler than the "change room" thing that I had before! Thanks so much for your help.  You're awesome!

- Zephyr.   ;-D  :-*
<3 Zephyr <3

Matti


SMF spam blocked by CleanTalk