Display (string message, ...)Displays a message to the screen. It will be displayed in the standard message box, and centred in the middle of the screen. You can insert the values of variables using "%d" and "%s" in the message. To insert the value of an integer variable, use %d, to insert a string use %s.
Example:
int my_counter;
Display ("The counter is currently set to %d.", my_counter);
will replace the '%d' with the value of the variable "my_counter".NOTE: Display is a blocking function - that is, control will not return to the script until the player has removed the text window (by pressing a key or clicking the mouse). While the window is displayed, all other processing, like animations and interface display, are disabled. This is usually used for responses to the player LOOKing at things.
See Also: DisplayAt, DisplayMessage, DisplaySpeech, DisplayTopBar, StrFormat
DisplayAt(int x, int y, int width, string message, ...)Identical to the "Display" function, only this allows you to define the position and size of the window where the text is displayed. The X and Y variables define the co-ordinates of the upper-left corner of the window.
The WIDTH variable defines the maximum width of the window. The height is then automatically calculated so that the message fits into the window.
Note: This is a blocking call. See the "Display" help for more information.
Example:
DisplayAt (50,50,100, "This is a message");will display the message at coordinates 50,50 in a box 100 pixels wide.
See Also: Display, DisplayAtY
DisplayAtY (int y, string message)Similar to the Display function, except that this will display the message box at the specified Y location on the screen. The Y defines the co-ordinate of the top of the message box. The horizontal positioning will be automatically calculated as usual.
Example:
DisplayAt (50, "This is a message");will display the message at y coordinate 50.
DisplayMessage (int message_number)Identical to the Display function, but this uses a message text defined in the Room Editor rather than in the script. It will either use a message from the current room, or a global message (if message_number >= 500).
Example:
DisplayMessage(220);will display the message 220 of the Room message editor.
See Also: Display, DisplayMessageAtY
DisplayMessageAtY (int message_number, int yposition)Identical to the DisplayMessage function, except that the text box is positioned with its top at YPOSITION, the same way as DisplayAtY works.
This is useful if you have an important graphic in the middle of the screen that the text box would normally cover up - with this function you can place the message above or below it.
Example:
DisplayMessageAtY(527, 200);will display global message 527, in the lower half of the screen.
See Also: DisplayAtY, DisplayMessage
DisplaySpeech (CHARID, string message)Displays the text MESSAGE as speech above the specified character's head. The text will remain on screen for a limited time, and the user may or may not be able to click it away depending on the setting of "Player can't skip speech text". The text displayed by this function looks identical to that used by the dialog system.
NOTE: This function allows variables like "%d" and "%s" in the message.
Example:
DisplaySpeech (EGO , "My name is ego");will display the message above the character’s EGO head like the LEC games and play the character’s talking animation.
See Also: Display, DisplaySpeechAt, DisplaySpeechBackground, DisplayThought
DisplaySpeechAt (int x, int y, int width, CHARID, string message)Similar to DisplaySpeech, except that the text is displayed with its top left corner at (X,Y), in an area WIDTH wide.
You can use this function to write the character's speech text anywhere you like, and AGS will still play the character's talking animation and so on if appropriate.
NOTE: This function does not support QFG4-style speech.
Example:
DisplaySpeechAt (220, 20, 100, EGO , "My name is ego");will display the message in the top right corner of the screen, and play the character's talking animation.
See Also: DisplaySpeech, DisplaySpeechBackground
DisplaySpeechBackground (CHARID, string message)Similar to DisplaySpeech, except that this function returns immediately and the game continues while the character is talking. This allows you to have characters talking in the background while the player does other things. Note that the character's talking animation is not played if this function is used.
This command works by creating a text overlay with an automatic removal time delay. The overlay ID is returned by this command, so you can save it for use later with IsOverlayValid and RemoveOverlay, if you want to remove the text prematurely.
If background speech is already on-screen for CHARID, it will be removed and replaced with the new MESSAGE.
All background speech is automatically removed when a normal DisplaySpeech command is used (unless you set the global variable game.bgspeech_stay_on_display to 1).
Example:
DisplaySpeechBackground(MAN, "Hey, why don’t you talk to me?");will display the message above character MAN's head without pausing the game.
See Also: DisplaySpeech
DisplayThought (CHARID, string message)Displays the text MESSAGE as a thought above the specified character's head. The text will remain on screen for a limited time, and the user may or may not be able to click it away depending on the setting of "Player can't skip speech text".
How this function displays the text depends on a few things: the Speech Style setting, the 'Thought uses bubble GUI' setting, and whether the character has a thinking animation or not.
If the "Thought uses bubble GUI" setting is not checked, then the thought will be displayed in the same way as normal speech - the difference being that the character's thinking animation will play (or no animation if they don't have one).
If you are using Sierra-style speech and the character doesn't have a thinking animation, the thought bubble will be displayed in lucasarts-style.
If the "Thought uses bubble GUI" setting has been set, then the thought will be displayed like normal speech, except that the bubble GUI will be used for the window background. In Lucasarts-style speech this means above the character's head, in Sierra-style it will be done along the top of the screen as normal.
If the character has a thinking animation, it will just loop through once (it won't repeat).
NOTE: This function allows variables like "%d" and "%s" in the message.
Example:
DisplayThought (EGO, "I wonder what's for dinner.");will display the message above EGO's head and play the character's thinking animation.
See Also: DisplaySpeech, game.speech_bubble_width
DisplayTopBar(int y, int text_color, int back_color, string titleText, string message, ...)Displays a message in a text window, with a caption bar on top of it.
This displays MESSAGE in a similar way to the normal Display command, but above the text window a caption bar will be displayed with TITLETEXT in it. This method was used in some early Sierra games to indicate who was talking by having their name in the caption, and can be handy if you don't want to draw a talking view for a character.
This function supports the use of "%d" and "%s" in the message.
The Y parameter specifies the Y location on the screen where the message box will appear. The default is 25.
The TEXT_COLOR parameter specifies the text colour of the top bar, and the BACK_COLOR specifies the background colour of the top bar.
You can pass 0 for Y, TEXT_COLOR or BACK_COLOR - if you do, it will use the setting you used last time.
There are a couple of game variables available which can further customize the look of the bar. You can change these before calling DisplayTopBar.
game.top_bar_bordercolor sets the colour used for the bar's border (set to the same
colour as the backcolor if you don't want a border)
game.top_bar_borderwidth sets the width of the bar's border, in pixels (default 1)
game.top_bar_font sets the font to use for the top bar. The default is -1, which means
that the current Normal font is used. Set it to a specific number to use that font instead.
Example:
DisplayTopBar(25, 8, 7, "Evil wizard", "Get out of my house and never return!");will display "Get out of my house and never return!" in the message box, with the caption bar reading "Evil wizard". The message box will have dark grey text on a light gray background.
GetDialogOption (int topic, int option)Finds out whether an option in a conversation is available to the player or not.
TOPIC is the topic number, from 0 to the number of topics - 1. Find this out in the Room Editor.
OPTION is the option number within that topic, from 1 to whatever the highest option is for that topic.
The return value can have the following values:
0 The option is disabled - the player will not see it
1 The option is enabled - the player can see and use it
2 The option is permanently disabled - no other command can ever turn
it back on again.
These are the same as the options passed to SetDialogOption.Example:
if (GetDialogOption (4, 2) != 1)
Display("It's turned off");
Will display a message if option 2 of topic 4 is not currently switched on.See Also: SetDialogOption
RunDialog (int topic)Starts a conversation using topic number TOPIC. This is identical to the "Run dialog topic VAL" room interaction command.
NOTE: The conversation will not start immediately; instead, it will be run when the current script function finishes executing.
If you use this command from within the dialog_request function, it will specify that the game should return to this new topic when the script finishes.
Example:
RunDialog(3);will start conversation topic number 3.
See Also: SetDialogOption
SetDialogOption (int topic, int option, int new_state)Changes whether an option in a conversation is available to the player or not. This allows you to add extra options to a conversation once the player has done certain things.
TOPIC is the topic number, from 0 to the number of topics - 1. Find this out in the Room Editor.
OPTION is the option number within that topic, from 1 to whatever the highest option is for that topic.
NEW_STATE controls what happens to this option. It can have the following values:
0 The option is disabled - the player will not see it
1 The option is enabled - the player can now see and use it
2 The option is permanently disabled - no other command can ever turn
it back on again.
These are equivalent to the option-off, option-on, and option-off-forever
dialog commands.Example:
if (GetGlobalInt(10)==1)
SetDialogOption(4,2,1);
will enable option 2 of topic number 4 if the Global Integer 10 is 1.See Also: GetDialogOption, RunDialog, StopDialog
SetSkipSpeech (int new_mode)Changes whether the player can skip speech text by clicking the mouse. This option is initially set in a checkbox in the Main tab of the editor, but this function allows you to change it at run-time. The value of NEW_MODE means the following:
0 player can skip text by clicking mouse or pressing key 1 player can skip text by pressing key only, not by clicking mouse 2 player cannot skip text with mouse or keyboard 3 text does not time-out; player must click mouse or press key each time 4 player can skip text by clicking mouse only, not by pressing keyExample:
SetSkipSpeech(2);will make the player unable to skip the text by pressing a mouse button or a key.
SetSpeechFont (int font_number)Changes the font used for character speech. FONT_NUMBER must be from 0 to the number of fonts you have. By default the only options are 0 and 1.
Example:
SetSpeechFont (5);will change the character’s speech font to 5.
See Also: SetNormalFont
SetSpeechStyle (new_style)Changes the way in which speech text is displayed. This modifies the setting originally set in the editor. NEW_STYLE can be:
SPEECH_LUCASARTS speech text over character's head SPEECH_SIERRA close-up portrait of character SPEECH_SIERRABKGRND close-up portrait + background window for text SPEECH_FULLSCREEN QFG4-style full screen dialog picturesExample:
SetSpeechStyle (SPEECH_SIERRA);will change the speech style to a close up portrait of the character.
StopDialog ()This command can only be used from within the dialog_request function. It tells AGS that when dialog_request finishes, the whole conversation should stop rather than continuing with the dialog script.
You can use this function to end the conversation depending on whether the player has/does a certain thing.
Example:
function dialog_request (int dr) {
if (dr==1)
{ AddInventory(3);
StopDialog(); }
will give the player the inventory item 3 and then end the conversation.See Also: SetDialogOption