Page 1 of 1

Notes on various bits of random script functionality

Posted: Sat Sep 29, 2007 2:58 am
by Mit
Heres a collection of various recent CVS notes regarding EventScripts on the server since v0.51.0.. (These will be collected and documented further in the world owners manual soon, along with bongz nice lil startup guide)..

-

Code: Select all

PlayerInventory( "ItemName" )

returns the amount of the item the player has in their inventory

Code: Select all

'PlayerSkillLevel( "SkillName" )

returns the level to which the player has learnt the particular skill

- parsing of

Code: Select all

else if ( CONDITION ) { ...
has beed added

-

Code: Select all

Sleep( <TIME> )
command to put delays in an event script. ( <TIME> is the delay in 1/10ths of a second )

Code: Select all

Event( "PlayerLogin",  0 )
%BUILDINGOWNER% to get the name of the building owner during the events script (when applicable)

added array syntax to playervar etc - i.e. you can use $GlobalVar1 or $GlobalVar[1]
(or.. more interestingly... $GlobalVar[$PlayerVar1 + 1] = 0 , for instance)

added

Code: Select all

 Event ( "&command", "<COMMAND>" ) 
called when the player types text beginning with &.. i.e. if the player types &help the event

Code: Select all

Event( "&command", "help" )
would be triggered if present
added

Code: Select all

Rand( NUM )
function - e.g. Rand(5) would return a random value between 1 and 5

Code: Select all

CancelTransaction()
function for event scripts (specifically, atm, for the UseItem event). Including this call means the use 'transaction' is not called (i.e items are not removed from the inventory or have their normal (non-script) effects applied)

- Added various new commands (that can be accessed by script) to the servers. Including..

Code: Select all

*resetallglobalvars
*resetallplayervars
*resetplayervars [NAME]
*setplayervar [NAME] [VARIABLE_NUM] [VALUE]
*setglobalvar [VARIABLE_NUM] [VALUE]

Code: Select all

NumPlayersOnTeam( TeamNum )
' to return the number of players currently online and on the specified team number

- added various global variables for retrieving info about the player, specifically..

Code: Select all

$gPlayerKills
$gPlayerDeaths
$gPlayerTeam
$gPlayerLevel
$gPlayerKudos
$gPlayerFamily
$gPlayerCash
$gPlayerHealth

Posted: Sun Jul 19, 2009 10:43 pm
by Speeddy
i'll use it XD
its tru!