Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: EnterTheStory (aka tolworthy) on Mon 26/05/2008 13:18:14

Title: createTextual and global overlays
Post by: EnterTheStory (aka tolworthy) on Mon 26/05/2008 13:18:14
(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?


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


// 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;}