Other functions:
abs
affect2int
affect2str
appliestype2int
appliestype2str
array_size
atoi
attacktype2int
attacktype2str
checkdt
default_value
get_rand_exit
getpathroom
has_skill_class
has_skill_flag
has_spell_routine
invalid
is_melee_attack
is_spell_damage
is_spell_remote
is_spell_roomspell
is_spell_zonespell
isaff
isarray
ischar
isday
isdefined
isevent
isfightturn
isint
ismob
isnull
isobject
isplayer
isstring
itoa
max
min
objinroom
objtype2str
objwearflag2int
objwearflag2str
playerid
playername
race2int
race2str
random
raw_colors
reversedir
shuffle
skill2int
skill2str
sort
strip_colors
style2int
style2str
time
trigtype2int
trigtype2str
unset
update_supracooling
valid
weather
abs
return absolute value of argument (argument if positive, -argument if negative)
Syntax:
(int) abs(int)
affect2int
convert affect name to integer (FLY => 18)
Syntax:
(int) affect2int(string)
affect2str
convert integer to affect name (18 => FLY)
Syntax:
(string) affect2str(int)
appliestype2int
convert applies type to integer (MAXHIT => 13), see oedit
Syntax:
(int) appliestype2int(string)
appliestype2str
convert integer to applies type (13 => MAXHIT)
Syntax:
(string) appliestype2str(int)
array_size
returns number of elements in array (non-recursive)
Syntax:
(int) array_size(array)
Examples:
let len = array_size(my.arr)
atoi
convert string to integer
Syntax:
(int) atoi(string)
attacktype2int
convert attack type string to integer (whip => 2)
Syntax:
(int) attacktype2int(string)
attacktype2str
convert integer to attack type (2 => whip)
Syntax:
(string) attacktype2str(int)
checkdt
check dt in next room, argument is direction
Syntax:
(char) checkdt(string)
default_value
returns variable value if variable is defined otherwise return default_value
Syntax:
(any) default_value(variable, default_value)
Examples:
say value: @(default_value(my.var, 0)) - says value of my.var or 0 if my.var is not set
let zone.count = default_value(zone.count, 0) + 1
get_rand_exit
returns random exit ("north", "south", ...), argument can be combined (separate by space) from: noground, nowater, noair, nodt, noabyss, noswamp, nochall, noclan, noclosedi, nonstandard, stayzone, nomob, nodoorclosed
when no exit exists returns ""
Syntax:
(string) get_rand_exit(string)
getpathroom
returns first room on the path to target room
Flags can be space-separated list of keywords to override default behavior:
"through_doors" (default to mob's passdoor ability),
"ignore_notrack" (default false)
and "through_secret" (default true). Prefix flag with "no" to reverse,
i.e. "nothrough_secret" to prevent tracking through secret exits.
Syntax:
(string) getpathroom(vnum[, flags])
has_skill_class
Check if skill has given skill class, like "nature", "arcane" or so.
Skill is given as number so attacktype or other automatic variable can
be used directly.
Syntax:
(int) has_skill_class(int, str)
has_skill_flag
Check if skill has given flag, like "negative_buf", "nbenchant" or so.
Skill is given as number so attacktype or other automatic variable can
be used directly.
Syntax:
(int) has_skill_flag(int, str)
has_spell_routine
Check if spell has given routine, like "areaspell", "enchant" or so.
Skill is given as number so attacktype or other automatic variable can
be used directly.
Syntax:
(int) has_spell_routine(int, str)
invalid
return invalid value, useful for making variable invalid, to remove variable use unset
Syntax:
(char) invalid()
is_melee_attack
check if attacktype is melee attack, usable on attacktype (in damage trigger)
Syntax:
(int) is_melee_attack(int)
is_spell_damage
check if spell is direct damage spell, usable on attacktype (in damage trigger) and spellnum in spell trigger
Syntax:
(int) is_spell_damage(int)
is_spell_remote
check if spell is remote, usable on attacktype (in damage trigger) and spellnum in spell trigger
Syntax:
(int) is_spell_remote(int)
is_spell_roomspell
check if spell is roomspell, usable on attacktype (in damage trigger) and spellnum in spell trigger
Syntax:
(int) is_spell_roomspell(int)
is_spell_zonespell
check if spell is zonespell, usable on attacktype (in damage trigger) and spellnum in spell trigger
Syntax:
(int) is_spell_zonespell(int)
isaff
test if variable is affect
Syntax:
(int) isaff(variable)
isarray
test if variable is array
Syntax:
(int) isarray(variable)
ischar
test if variable is player or mob
Syntax:
(int) ischar(variable)
isday
check if is day
Syntax:
(int) isday(any)
isdefined
this function takes any type of argument. Only useful
for testing if variable is defined or not
Syntax:
(int) isdefined(variable)
isevent
return if event is active
Syntax:
(int) isevent()
isfightturn
return 1 if combat round is in progress, 0 otherwise
Syntax:
(int) isfightturn()
Examples:
if (isfightturn("")) say turn
isint
test if variable is integer
Syntax:
(int) isint(variable)
ismob
test if variable is mob
Syntax:
(int) ismob(variable)
isnull
test if variable is null, not defined but exists
Syntax:
(int) isnull(variable)
isobject
test if variable is object
Syntax:
(int) isobject(variable)
isplayer
test if variable is player
Syntax:
(int) isplayer(variable)
isstring
test if variable is string
Syntax:
(int) isstring(variable)
itoa
convert int to string
Syntax:
(string) itoa(int)
max
return maximum of given values, number of parameters can be at most 5
Syntax:
(int) max(int, int, ...)
min
return minimum of given values, number of parameters can be at most 5
Syntax:
(int) min(int, int, ...)
objinroom
number of objects of specified vnum in same room (just on the ground!), if vnum is 0 it returns count of all objects on the ground
Syntax:
(int) objinroom(vnum)
objtype2str
convert integer to object type (1 => LIGHT)
Syntax:
(string) objtype2str(int)
objwearflag2int
convert wearflag string to integer (TAKE => 0), see oedit
Syntax:
(int) objwearflag2int(string)
objwearflag2str
convert wearflag int to string (0 => TAKE)
Syntax:
(string) objwearflag2str(int)
playerid
return player id, -1 when char is mob
return id of player with given name
Syntax:
(any) playerid(char)
(int) playerid(string)
Examples:
say Krystl's Id: @(playerid("krystl"))
playername
return name of player with given id
Syntax:
(string) playername(int)
race2int
convert race name to int (human => 0, tiefling => 18)
Syntax:
(int) race2int(string)
race2str
convert race number to string (0 => human, 19 => tiefling, bad input => "none")
Syntax:
(string) race2str(int)
random
return random number <0-num>
Syntax:
(int) random(num)
raw_colors
Returns a string with color codes displayed.
Syntax:
(string) raw_colors(string str)
reversedir
Get the direction that is reverse to the input
Example: reversedir("north") returns "south"
Returns invalid if the input is invalid
Syntax:
(int) reversedir(string)
shuffle
Return shuffled indexes of the array.
Note: this does NOT actually shuffle the input array, it leaves it untouched but
returns shuffled indexes.
*
Example: ar[0] = "a", ar[1] = "b", ar[2] = "c"
let indexes = shuffle(ar)
Possible result: indexes[0] = 2, indexes[1] = 2, indexes[2] = 0
Access to shuffled data: ar[indexes[0]], ar[indexes[1]], ...
This also works with arrays that are indexed by non-contiguous sequence,
even with arrays indexed by non-numbers.
The return value is an array indexed by numbers from 0 to size-1, with values
being indexes into original array, which may be strings, or really anything
that can be used as index.
Syntax:
(array) shuffle(array)
skill2int
convert skill/spell name to integer (ARMOR => 1), like show skillnum
Syntax:
(int) skill2int(string)
skill2str
convert integer to skill/spell name (1 => ARMOR)
Syntax:
(string) skill2str(int)
sort
upwardly sort array and returns length of index array, it is stable sorting
Note: this does NOT actually sort the input array, it leaves it untouched but
returns sorted indexes in the second argument
Syntax:
(int) sort(array, indexorder)
Examples:
let len = sort(my.arr, indexorder)
for (i=0; i<len; i++) say value: @(my.arr[indexorder[i]])
when my.arr[1]=10, my.arr[2]=3 and my.arr[3]=5 returns value 3 and creates array indexorder with values [2, 3, 1]
strip_colors
Returns a string with color codes removed.
Syntax:
(string) strip_colors(string str)
style2int
convert shaolin/monk style name to integer ("smiling buddha" => 1)
Syntax:
(int) style2int(string)
style2str
convert style number to string (1 => smiling buddha)
Syntax:
(string) style2str(int)
time
return time, arguments: y, m, d, h, w (day of week), s (sunlight), r real time (IRL) in seconds from 1.1.1970, p pulse
Syntax:
(int) time(string)
trigtype2int
convert trigger name to integer ("greet" => 1)
Syntax:
(int) trigtype2int(string)
trigtype2str
convert trigger number to string (1 => greet)
Syntax:
(string) trigtype2str(int)
unset
unsets variable
unsets char's variable
unsets variable
unsets object's variable
Syntax:
(null) unset(variable)
(int) unset(char, string [, index1 [, index2 ...]])
(int) unset(string [, index1 [, index2...]])
(int) unset(obj, string [, index1 [, index2 ...]])
Examples:
unset(zone.name) - unsets zone variable name
unset(zone.name[1]) - unsets zone variable name[1]
unset(zone.name[1][2]) - unsets zone variable name[1][2]
unset(me, "zone.name") - unsets zone variable name
unset(me, "my.name", 1) - unsets mobs variable name[1]
unset(me, "my.name", 1, 2) - unsets mobs variable name[1][2]
unset("zone.name") - unsets zone variable name
unset("my.name", 1) - unsets mobs/object (depend where script runnning) variable name[1]
unset("my.name", 1, 2) - unsets mobs/object (depend where script runnning) variable name[1][2]
unset(me, "zone.name") - unsets zone variable name
unset(me, "my.name", 1) - unsets obj variable name[1]
unset(me, "my.name", 1, 2) - unsets obj variable name[1][2]
update_supracooling
Enable supracooling if not enabled and update charging state
Return "charging" or "discharging" according to new state
Syntax:
(string) update_supracooling()
valid
test if variable is still valid
test if string is valid
return allways 1 when argument is int
test if object is valid
test if affect is valid
test if array is valid
Syntax:
(int) valid(char)
(int) valid(string)
(int) valid(int)
(int) valid(obj)
(int) valid(aff)
(int) valid(array)
Examples:
if (valid(ch)) ...
weather
returns weather in target room, returns one of "cloudless", "cloudy", "rainy", "storm", "unknown"
Syntax:
(string) weather(vnum)