Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shaungaryevans on Wed 27/05/2009 15:14:10

Title: Display Text`
Post by: shaungaryevans on Wed 27/05/2009 15:14:10
Hi,

Just a quick question,

Can you put a display text, such as 'Display("hello") on a timer. If yes, how would you do it please?
Title: Re: Display Text`
Post by: Snake on Wed 27/05/2009 15:28:05
If I understand corrently, yes. You could do it like this:


//set your timer and check it in repeatedly execute
//or whatever script you need it to be run...
if (IsTimerExpired(1)==0{}//don't do anything
else if (IsTimerExpired(1)==1){
 Display("Hello.");
 }


You can even do it in the middle of it, for example:

//say you set your timer for 1000
if (IsTimerExpired(1)==500){
 Display("Hello.");
 }
else {} //don't do anything


I believe that would work, but I haven't tested it.
Title: Re: Display Text`
Post by: shaungaryevans on Wed 27/05/2009 16:23:06
What I mean is, how to set the timer so after a period of time the display text will go off?
Title: Re: Display Text`
Post by: Snake on Wed 27/05/2009 16:41:03
Quote from: shaungaryevans on Wed 27/05/2009 16:23:06
Where and how do you set the timer?

You can set it where ever you need it to be started, whether it be after the player enters the room, after clicking/looking at/walking on a hotspot - virtually wherever you need it.

You set it like this:

SetTimer(#, desired game loops "time");

For example;
SetTimer(1,80); //sets and initiates timer 1 to 80 (2 seconds). 40 game loops=1 second.

There are 20 available timers.
Quote from: AGS ManualThere are 20 available timers, with TIMER_IDs from 1 to 20.
Title: Re: Display Text`
Post by: shaungaryevans on Wed 27/05/2009 16:44:06
What I meant was, how to set the timer so after a period of time the display text will go off?
Title: Re: Display Text`
Post by: Khris on Wed 27/05/2009 17:28:45
Please fill in the blanks of the following sentence:

I want the Display text to go off  _____  seconds after  ______________ .
Title: Re: Display Text`
Post by: shaungaryevans on Wed 27/05/2009 17:42:39


I want the Display text to go off  5  seconds after  the text is displayed .
Title: Re: Display Text`
Post by: Matti on Wed 27/05/2009 17:51:21
1 second = 40 loops, so 5 seconds = 200 loops. Set the timer to 200 when the displayed text appears and make it disappear when the timer is expired.
Title: Re: Display Text`
Post by: shaungaryevans on Wed 27/05/2009 17:58:04
Quote from: Mr Matti on Wed 27/05/2009 17:51:21
Set the timer to 200 when the displayed text appears and make it disappear when the timer is expired.

how to make it disappear?
Title: Re: Display Text`
Post by: Snake on Wed 27/05/2009 18:30:45
Well, when you use the Display command, as in, Display("Hello");, it goes away after the user presses a key or clicks the mouse.

I think you may want to have a GUI constantly on and create a label on it to display what you want with the timer.
Title: Re: Display Text`
Post by: Pumaman on Wed 27/05/2009 18:36:16
Just put this in game_start:

game.skip_display = 0;

that will make Display() text boxes behave like speech does and automatically disappear after a while.