OpenBOR Wiki OpenBOR,Script System Variables

System Variables

System variables are global variables within the engine that OpenBOR relies upon to conduct its various operations. OpenBOR script allows access to several of these through the openborvariant() and setopenborvariant() functions.

Use Cases

Get a system value. Most system variables are integers. See the list of available variants for exceptions.

mixed x = openborvariant(<string identifier>);

Modify a system value. Some OpenBOR variants are read only. See the list of available variants for details.

mixed x = <value>;

setopenborvariant(<string identifier>, x);
  • Unless otherwise noted, any list of items in OpenBOR is 0 indexed. That means the first item is 0, the next is 1, and so on.
  • Unless otherwise noted, all binary flags are 0 = False, 1 = True.

List

NameTypeRead OnlyDescription
backgroundPointerCurrent background screen. By creating a new screen and accessing its pointer, you can replace the current background in real time.
blockadeFloatScroll position mark where the player can no longer move.
branchnameStringXWhen a branch item is activated, this will indicate name of the level. Not recommended for most cases – use current_branch instead.
cheatsIntegerXIndicates if cheats have been enabled from the OpenBOR menu.
count_enemiesIntegerXCurrent number of enemy type entities in play.
count_entitiesIntegerXCurrent number of entities in play.
count_npcsIntegerXCurrent number of NPC type entities in play.
count_playersIntegerXCurrent number of player type entities in play.
current_branchStringXName of the current level branch.
current_levelIntegerXLevel index of the current set.
current_paletteIntegerXIndex of the current global palette in use. See level palettes for details on this feature.
current_sceneStringXFile name of current scene.
current_setIntegerXIndex of the current set.
current_stageIntegerXCurrent stage within a level.
effectvolIntegerXCurrent menu setting for sound effect volume.
elapsed_timeIntegerGlobal chronograph OpenBOR uses to track timing for virtually every engine operation. Note that is it not a perfect representation of real world time. Rather, the timer is a counter incremented on each engine update (~200 per second depending on hardware and conditions). Also note the timer is reset by certain events, such as a new level starting.
ent_maxIntegerXMaximum number of entities allowed in play.
fpsIntegerXCurrent engine update rate. Under optimal conditions, OpenBOR runs at 200FPS. ~60FPS is required for smooth game play.
freeramIntegerXAvailable memory. As a 32bit application OpenBOR can “see” ~2GB of RAM according to the limits of your hardware and operating system.
front_panel_zIntegerXDefault position of front panel layer. Internally, it is a calculated offset from player_max_z.
game_paused0 = Unpaused
1 = Paused.
game_speed
game_time
gfx_x_offset
gfx_y_offset
gfx_y_offset_adj
global_configPointerXPointer to the global configuration structure. See Global Config below.
hresolutionHorizontal screen size.
hole_zIntegerXBase layer position of Hole graphic. Internally, it is a calculated offset from player_min_z.
hud_common_loadPointerXPointer to Dial properties for loading HUD.
hud_common_mainPointerXPointer to Dial properties for default HUD.
hud_common_mpPointerXPointer to Dial properties for HUD mp display.
hud_common_opponentPointerXPointer to Dial properties for HUD opponent display.
hud_zIntegerXBase layer position of the heads up display (player/enemy life, score, etc.) . Internally, it is a calculated offset from player_max_z.
in_cheat_optionsLegacy. Use screen_status instead.
in_control_optionsLegacy. Use screen_status instead.
in_enginecreditsscreenLegacy. Use screen_status instead.
in_gameoverscreenLegacy. Use screen_status instead.
in_halloffamescreenLegacy. Use screen_status instead.
in_level
in_load_gameLegacy. Use screen_status instead.
in_menuscreenLegacy. Use screen_status instead.
in_new_gameLegacy. Use screen_status instead.
in_optionsLegacy. Use screen_status instead.
in_selectscreenLegacy. Use screen_status instead.
in_showcompleteLegacy. Use screen_status instead.
in_sound_optionsLegacy. Use screen_status instead.
in_start_gameLegacy. Use screen_status instead.
in_system_optionsLegacy. Use screen_status instead.
in_titlescreenLegacy. Use screen_status instead.
in_video_optionsLegacy. Use screen_status instead.
lasthitaLegacy. See lasthity.
lasthitcLast hit confirm. Set true when engine detects a collision, then checked immediately before the hit reaction logic. You can set this to false during a doattack script to cancel a hit as if it never happened.
lasthittElapsed time when last hit occurred.
lasthitxX position (horizontal intersection between attack and body box) of last hit.
lasthityY position (vertical intersection between attack and body box) of last hit.
lasthitzZ position (lateral intersection between attack and body box) of last hit.
levelheight
levelpos
levelwidth
lightx
lightz
max_wall_heightIntegerHighest wall entity may spawn on top of. Default = 1000.
maxanimationsIntegerX
maxattacktypesIntegerX
maxentityvarsIntegerX
maxglobalvarsIntegerX
maxindexedvarsIntegerX
maxplayersIntegerX
maxscriptvarsIntegerX
maxsoundchannelsIntegerX
mirror_zIntegerXBase layer position of mirror effect panel. Internally, it is a calculated offset from player_min_z.
models_cachedIntegerX
models_loadedIntegerX
musicvolInteger
neon_panel_zIntegerXBase layer position of neon effect panel. Internally, it is a calculated offset from player_min_z.
nofadeout
nogameover
nohof
nojoin
nopause
nosave
noscreenshot
noshowcomplete
numbasemaps
numholes
numlayers
numpalettes
numwalls
pakname
panel_zIntegerXBase layer position of main panel. Internally, it is a calculated offset from player_min_z.
pauseIntegerSee game_paused.
pixelformat
player
player_max_zIntegerHighest allowed point on Z Axis game field for active entities.
player_min_zIntegerLowest allowed point on Z Axis game field for active entities.
player1
player2
player3
player4
porting
sample_play_id
screen_statusIntegerCurrent screen type. Bitwise with following constants. Note that some flags are not updated until reset at title screen:

