prev | toc | next
 

3.2 Library Functions

The Argo library, lib-argo, provides a number of functions. Below is a reference of the functions, organized alphabetically.

2-col ( {rng} i -- )
Outputs the top i things on the stack in two unnumbered columns. Top item on the stack will be shown last.

2-col-prop ( s -- )
Displays an unnumbered, two-column list of property names in propdir s. For example, if the @a/skills/ propdir contains the property @a/skills/Swords, one of the items in the list will be `Swords'.

3-col ( {rng} i -- )
Outputs the top i things on the stack in three unnumbered columns. Top item on the stack will be shown last.

3-coln ( {rng} i -- )
Outputs the top i things on the stack in three numbered columns. Top item on the stack will be shown last.

3-col-prop ( s -- )
Displays an unnumbered, three-column list of property names in propdir s. For example, if the @a/skills/ propdir contains the property @a/skills/Swords, one of the items in the list will be `Swords'.

A-An ( s -- s' )
Returns string s, prepended with `a' or `an', as appropriate.

AbbreviateStat ( s -- s' )
Returns the abbreviated form of stat name s. For example, "Dexterity" AbbreviateStat would return "dex".

Abs ( i -- i' )
Returns the absolute value of i.

ActionCheck ( -- )
Notifies and kills process if user (`me') is dead or unconscious.

AddListLine ( s s' -- )
Adds line s' to list s on realm data object (the parent room of realm. Note that this function foobars list line numbering: use it only when order of lines within the list is unimportant.

ApplyArgoMod ( d s i -- )
Modifies d's value for property s by i.

ApplyCombatFatigue ( d -- )
Increments d's fatigue by 1.

Approved? ( -- )
Notifies and kills process if user is not approved.

ArgoCheck ( d -- i )
Returns true if object d is Argo-enabled... that is, if it has an @a/version property.

ArgoPermCheck ( d -- )
Notifies and kills process if d cannot use Argo at all (i.e., is a non-enabled puppet, is a guest, or is suspended).

ArgoVersion ( -- s )
Returns the current version of Argo.

CapAll ( s -- s' )
Returns string s, with all words capitalized. Roman numerals up to X will also be capitalized.

Capitalize ( s -- s' )
Returns string s, with the first character uppercase. If s is a Roman numberal up to X, the whole string will be capitalized.

Charge ( d i -- i )
Charges player d i small coins; returns true if user had enough money. Carried amount can be in either denomination.

CheckCGroom ( -- i )
Returns true if `here' is a character generation room.

CheckCombatInfo ( d -- )
Displays d's combat status (normal and current fatigue, normal and current damage) to d.

CheckDeath ( d -- i )
Checks damage taken by d. If less then twice healthy damage level ('e's not dead yet), return false. If greater than twice healthy damage level, set d `dead', create a dead body in `here', move d to player_start, put an object representing d's carried money in room, put all objects carried by d in room, set Chown_OK and chowned to argo-pobj if configured and owner of lib-argo if not, execute d's will if he has one, tell d he just bit the big one.

CheckFunds ( d i -- i )
Returns true if player d has funds equal to or greater than i small coins. d's carried money can be in either denomination.

CheckIdle ( d -- i )
Returns true if d is an idle player. No activity for a number of seconds greater than the Argo system parameter idle_time constitutes `idle'. If d is not a player, i will be false.

CheckMaxDisads ( i1 -- i2 )
Returns true if user (`me') has enough disadvantage points available to acquire a new disadvantage worth i1 points.

CheckMe ( -- )
Displays event info (readied weapon, current action, etc.) to user.

CheckPerqs ( d s1 s2 -- i )
Returns true if user d satisfies the prerequisites for learning ability s2 from category s1.

CheckWimpOut ( d -- )
Checks to see if user d has reached his or her wimpout level. If so, notifies player and room, and sends d fleeing, through a random exit if one is available, or home if not.

CheckXPs ( d -- )
Checks to see if player d has accumulated enough experience points to get a character point. If so, notifies player and increments available points.

CleanString ( s -- s' )
Returns string s, stripped of punctuation and double spaces.

ClearBank ( d -- )
Cleans out d's bank accounts.

Combat? ( d -- i )
Returns true if d is `combat ok'.

ComCheck ( d -- i )
Returns true if approved player d can use combat commands.

CopyDir ( d1 s1 d2 s2 -- )
Copies d1's propdir s1 to d2's propdir s2. Does not copy subdirectories.

CopyDir-r ( d1 s1 d2 s2 -- )
Copies d1's propdir s1 to d2's propdir s2. Includes subdirectories.

CopyProp ( d1 s1 d2 s2 -- )
Copies d1's property s1 to d2's property s2.

CountUse ( d -- )
Increments object d's Argo usecount. If a maximum number of times the object can be used was defined, and this use equals or exceeds that number, recycle object and notify user.

CreateCreature ( s -- d )
Creates a creature of type s. Returns creature's dbref. Owner will be `me', location will be `here'.

CreateObject ( s -- d )
Creates an object of type s. Returns object's dbref. Owner and location will be `me'.

Credit ( d i -- )
Gives player d money in the amount of i small coins.

DeadCheck ( -- )
Kills process and notifies user if user is dead.

Dice ( i1 i2 i3 -- i4 )
Returns the result of a roll of i1 i2-sided dice with a modifier of i3. For example, 3 6 1 Dice returns the result of 3d6+1.

Disabled? ( -- )
Kills process and notifies user if present Argo command is disabled.

DoDisable ( -- )
Checks staff permission, then disables current command.

DoEnable ( -- )
Checks staff permission, then enables current command.

DoVersion ( -- s )
Displays version number of calling program.

EditList ( d s -- )
Puts user in list editor for list s on d. The editor is the same as lsedit, with intro prompt slightly reformatted for consistency with other Argo output.

Encrypt ( s1 s2 -- s3 )
Encrypts string s2, using s1 as a key. If Encrypt is called with the same key and s3 on the stack, result will be s2. In other words, this function both encrypts and decrypts. Since the encryption routines (borrowed from Revar's code for other programs) can be viewed simply by looking at the code for lib-argo, stored encrypted data should not be regarded as truly secure. The primary security of Argo data is provided by the wiz-only @a/ propdir; data is encrypted simply to keep wizards who are examining a player's properties from seeing something they shouldn't.

EventLoop ( -- )
Starts an event loop for user (`me') if one is not already running.

ExemptCheck ( -- )
Returns true if user is exempt from the post-approval rules for learning abilities (stats cost more; can't lower abilities). User will be exempt if @a/status is "na" (not approved), "exempt", or unset.

ExpressLowestMoney ( i -- s )
Returns a formatted string expressing amount i as a cost, using least possible number of coins. For example, with coin names of `silvers' and `coppers', 420 ExpressLowestMoney would return "4 silvers and 20 coppers"

FindNumProp ( s1 s2 -- s3 )
Returns s2'th property in propdir s1. Returns a null string if unsuccessfull. For example, "@a/skills/" "3" FindNumProp would return the third skill in the @a/skills/ propdir.

FindOther ( s -- d )
A .pmatch-like function that follows rules more suited to Argo's needs (such as when targeting): if user is a wizard, d can be a player anywhere on the MUCK or a puppet in the same room; if user is a non-wiz, d can be any object in current room.

GetBase ( s -- s' )
Returns base stat for ability s. Syntax for s is <category>/<instance>. For example, "skills/lockpicking" GetBase returns "dex". The string "nullstat" will be returned if ability s is not found... this violates the common practice of returning a null string in such situations, but works out will for Argo programs that need to get a base for an ability... the user's level for stat "nullstat", which will always be nothing, can be used as the base for the nonexistent ability... If we get this far in a roll against the ability (we shouldn't), it will simply fail normally. Continuing execution with a null string would usually result in a `Cannot access propdir directly' error.

GetCommandName ( s -- s')
Return current name for default command name s. For example, if the +check command has been renamed to +examine with the +rename command, s' will be "+examine. Keep in mind that s' may include aliases... +examine;+ex, for example. (All Argo programs, including the skeleten programs provided later in this Guide, store the `official' Argo name of the current command in local variable ourCom.)

GetCraftSkill ( d -- s )
Returns d's current craft skill (average of current Dexterity, Intelligence, and Presence, rounded down). Note that returned value is a string: it's ready to use for display, but will need to be converted to an int for calculations.

GetDataObj ( -- d )
Returns the dbref of the object holding data defining the current realm... that is, the realm environment room.

GetDenom ( s1 -- s2 )
Matches s1 against the singular and plural names of the two currency denominations and returns "large_coins" or "small_coins". If denomination cannot be matched, user will be notified and process will killed.

GetEnduranceAdv ( d -- i )
Returns modification to rested fatigue that d would get from any of the Endurance combat advantages.

GetMagResAdv ( d -- i )
Returns the defence bonus d would get against spells from any of the Magic Resistance advantages.

GetModAbility ( d s -- i )
Returns d's ability level for s, modified for carried objects, the effects of spells, etc. Ability string s should be in the form of the propdir holding the level... "@a/stats/str", "@a/skills/concealment", etc. Use either "@a/stats/cra" and "@a/stats/phy" or @a/skills/cra" and "@a/skills/phy" for Craft Skill and Physical Skill.

GetPhysSkill ( d -- s )
Returns d's current physical skill (average of current Strength, Constitution, and Dexterity, rounded down). Note that returned value is a string: it's ready to use for display, but will need to be converted to an int for calculations.

GetPsiResAdv ( d -- i )
Returns the defence bonus d would get against spells from any of the Psionic Resistance advantages.

GetRoomMods ( -- i )
Returns total of all values for the @a/glob_mod property on all objects in the room, except user.

GetScope ( -- s )
Returns name of current security scope (used by asys-security and asys-vehicles, under development).

GetScopeRoom ( -- d )
Returns dbref of environment room for current security scope (used by asys-security and asys-vehicles, under development).

GetToughnessAdv ( d -- i )
Returns modification to healthy damage level that d would get from any of the Toughness combat advantages.

GetTurnLength ( d -- i )
Returns d's effective turn length, in seconds, after adjustments for Dexterity, armor, fencing, and martial arts. In general, it should only be used for effective turn length in combat. In other contexts, use the value of the realm's @a/sysparms/turn_length parameter, modified as needed.

IsScope? ( s -- i )
Returns true if s is the name of a security scope (used by asys-security and asys-vehicles, under development).

KillLoop ( d -- )
Kills the process for d's event loop.

Lin72 ( -- )
Displays a line of 72 dashes.

LPad ( s i -- s' )
Pads a string to i characters, spaces left.

Magic? ( -- i )
Returns true if the magic system is enabled (i.e., the realm's magic parameter is tuned to yes).

MakeDbref ( x -- d )
If x is a string or int, converts x to a dbref, then verifies that x is a valid dbref. If not, user receives an error notice and process is killed.

MatchStat ( s -- s' )
Takes a full stat name, such as 'strength' or 'craft skill', and returns the abbreviated form that is stored by, such as 'str' or 'cra'.

Materials? ( s -- i )
Returns true if user has the materials needed to to perform ability s. The materials set should be specified using the full property name that it is defined under, such as @a/spells/invisibility/materials/".

MoveDir ( d1 s1 d2 s2 -- )
Moves propdir s1 on object d1 to propdir s2 on object d2. Subdirectories are not included.

MoveDir-r ( d1 s1 d2 s2 -- )
Moves propdir s1 on object d1 to propdir s2 on object d2. Subdirectories are included.

MoveProp ( d1 s1 d2 s2 -- )
Moves property s1 on object d1 to property s2 on object d2.

NukeStack ( x -- )
Removes all data from the stack.

Pad ( s i -- s' )
Pads string s to i characters, spaces right.

ParseTimeInt ( i -- s )
Translates number of seconds i into units of time, and returns a string expressing the amount of time using the largest applicable units, dropping remainder. For example, 727772777 ParseTimeInt would return "58 years".

ParseTimeString ( s -- i1 i2 | i )
Converts time string s to number of seconds i1, returning this and i2, a true value indicating success. If unsuccessful, only a single value (0 or false) will be returned. Time strings consist of a number and unit: `1 second', '3 hours', `15 weeks', etc.

Presense Roll ( -- i )
Makes a roll against Presence for current user, returning 1 for success and 0 for failure.

PsiabTell ( s -- )
Displays the results of a psionic ability to the room and target, as appropriate. The substrings "$me", "$target", and "$psiab" are replaced with the appropriate names at runtime. An example, placing ">>  $me focuses $psiab $target." PsiabTell in the function that handles successful use of the MindBlast psiab would cause output like ">> Vega focuses MindBlast on Mistral." and ">> Vega focuses a psiab on Mistral." and ">> Someone focuses a psiab on you." to be output as appropriate (nonpsionic characters don't automatically notice psionics use unless it is directed at them; nonpsionic characters will not usually know which psiab is being used, even when the are notified that psionic activity is taking place).

Psionics? ( -- i )
Returns true if the psionics system is enabled (i.e., the realm's psionics parameter is tuned to yes).

QCheck ( s -- )
Kills process and notifies user with `>> Done.' if s is `.quit', `.end', or a prefix of either.

ReadAbilitySet ( -- s i )
Puts user at a prompt to enter an ability category (such as `stats' or 'advantages'), and ability instance (such as `dex' or `wealth'), and a level (a number). Returns i as true or false indicating success or failure, and an ability set, in the standard format, such as 'stats,dex,12'.

ReadLine ( -- s )
Accepts a line of input from user, like the standard READ primitive, but allows users to speak and pose while the program is waiting for input.

ReadLine ( -- i )
Uses ReadLine to accept input from user. Returns 1 if input is 'yes', 'ye', or 'y'; returns 0 if input is 'no' or 'n'. If input is something other than yes/no, displays a prompt asking for yes/no... in other words, keeps user in a loop until yes/no or an abort string like `.quit' or `.end' is entered.

RecOldActions ( d -- )
Scans the database and recycles all exits linked to d.

Relock ( d -- )
Moves the contents of d's @a/fl and @a/lok properties to _/fl and _/lok, resulting in the object's lock and fail being reset to what they were before they were changed by an Argo action such as +guard.

RemoveCommand ( s -- )
Removes references to command s from the global @a/comm_list/ directory. Should work fine even if command has been +renamed.

RemoveDir ( d s -- )
Removes propdir s from object d, leaving subdirectories in place.

RemoveDir-r ( d s -- )
Removes propdir s, including subdirectories, from object d.

RemoveList ( d s -- )
Removes list s from d. This is essentially a RemoveDir that automatically handles the trailing # octothorpe character and number-of-lines property created by lsedit.

RollMake ( d s -- i )
Makes all rolls necessary in order to determine if player d successfully makes object s, returning 1 for success and 0 for failure. Does not verify presence of tools and materials; does not increment tools' usecount or use up materials: use Tools?, Materials?, UseTools, and UseMaterials for these.

RollXPs ( d -- )
Checks: is d in an IC area with other, non-idle players? If so, makes a roll against the averages of d's Intelligence and Presence. If successful, increments d's @a/avail/xps property by 10, then determines whether @a/avail/xps is greater than 100. If so, reduces @a/avail/xps by 100 and increases @a/avail/main by 1... d now has 1 more character development point. Use this function when IC events — such as critical success with an ability — would give a player a chance to learn from experience.

SetArgoDefaults ( d -- )
Initializes d with default Argo values for abilities, character development points, and (if d is a player) money.

SetWait ( d -- )
Sets d's event system action to "wait" and removes event prop indicating target.

ShowList ( d s -- )
Displays the contents of list s on object d to user.

Sort ( x ... x' i -- x ... x' )
Sorts range on top of stack. Stack items within range can be strings, ints, or dbrefs, but must all be the same type.

SpellNum ( s -- s' )
Converts a number string such as "1" or "5" to its word equivalent, such as "one" or "five". If the number is greatere than 20, it is left unchanged... "99" SpellNum would return "99".

SpellTell ( s -- )
Displays the results of a spell to the room and target, as appropriate. The substrings "$me", "$target", and "$spell" are replaced with the appropriate names at runtime. An example, placing ">>  $me casts $spell $target." SpellTell in the function that handles successful use of the Invisibility spell would cause output like ">> Nim casts Invisibility on Antar." to be displayed to the room.

StaffCheck ( -- i )
Returns true if current user (`me') is a staff member (i.e, either a non-quelled wizard or an on-duty monitor).

TellRoom ( s -- )
Displays s to the everyone and everything in the room... an industrial strength NOTIFY_EXCEPT, as it were, that will make sure that puppets and vehicles get notified too.

TellWait ( -- )
Sets users's action to wait and removes designated target, like SetWait, and notifies user.

TimeSet ( d s -- )
Concatenates @a/commands/ with s, and sets this property on d to the current systime... used to record when d used command s, so that the system can enforce time windows, such as the 3 hour (by default) limit on how often rumor and influence commands can be used.

Tools ( d s -- i )
Returns true if d has the tools needed to use ability s. The tools set should be specified using the full property name that it is defined under, such as @a/skills/lockpicking/tools/".

UnAbbreviateStat ( s -- s' )
Takes an abbreviated stat name, such as `dex' or `cra', and returns its expanded, display form, such as `Dexterity' or `Craft Skill'.

UnSpellNum ( s -- s' )
Converts a `number word', such as "one" or "five", and returns is numerical equivalent, such as "1" or "5". It only works up to "twenty"... number words above this are retuned, unchanged.

Update ( -- )
A generic initialization and cleanup routine. All Argo programs should call Update very early... before interacting with the system further.

VerifyClass ( s -- i )
Returns true if s is a valid class... that is, if there is at least one object defined in the realm database that has class s.

VerifyCombat ( -- )
Verifies that the combat system is enabled and user is `combat ok'. If not, user will be notified as appropriate and proccess will be killed.

VerifyObject ( s -- i )
Returns true if s is the name of an object defined in the realm's database.

VerifyTarget ( d -- i )
Returns true if d may be targeted in combat. This requires that d be a valid dbref, in the same room as the current user (`me'). If a player or puppet, must be `combat ok'. If a player, must be online, and not idle.

VerTell ( s -- )
Notifies current user (`me') with string s, appending user's verification string if one has been set and verification is turned on.

prev | toc | top | next