createTextual and global overlays

Started by EnterTheStory (aka tolworthy), Mon 26/05/2008 13:18:14

Previous topic - Next topic

EnterTheStory (aka tolworthy)

(Edited for simplicity)

In this code, the overlay is deleted after leaving the room. I tried declaring it globally, and even tried declaring it separately in each room, but it only ever works in the first room. Any suggestions?

Code: ags

// global script
Overlay* myOverlay;
int whatOverlay;
function backgroundDialog(String what)
{myOverlay = Overlay.CreateTextual(160,100, 200,0,textColor,what); 
}	

Code: ags

// on_mouse_click:
whatOverlay++;
if(whatOverlay ==1)cEgo.Say("This is regular text, for comparison");
if(whatOverlay ==2)backgroundDialog(0,"1 0123456789");
if(whatOverlay ==3)backgroundDialog(0,"10 0123456789 0123456789");
if(whatOverlay ==4){backgroundDialog(0,"The Quick Brown Fox jumps Over The Lazy Dog."); whatOverlay =0;}


SMF spam blocked by CleanTalk