-
Notifications
You must be signed in to change notification settings - Fork 13
RTS Tips and Menus
RTS can be very useful for displaying messages to the player. The tip system is quite powerful, you can define how long to show the tip, as well as the color/position/size of the message. Multiple tips can be active at the same time on different "slots".
You can also show custom menus to the player, and act upon their choices. This allows RPG elements like dialogs with NPCs, or vending machines, etc.
COMMAND | ARGUMENTS | DESCRIPTION | DETAILS |
---|---|---|---|
TIP | <text> [time] [audible tip] [scale] | Displays an on-screen message. Combine with TAGGED_REPEATABLE for a repeating tip. NOTE: only the player(s) which trigger the script will see the message and hear the sound. |
<text> is the text which will be
shown to the player.
The text is limited to 80 characters across, and 8 lines down.
Default position is exactly centered on the screen
(see TIP_SET_POS command to change the position).
[time] a time value indicating how long it stays on screen (in either ticks or seconds). The default time is 3 seconds.
[audible tip] can be set to TRUE or FALSE. If true, the [TINK] sound is played. If you want to use a custom sound, set it to false, and add a PLAY_SOUND command. [scale] sets the scaling factor of the tip. EDGE Classic 1.35.1 or higher. |
TIP_LDF | <ldf ref> [time] [audible tip] [scale] | Displays an on-screen message.
There are two types of TIP commands: Combine with TAGGED_REPEATABLE for a repeating tip. NOTE: only the player(s) which trigger the script will see the message and hear the sound. |
<ldf ref> is the text which will be
shown to the player.
The text is limited to 80 characters across, and 8 lines down.
Default position is exactly centered on the screen
(see TIP_SET_POS command to change the position).
[time] a time value indicating how long it stays on screen (in either ticks or seconds). The default time is 3 seconds.
[audible tip] can be set to TRUE or FALSE. If true, the [TINK] sound is played. If you want to use a custom sound, set it to false, and add a PLAY_SOUND command. [scale] sets the scaling factor of the tip. EDGE Classic 1.35.1 or higher. |
TIP_SLOT | <slot number> | Defines a slot for a tip, which, once defined, can then be formatted using the rest of the TIP commands. Primarily useful for displaying more than one TIP at a time (by using a different slot for each TIP). | <slot number> is a number from 1 to 45 (There are 45
available slots total).
NOTE: the default slot for tips is 1 (white centered) if left undefined. If you want to display two independant tips on the screen at the same time, set the first to slot 10, and the second to slot 11 (different slots). Then you can use TIP_SET_POS and TIP_SET_COLOUR to change just those tips position and color. Likewise, if all tips displayed that exist in the same slot, the newest displayed tip will take the place of the previous (they won't overlap). You'll probably want to use TIP_SET_POS with TIP_SLOT, otherwise the tips will show on top of each other, and will be unreadable. Slots 1-9 are pre-defined to three colors and three positions: white, blue, and yellow, centered, left upper, and left lower. NOTE: if you set the TIP_SLOT at any point in your script, all tips in the rest of your script will use that same slot. So if you want to make one tip blue and upper left aligned, set the TIP_SLOT to 5, then in the next trigger or before the next tip, set the TIP_SLOT back to 1 for the default of white and centered. |
TIP_GRAPHIC | <graphic> [time] [audible] [scale] | Display an on-screen graphic. Almost exactly the same as the
plain TIP command except that the it shows a picture instead of text.
The graphic is drawn as if the screen resolution was 320x200. This means that a 320x200 picture will exactly cover the screen (regardless of the current resolution), and a 160x100 picture could fit four times on the screen. This can be changed by the [scale] parameter (see below). |
<graphic> is a reference to a graphic in a wad file.
[display] a time value indicating how long it stays on screen (in either ticks or seconds). [audible] can be set to true or false. If true, the [TINK] sound is played. If you want to use a custom sound, set this to false, and add a PLAY_SOUND command. [scale] stretches or shrinks the total size (both width and height) of the tip graphic. 1.0 is normal perspective, 2.0 will make the graphic twice as big, 0.5 will make the graphic half normal size. |
TIP_SET_ALIGN | <alignment> | Use this command to reposition existing tips either centered (the default) or left aligned. | <alignment> can be either CENTER or LEFT. |
TIP_SET_COLOUR | <colour map entry> | Use this command to set the color of existing tips. | <colour map entry> is one of the colormaps names
defined in COLMAP.DDF, some examples:
NOTE: the default colormap is TEXT_WHITE, in case you change colors and want to set it back to the default at some point. |
TIP_SET_POS | <X offset> <Y offset> | Use this command to reposition existing tips that are onscreen. | <horizontal offset> is a percentage value, where 0% would
be the very left of the screen and 100% the very right.
<vertical offset> is a percentage value, where 0% would be the very top of the screen and 100% the very bottom. NOTE: the default positioning for tips is the middle of the screen (50% 50% center). So this command is only useful if you want to display tips somewhere else on the screen. For example, using a series of these commands and wait commands, you can make text scroll across the screen, or make an entire sentence move from the center point up to the top of the screen. |
TIP_SET_TRANS | <target translucency> [time] | Use this command to make onscreen tips fade in or out, or just set a translucency value instantly. | <target translucency> is a percentage value, from 0% (invisible)
to 100% (solid).
The translucency affects all tip types, even graphics,
but only those using the same slot (see TIP_SLOT).
[time] a time value indicating how long it takes for the TIP to reach the desired translucency (in either ticks or seconds). To make it fade instantly, leave the fade time blank. Note that the script itself is not delayed. |
MENU_STYLE | <style> | Changes the properties of the next menu to be displayed, such as font colours, background images, translucency, etc. EDGE Classic 1.35.1 or higher. |
<style> is the name of the style to be applied. Please refer to styles.ddf documentation for details on styles. NOTE: The next commands do not have any effect in MENU_STYLE: BACKGROUND.ASPECT, TEXT.TRANSLUCENCY, ALT.TRANSLUCENCY, TITLE.TRANSLUCENCY, HELP.TRANSLUCENCY, TEXT.ASPECT, ALT.ASPECT, TITLE.ASPECT, HELP.ASPECT. |
SHOW_MENU | <title> [opt 1] [opt 2] [...] | Displays a menu to the player, which pauses the game (including all scripts) until the user makes a valid selection. You must use TAGGED_INDEPENDENT with this command. Also note that if the menu is repeatable (i.e. TAGGED_REPEATABLE) you must use RETRIGGER at the end of your radius trigger script (see script below for an example). | <title> is the main text which
will be shown to the player.
[opt 1] and consecutive ones are the available choices for the user to select. If only one option is available then the menu option is NOT prefixed with "1.", and SPACE/ENTER keys can be used to accept it. Savegames are disabled while the RTS menu is shown. Once the menu is finished, the JUMP_ON MENU command will test the result, and jump to the matching label. It will fail to jump if there aren't enough labels, or menu could not be shown (e.g. multiplayer game). The title can contain newlines (given by "\n"), to make multi-line titles. Newlines don't work in the options however. Tip: to keep the SHOW_MENU command readable, you can split it across multiple lines by placing the \ character at the end of each partial line. |
SHOW_MENU_LDF | <ldf> [opt 1] [opt 2] [...] | Displays a menu to the player, which pauses the game (including all scripts) until the user makes a valid selection. You must use TAGGED_INDEPENDENT with this command. Also note that if the menu is repeatable (i.e. TAGGED_REPEATABLE) you must use RETRIGGER at the end of your radius trigger script (see script below for an example). | <ldf> is the main text which
will be shown to the player.
[opt 1] and consecutive ones are the available choices for the user to select. If only one option is available then the menu option is NOT prefixed with "1.", and SPACE/ENTER keys can be used to accept it. Savegames are disabled while the RTS menu is shown. Once the menu is finished, the JUMP_ON MENU command will test the result, and jump to the matching label. It will fail to jump if there aren't enough labels, or menu could not be shown (e.g. multiplayer game). The title can contain newlines (given by "\n"), to make multi-line titles. Newlines don't work in the options however. Tip: to keep the SHOW_MENU command readable, you can split it across multiple lines by placing the \ character at the end of each partial line. |
JUMP_ON | <var> <lbl 1> [lbl 2] [...] | The JUMP_ON command will test the value in the variable and jumps to the corresponding label. When the variable is 1, it jumps to <label 1>, when the variable is 2, it jumps to <label 2>, and so forth. | <var> can only be "MENU" currently. This variable
is set by the SHOW_MENU or SHOW_MENU_LDF commands. Once
a menu selection has been made, the JUMP_ON MENU command
will test the result, and jump to the corresponding label.
<lbl 1> and consecutive ones are the labels to jump to depending on the option chosen in the menu. It will fail to jump if there aren't enough labels, or the variable is zero (which happens when the menu could not be shown, e.g. the game is multiplayer). |
The next example shows how to use TIP_SLOT to define TIP formats
RADIUS_TRIGGER 0 0 -1
TIP_SLOT 2
TIP_SET_POS 12% 12%
TIP_SET_ALIGN LEFT
TIP "Hello..."
TIP_SLOT 3
TIP_SET_POS 12% 35%
TIP_SET_ALIGN LEFT
TIP "...World."
END_RADIUS_TRIGGER
Example on how to show a graphic to screen using TIP_GRAPHIC
RADIUS_TRIGGER 0 0 -1
TAGGED_IMMEDIATE
TIP_GRAPHIC STFST31 5 false
END_RADIUS_TRIGGER
The next RTS script will show a menu on screen where the player has to choose among the given options.
RADIUS_TRIGGER 0 0 -1
TAGGED_USE
TAGGED_INDEPENDENT
//step 1: what we want to show
SHOW_MENU "What can I do for you?" \
"Give me Health" \
"Give me Ammo" \
"Nothing"
//step 2: where we want to jump to
JUMP_ON MENU option1 option2 option3
//some labeled RTS
LABEL option1
HEAL_PLAYER 150 200
TIP "Have some health"
JUMP finished
LABEL option2
GIVE_BENEFIT BULLETS(100)
TIP "Have some ammo"
JUMP finished
LABEL option3
TIP "OK then. Have a nice day"
JUMP finished
LABEL finished
END_RADIUS_TRIGGER
_RTS docs written by many contributors. _