The Universal World Resource
The Universal World Resource

Main Menu

World Owner stuff

Player Stuff

Hosted Worlds

Alliances

Lists > Script
Printable | Search

Script Variables and Events

Variables

NameAction
$playervar#a variable that stored per player and don’t get erased from relogs or deaths. there are 64 of these these can have a value from −32768 to 32767
$playertimevar#8 of these vars that can hold much larger numbers
$gservervar#a variable that are stored on the server and can be used in scripts for any players. there are 128 of these.
$gplayerkudosplayers kudos
$gplayerteamteam # of the player using the script
$gplayerfamilyfamily # of the player using the script
$gplayercashplayers cash on hand
$gplayerfuelplayers fuel (0–63)
$gplayerhealthplayers health
$gplayerlevelplayers level
$gservertimethe time of the server, it seems to count by secs but no clue why the number is so large
$gPlayerKillsnumber of kills the player has
$gPlayerDeathsnumber of deaths the player has
$gPlayerVehiclewhat vehicle the player is in
$gPlayerItemCountnumber of items the player has in inventory
$gNearestBuildingthe building record number of the closest building to the player. type *buildetails to find the building record number, its not the bdat number
$gNumPlayersOnlinenumber of players currently on the world
$gPlayerVehiclewhat vehicle the player is in
$gPlayerVehiclewhat vehicle the player is in
$(anything)a variable with any other name. These variables are only created and stored per event and erased when the event stops running

Variable Functions these are used as $variable = function

NameAction
NumPlayersOnTeam(#)returns the number of players on the specified team
IsInSpawnZone(#)returns a 1 if the player is in the specified spawn zone
IsPlayerIDOnline(billing id)returns a 1 if the specified player is online
IsInTown(“name”)returns a 1 if the player is in the boundries of the named town

IF Clauses

NameAction
playerskilllevel (“skill”) = #)see if the player has the specified level of the specified skill
Playerinventory (“item”) = #)see if the player has the specified amount of the specified item

Names

Name (add another % after the name)Action
%playerThis will reference the name of the player that the script is running for
%killerin a player death script, this will reference the name of the player that killed them
%buildingownerplayer that owns the building
  

Events (there is a max of 512 events in your script)

NameAction
(“&Command”, “text”)runs when a player types the specified &command
(“buildingTriggered”, “#”)runs when a player activates the trigger for the specified building. the number represents the building in the buildings file
(“buildingdestroyed”, “#” )runs when a player destroys the specified building. the number represents the building in the buildings file
(“buildingpurchase”, “#” )runs when a player buys the specified building. the number represents the building in the buildings file
(“newbuilding”, “#”)runs when a player builds the specified building. the number represents the building in the buildings file
(“playerdeath”, 0)runs when a player gets killed
(“playerlogin”, 0)runs when a player logs in
(“playerlogout”, 0)runs when a player logs off
(“Useitem”, “name”)runs when a player uses the specified item
(“Enter Region”, “#”)unknown
( “OSDSelect”, “osdname:buttonname” )tells the script to run when the player hits the button with ‘buttonname’ in the osd named ‘osdname’
(“Custom”,”name”)indicates that the script is called to run from a different script
  

Script Commands

NameAction
canceltransaction()used to have a usable item not removed from inventory when the script is run
sleep(#)tells the script to halt for the specified time in tenths of a second
rand(#)picks a random number between 1 and the specified number. add a +# to make the starting number higher
PlayerVars(NAME)tells the script to run for the player specified or represented by the script name
#include “external script”include lines go above all the script events. these allow external ‘sub’ scripts to easily be plugged into the main script file.
CustomEvent( “external script” )this tells a script event to run the specified external script. the specified script must also be listed with a #include.
osdcreate(OSDLIST,”osdname”,”text”)creates a pop up box with the title of ‘text’. ‘osdname’ is used to indicate what event scripts the osd can activate.
osdadditem(OSDBUTTON, “buttonname”, “text”)creates a button with ‘text’ on it. ‘buttonname’ is used to indicate what event script the button activates.
osdadditem(OSDTEXT, “”, “text”)used to create a line of ‘text’ in the box. text lines can be up to 1024 characters long
osdactivate()tells the osd to run
Page last modified on April 18, 2010, at 05:25 AM Edit Page | Page History

 

Powered by PmWiki