* openborconstant("IN_SCREEN_BUTTON_CONFIG_MENU") – In player button configuration menu.
* openborconstant("IN_SCREEN_CONTROL_OPTIONS_MENU") – In player control options.
* openborconstant("IN_SCREEN_ENGINE_CREDIT") – Showing engine credits.
* openborconstant("IN_SCREEN_GAME_OVER") – In game over screen.
* openborconstant("IN_SCREEN_GAME_START_MENU") – In any game start menu.
* openborconstant("IN_SCREEN_HALL_OF_FAME") – In Hall of Fame (high score listing).
* openborconstant("IN_SCREEN_LOAD_GAME_MENU") – In load game menu.
* openborconstant("IN_SCREEN_MENU") – In any menu.
* openborconstant("IN_SCREEN_NEW_GAME_MENU") – In new game menu.
* openborconstant("IN_SCREEN_OPTIONS_MENU") – Not in player screen.
* openborconstant("IN_SCREEN_SELECT") – In select player screen.
* openborconstant("IN_SCREEN_SHOW_COMPLETE") – In stage complete screen..
* openborconstant("IN_SCREEN_SOUND_OPTIONS_MENU") – In sound settings menu.
* openborconstant("IN_SCREEN_SYSTEM_OPTIONS_MENU") – In any options menu.
* openborconstant("IN_SCREEN_TITLE") – Title screen.
* openborconstant("IN_SCREEN_VIDEO_OPTIONS_MENU") – Setting video options.
scrollmaxx
scrollmaxz
scrollminx
scrollminz
self
sets_countIntegerXCurrent number of level sets (practice, easy, hard, etc.) loaded.
shadow_zIntegerXBase layer position of shadow graphic. Internally, it is a calculated offset from player_min_z.
shadowalpha
shadowcolor
shadowopacity
skiptoset
slowmotion
slowmotion_duration
smartbomber
soundvol
textbox
ticks
totalram
usedram
viewporth
viewportw
viewportx
viewporty
vresolutionIntegerVertical screen size.
vscreen
waiting
xposIntegerCurrent horizontal scroll position in a level.
yposCurrent vertical scroll position in a level.
NameTypeRead OnlyDescription

Global Config

Global config is an ongoing effort to consolidate some of the unwieldy number of global system variables into a more manageable structure. Global config properties are accessible with the get_global_config_property() and set_global_config_property() functions. You will first need to acquire the global config pointer using openborvariant("global_config").

NameTypeDescription
openborconstant("GLOBAL_CONFIG_PROPERTY_AJSPECIAL")IntegerButton map for activating a player’s breakout special or smartbomb. See ajspecial.
openborconstant("GLOBAL_CONFIG_PROPERTY_BLOCK_RATIO")IntegerModels.txt blockratio.
openborconstant("GLOBAL_CONFIG_PROPERTY_BLOCK_TYPE")IntegerModels.txt mpblock.
openborconstant("GLOBAL_CONFIG_PROPERTY_CHEATS")IntegerCheat menu and active cheat setup. See Cheats.
openborconstant("GLOBAL_CONFIG_PROPERTY_FLASH")IntegerPointer to the global set of flash properties. See Hit Effects.
openborconstant("GLOBAL_CONFIG_PROPERTY_SHOW_GO")IntegerWhen 1, the go arrow is currently displayed.
NameTypeDescription

Related Post