NiM5: Scripting language helps
Topic: ACT()
Keywords: ACT() OUT()
Syntax:
act(phrase, source, object, target, type);
Similar to the mud's internal routine of the same name, act() is
an output function. Use with caution. Act() codes are special
codes using dollar signs ($$) to denote special characters.
act(phrase, character, object1, object2, act-type);
Act codes and act types:
Types: 0=scene, 1=notvict, 2=vict, 3=char, 4=all
Codes: $$n v p s c t m
$$N V P S C T M
Act codes (addendum):
0-7 colors; R normal text, B bold text, F flashing, I inverse
t or T: target is string, n or N name, e or E he or she, m or M him/her
s or S his/her, i are/is, v or V "" or s (for verb plurality),
w or W "" or "es" (for verb plurality for words ending in s),
x or X "y" or "ies" (for verb plurality ending in y such as carry),
y or Y, used in conjunction with a name, returns "r" or "'s" to show
ownership; for instance $$n$$y may display your or Harold's,
k or K, similar to i, are/is, p or P, returns object name,
d, returns direction.
Lower case refers to "object" or "source", upper case refers to target
or object2.
This function is rather complicated and should be used with caution.
Double-dollar-sign displays a regular dollar sign ($$$$)
Example:
See Also:
Topic: AUTOWAIT()
Keywords: AUTOWAIT()
Syntax:
autowait(#pulses);
Sets the autowait timer to the number of pulses specified.
The autowait timer is a script-based timer that automatically paces
a script by a certain number of pulses, delaying each line.
Example:
See Also: Functions, Functions2, Wait()
Topic: CLOSE()
Keywords: CLOSE()
Syntax:
close(location,direction);
Closes a door.
Example:
close(here(),east);
close(here(),5);
See Also: Open(), Functions
Topic: DATE
Keywords: 'DATE FUNCTIONS' Day() Month() Year() DayofWeek() Moon() Weather()
Syntax:
.
date();
time();
weather();
moon();
dayofweek();
month();
year();
A series of functions which provide access to the values stored in
the game's weather, date and time functions. These are not the
system time, or the user's system time, but rather the game's ongoing
calendar and weather system.
Example:
See Also: Math Functions, Functions, Functions2
Topic: DEATH()
Keywords: DEATH()
Syntax:
Death( target, vnum )
Sets the death vnum of a target.
(Room vnums only)
Example:
death(%aname%, 1) -> when a player dies, he/she reincarnates in limbo
See Also: Home(), Functions
Topic: DISARM()
Keywords: DISARM()
Syntax:
Disarm( target );
Removes all top-layer weapons from a actor.
Example:
See Also:
Topic: DISPENSE()
Keywords: DISPENSE()
Syntax:
dispense(target,vnum);
Dispenses an object to the target.
Example:
dispense(rndplr(here()),11113);
See Also:
Topic: DO()
Keywords: DO()
Syntax:
do( command );
Caller of the script performs a command. Caller must be a actor.
Example:
do({'Hello!});
do(dance);
do(kill fido);
See Also: Functions
Topic: DREAM()
Keywords: DREAM()
Syntax:
dream(text);
The dream() function sends a string of text to any actor who is
asleep in the same area as the caller.
(For objects, in the area it was created.)
Example:
dream({You dream of little wooley lambs jumping over fences.});
See Also: Functions, Functions2
Topic: EAT()
Keywords: EAT()
Syntax:
EAT( target );
The eat() function quietly disposes of an object.
Syntax:
eat(sword);
eat(ticket);
Example:
See Also:
Topic: ELUDE()
Keywords: ELUDE()
Syntax:
elude();
If this function is called by an actor, actor's followers
cease following.
Example:
See Also:
Topic: EVENT()
Keywords: EVENT()
Syntax:
Not yet implemented.
Example:
See Also:
Topic: FORCE()
Keywords: FORCE()
Syntax:
Function acts like a force() command. Usage:
force( <target> <command> );
Example:
See Also:
Topic: FUNCTIONS
Keywords: FUNCTIONS 'SCRIPT FUNCTIONS' FUNCTIONS1
Syntax:
Conditionals, delays and loop functions:
--
goto() if() label() return()
halt() permhalt() wait() autowait()
--
String functions:
--
pre() in() strstr() cat()
word() out() numw() strp()
--
List/stack functions:
--
lshift() rshift() lrem() lrnd()
push() pop() users() each()
foreach() empty() sort()
--
Math/Binary functions:
--
bor() bxor() cmp() not()
or() and() less() greater()
random() band() add() sub()
mult() div() mod()
--
Game functions:
--
self() do() ms() os()
samescene() e() move() eat()
open() close() heal() dispense()
death() home() here() moveall()
time() day() month() year()
dayofweek() weather() moon() players()
bounty() setbounty() recho()
purge() elude() force()
strip() disarm() pay() pos()
rnddir() dream()
To get help on a particular function, type 'HELP FUNCTION()'
Example:
See Also: Functions2, Math Functions, Scripts
Topic: FUNCTIONS2
Keywords: FUNCTIONS2 FUNCTIONS_2 'FUNCTIONS 2'
Syntax:
Newly added game functions:
mana(); event(); mix(); reagents();
dispense(); skill(); alert(); tname();
dig(); undig(); rnddir(); rtitle();
reverb(); emit(); transform(); getdir();
rndplr(); bomb(); spawn(); pay();
level(); setskill(); queue(); props();
commands(); act();
Example:
See Also:
Topic: GOTO()
Keywords: GOTO()
Syntax:
GOTO( label );
The function goto() jumps to a label defined with the label() function.
Syntax:
label(start);
do({say Hello!});
wait(1000);
--> goto(start);
To use a goto() function from within an if() conditional, make sure
to use {, } curlie brackets surrounding that call, otherwise, the
code will execute immediately.
Example:
See Also:
Topic: HOME()
Keywords: HOME()
Syntax:
Home( target, vnum )
Sets the home vnum for a player.
Example:
home(%aname%, 500) -> sets a player's home to room vnum 500
See Also: Death()
Topic: IF()
Keywords: IF()
Syntax:
IF( expression, iftrue, iffalse );
The if() function acts as a conditional statement.
Syntax:
if( %variable%, {do(stand)}, {goto(start)} );
Example:
See Also:
Topic: IN()
Keywords: IN()
Syntax:
in(a,b);
Similar to str_infix(), returns if string a matches any substring of
string b. Almost identical to strstr(), but lacks case sensitivity.
Example:
in({bbbb},{aaaabbbbcccc}); *returns true
in({xxx},{aaaabbbccc}); *returns false
See Also: Pre(), Cmp(), Strstr(), Functions, Functions2
Topic: JUMP()
Keywords: JUMP()
Syntax:
JUMP( dest );
The jump() function moves the script caller to a destination.
Syntax:
jump(601);
Example:
See Also:
Topic: LABEL()
Keywords: LABEL()
Syntax:
LABEL( name );
The label() function defines a label to jump to with the goto() function.
Syntax:
--> label(start);
do({say Hello!});
wait(1000);
goto(start);
Example:
See Also:
Topic: MACRO-FUNCTIONS
Keywords: 'Macro Functions' MACRO-FUNCTIONS
Syntax:
These functions (which are not yet fully implemented) enable
macro-functions, local or master functions, to be created and
manipulated.
vset(); vget(); vcpy(); return(); halt();
Example:
See Also:
Topic: MANA()
Keywords: MANA()
Syntax:
Mana( target, gain );
Gain, either positive or negative, an amount of mana on the target.
Example:
See Also:
Topic: MATH
Keywords: 'MATH FUNCTIONS' BOR() BXOR() NOT() OR() AND() LESS() GREATER() RANDOM() BAND() ADD() SUB() MULT() DIV() MOD()
Syntax:
.
bor(a,b); binary or
bxor(a,b); binary xor
not(a); inversion
or(a,b); or
and(a,b); and
less(a,b); less than
greater(a,b); greater than
random(a,b); returns a random integer
band(a,b); binary and
add(a,b); addition of a and b
sub(a,b); subtraction of a and b
mult(a,b); multiplication of a and b
div(a,b); division of a by b
mod(a,b); modula of a by b
A series of functions to perform simple arithmetic operations.
Example:
See Also: Functions, Functions2, Scripts
Topic: MOVE()
Keywords: MOVE()
Syntax:
MOVE( target, dest );
The function move() moves a target actor to a destination location.
Syntax:
move(%aname%, 500);
move(me, 500); <-- equivalent to jump(500);
Example:
See Also:
Topic: MOVEALL()
Keywords: MOVEALL()
Syntax:
Moveall( from, to );
This function moves all players from one location to another.
Syntax: Moveall(500,501);
Example:
See Also: Move()
Topic: NUMW()
Keywords: NUMW()
Syntax:
numw(list);
Returns the number of words in a string. Words are defined as strings
delineated by spaces.
Example:
numw({you me them us}); *returns 4
See Also:
Topic: OPEN()
Keywords: OPEN()
Syntax:
open(location,direction);
Opens a door.
Example:
open(here(),rnddir());
open(here(),east);
open(here(),3);
See Also: Close(), Functions, Functions2
Topic: PAY()
Keywords: PAY()
Syntax:
Pay( target, amount );
Tenders money to a target.
Example:
See Also:
Topic: PERMHALT()
Keywords: HALT() PERMHALT()
Syntax:
Permhalt(); Halt(value);
Permhalt(); perminantly halts a script for debugging purposes.
Halt(value) halts a script returning a value.
Example:
halt(10);
permhalt();
See Also: Notify, Functions, Functions2, Scripts
Topic: POS()
Keywords: POS()
Syntax:
POS( target, value );
Sets the position of a actor target.
Example:
See Also:
Topic: PRE()
Keywords: PRE()
Syntax:
Similar to str_prefix(), returns a "true" (>0) value for strings
which match their prefixes.
Example:
pre(abba,abbadabba); *returns true
pre(aabb,xaabb); *returns false (0)
See Also: Cmp(), Functions, Functions2
Topic: PURGE()
Keywords: PURGE()
Syntax:
Function that deletes an object, room or actor.
purge( target );
Example:
See Also:
Topic: RANDOM()
Keywords: RANDOM()
Syntax:
add( a, b )
Function returns a random number in a range from a to b.
Example:
random(0,7) -> returns random number between 0 and 7
random(%astr%,7) -> returns random number in the range %astr% to 7
See Also: Add(), Variables, Functions
Topic: RETURN()
Keywords: RETURN()
Syntax:
return(#value);
Sets the return value for a script. This is to be integrated into
multi-script parser, which is not fully implemented yet.
The idea is that scripts can be stored as functions in a master or
local command list. This provides an on-the-fly creation of functions
or macro-functions to aid the language. Similar to encapsulation,
a feature of polymorphic (object-oriented) languages.
Example:
return(10);
See Also: Functions, Functions2, Macro-Functions
Topic: RNDDIR()
Keywords: RNDDIR()
Syntax:
Rnddir() returns a random direction.
Example:
See Also:
Topic: RTITLE()
Keywords: RTITLE()
Syntax:
syntax: rtitle( room, {newtitle} );
Sets the title of a room in a script.
Example:
See Also:
Topic: SAMEROOM()
Keywords: SAMEROOM() SAMESCENE()
Syntax:
samescene(target);
Function returns 0 or 1 (false or true) if the caller is in the same
scene as the target. May be samescene();
Example:
See Also: Functions, Functions2
Topic: SCRIPTS
Keywords: SCRIPTS
Syntax:
NiM5 includes a proprietary script interpreter. A memory hog, NiM5's
scripts are parsed on the fly.
Example:
See Also: Script Language, Functions, Math Functions, Functions2
Topic: SCRIPT_LANGUAGE
Keywords: 'SCRIPT LANGUAGE' SCRIPTS SCRIPT
Syntax:
The proc/script language is designed to provide somewhat flexible
artificial life routines. NIM scripts are versatile enough to produce
many varied applications including: levers, doors, responsive actors,
scenes that change their description, vaults, automatons, et cetera.
The language is function-based and superior in versatility to previous
versions. Scripts can be written for actors, props and rooms.
See also: FUNCTIONS, VARIABLES, TRIGGERS, EXAMPLES
Note, read "help curlies" for information on syntax of the
interpreter. It helps!
Example:
See Also:
Topic: SELF()
Keywords: SELF()
Syntax:
self();
Function returns the name of the caller.
Example:
%myname% self();
do({'Hello, my name is %myname%.});
See Also: Functions, Functions2
Topic: STRIP()
Keywords: STRIP()
Syntax:
Strip( target );
Removes all of the possessions of an actor.
Example:
See Also:
Topic: STRSTR()
Keywords: STRSTR()
Syntax:
strstr(a,b);
Finds substrings. Case sensitive. Returns a value equal to the
substring's index within the string. 0 (false) means not found.
Example:
See Also: Functions, Functions2, Cmp(), In(), Pre()
Topic: TIME()
Keywords: TIME()
Syntax:
Time( );
Returns the game's hour.
A number from 0-23.
Example:
See Also: Day(), DayOfWeek(), Month(), Weather()
Topic: TRIGGERS
Keywords: TRIGGERS
Syntax:
A script is called by an acting trigger which supplies the proc with needed
information. Triggers are called from a variety of sources denoted below:
Triggers Types Events
COMMAND All When a Command is Typed
EACH_PULSE Actors/Objs Triggered Each Pulse
COMBAT All Each Round
TICK_PULSE All Tick Room = When Reset
BORN All Creation Room = On Startup
GETS Objs When Taken
SAY All Any communications (Not Fully Implemented)
KILLS Actors/Objs Kills
DIES Objs/Room Dies Nearby Actor = Upon Death
ENTER All Someone Enters
MOVES Actors/Room Someone Leaves
LOOKS All Called when looked at.
Example:
See Also: Parameters
Topic: VARIABLES
Keywords: VARIABLES
Syntax:
Variables in NIM scripts are dynamically created when referred to. If
a variable does not already exist in a running script's memory, it is created
with the name given. Variables are parsed in the code as any alphanumeric
string contained within percentage symbols. Variables are either strings,
objects, rooms, actors or numerics. There is no delineation between string
variables and parsed numerics.
Syntax:
%name% = {citizen};
%afoo% = {Hello, %name%};
do({say %afoo%});
See also: POINTERS
Example:
See Also:
Topic: WAIT()
Keywords: WAIT()
Syntax:
wait(#pulses);
Delays / pauses a script for a certain number of pulses.
Pulses are not very long. There are 3 pulses per combat round,
and 4 per update tick, which is about one second.
Example:
do({'I say this immediately.});
wait(10);
do({'I say this after 10 pulses.});
See Also: Autowait(), Functions, Functions2
NiM5: Multi-user gaming software.
Copyright (c) 1992-2004 Herb Gilliland. All Rights reserved.