Contents Up Previous Next

Text script global variables

The following variables are available to your script.

(For the characters, CHARID is the script ID name as set in the Room Editor). Names in bold are read-only variables and should NOT be modified by the script.

character[CHARID].x X co-ordinate of the character (see Note1 below)
character[CHARID].y Y co-ordinate of the character
character[CHARID].name The character's full name
character[CHARID].prevroom The room it was in before this one
character[CHARID].room Which room the character is in
character[CHARID].activeinv The currently selected inventory item (or -1)
character[CHARID].inv[x] Whether the character is carrying inventory X
character[CHARID].walking Whether the character is currently moving
character[CHARID].animating Set to 1 while an AnimateCharacter animation runs
character[CHARID].movespeed Current movement speed (use SetCharacterSpeed to change)
character[CHARID].animspeed The character's animation speed
character[CHARID].talkview The character's talking view number minus 1
character[CHARID].view Current view of the character graphic (minus 1)
character[CHARID].loop Current loop of the character graphic
character[CHARID].frame Current frame of the character's graphic
game.debug_mode Whether we are in debug mode or not.
game.following_room_timer How long to wait before following char emerges in new room, default 150. (higher is longer).
game.inv_activated Inventory item that the player last clicked on. Useful for unhandled_event.
game.items_per_line Number of inventory items displayed per line (useful for working out how much to scroll the window down)
game.max_dialogoption_width Maximum width of textwindow-based dialog options box. Default 180.
game.no_textbg_when_voice Normally 0. If 1, and the Sierra-style With Background speech style is in use, will change to the Sierra-style (No Bg) if a voice speech line is present.
game.num_inv_displayed Number of inventory items which can be seen in the inventory window.
game.num_inv_items Number of different inventory items which the current player is carrying.
game.roomscript_finished The on_call function has completed executing. (See CallRoomScript)
game.score The player's score. To modify the score, use the GiveScore text script function.
game.sierra_inv_color The background color of the sierra-style inventory.
game.skip_display Setting for how Display() messages are skipped; valid values are same as for SetSkipSpeech (default 3).
game.speech_text_gui The textwindow GUI number used for sierra-style spch.
game.swap_portrait Set to 1 to make sierra-style speech swap the portrait image from left to right when different people talk.
game.talkanim_speed The animation speed for talking views (default 5).
game.text_shadow_color Color used for speech text shadow (default 16).
game.text_speed How long speech text stays on the screen. Default 15, lower number means shorter time.
game.top_inv_item Index of the first inventory item in the window
game.total_score Maximum possible score, initially set in roomedit.
game.used_mode Cursor mode used with last click (use with "any click" events to find out which mode was used)
gs_globals[50] The graphical script global flags (0=clear, 1=set)
mouse.x Mouse X co-ordinate when the script was started (0-319)
mouse.y Mouse Y co-ordinate when the script was started (0-199)
palette[SLOT].r The red component (0-63) of palette slot SLOT
palette[SLOT].g The green component (0-63) of palette slot SLOT
palette[SLOT].b The blue component (0-63) of palette slot SLOT
player.[x,y,name,...] Alias to character[EGO]. Note: only set at game start, does not update if you change the player character.
savegameindex[20] Save game slot order - see the ListBoxSaveGameList description in text script reference for more info.
system.screen_height The vertical screen resolution (200 or 400) see Note2
system.screen_width The horizontal screen resolution (320 or 640)
system.color_depth The color depth (8 or 16).
system.os Interpreter version (1=AGS-DOS, 2=AGS-WIN).
system.windowed How game is running: 0=full screen, 1=window

Notes:

(1) The character X&Y co-ordinates may be modified as long as the character is stationary; changing these while the character is moving will cause it to start moving off in the wrong direction.

(2) The system information is provided in order for your game to behave differently if it needs to; however, do NOT use this information to force the player to use a specific resolution. The AC engine is designed to allow players with varying speeds of computer to enjoy the game at a playable speed; people with a 486 would rather see blocky graphics at 320x200 than be forced to run very slowly at 640x400.