Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mr Games on Tue 20/11/2018 20:35:56

Title: Text Overlay (how to prevent disappearance) [SOLVED]
Post by: Mr Games on Tue 20/11/2018 20:35:56
Hi all,

I'm already aware that text overlays are removed when the player changes room:
Quote...except that with this command the text stays on the screen until either you remove it with the Remove command, or the player goes to a different room, in which case it is automatically removed.

When I first read this I mistakenly assumed it just meant remove from sight. Now I see that returning to a room I cannot get that text to reappear.

Just to clarify, is it possible to recreate the overlay (via whatever triggers it) every time that room is revisited? Or is this counter-intuitive?
Title: Re: Text Overlay (how to prevent disappearance)
Post by: Khris on Tue 20/11/2018 20:41:08
It's possible, and you'd do it in the "player enters room before fadein" event. It's an event that is triggered each time the room is visited.

Please always state what you've tried (including the code you've used and where you placed it) and how it failed.
Title: Re: Text Overlay (how to prevent disappearance)
Post by: Mr Games on Tue 20/11/2018 23:00:12
Thank you so much, Khris.

I put function room_beforeFadeIn; at the top of the room script and that fixed it.
Title: Re: Text Overlay (how to prevent disappearance)
Post by: Khris on Tue 20/11/2018 23:41:31
Looking at your reply, that's quite hard to believe, to be frank.
Properly linking the event via the room editor will append a function called room_Load at the end of your room script, and as long as the Overlay is declared in global scope and created in there, it should work.

So something like:
Overlay *someFloatingText;

function room_Load() {
  someFloatingText = Overlay.CreateTextual(...);
}


Even if it did work for you but you merely wrote this post from memory, keep in mind that other newbies might find this thread and end up severly mislead.
Title: Re: Text Overlay (how to prevent disappearance)
Post by: Mr Games on Wed 21/11/2018 17:30:05
You were right and it wasn't fixed. I must have produced some text I hadn't seen the first time.
I'm starting to get the hang of things now. Please consider this solved.