Text Overlay (how to prevent disappearance) [SOLVED]

Started by Mr Games, Tue 20/11/2018 20:35:56

Previous topic - Next topic

Mr Games

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?

Khris

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.

Mr Games

#2
Thank you so much, Khris.

I put function room_beforeFadeIn; at the top of the room script and that fixed it.

Khris

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:
Code: ags
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.

Mr Games

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.

SMF spam blocked by CleanTalk