Display Text`

Started by shaungaryevans, Wed 27/05/2009 15:14:10

Previous topic - Next topic

shaungaryevans

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?

Snake

If I understand corrently, yes. You could do it like this:

Code: ags

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

//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.
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

shaungaryevans

#2
What I mean is, how to set the timer so after a period of time the display text will go off?

Snake

#3
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.
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

shaungaryevans

What I meant was, how to set the timer so after a period of time the display text will go off?

Khris

Please fill in the blanks of the following sentence:

I want the Display text to go off  _____  seconds after  ______________ .

shaungaryevans



I want the Display text to go off  5  seconds after  the text is displayed .

Matti

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.

shaungaryevans

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?

Snake

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.
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Pumaman

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.

SMF spam blocked by CleanTalk