String Parsing

From Flexible Survival
Revision as of 20:05, 18 May 2011 by Sevenish (talk | contribs)
Jump to: navigation, search


String Parsing refers to some of the underlying guts of the MUD. You can use it to liven up your creature submissions, rooms, and even your own description.

Basic Syntax

String parsing processes only what is in between [brackets]. Keywords and functions should all be in lowercase, though the code is supposedly case sensitive. There should be no spaces after the [leading bracket or before the trailing bracket].

Line breaks are bad. Avoid them when parsing. [Set of parse code]{line break}[Another set of parse code] is fine.

Functions

[value] will return that value.
If-Then tests are formatted as [if X]item 1[otherwise]item 2[end if].
Randoms are [one of]X[or]Y[or]Z[at random]. Do NOT nest randoms.
Comparisons
[if X is Y] or [if X is not Y]
[if stat (stat name) of (person name) = (number)]
[if stat (stat name) of (person name) > (number)]
[if stat (stat name) of (person name) < (number)] -- Do stat comparisons!
test for a power [if POWER NAME is owned by TARGET]
Test gender
[if TARGET is male] - Does TARGET have a cock?
[if TARGET is female] - Does TARGET have a pussy?
[if TARGET is not male] and [if TARGET is not female] - Testing for absence of cock/pussy
[if TARGET is not male and is not female] - Combining tests. Only a neuter will pass this.
[if TARGET is male and is female] - Combining tests. Only a herm will pass this.


Values

victor - returns the name of the winner in a fight (creature desc only)
loser - returns the loser of a fight (creature desc only)
player - returns the container of the description
looker - returns the viewer of a description

Sub-values

mutation/skin - returns skin mutation
mutation/head - returns head mutation
mutation/arms - returns arms mutation
mutation/torso - returns torso mutation
mutation/cock - returns groin mutation
mutation/legs - returns legs mutation

Creature Only Code

[increase the (stat) of (person name) by (number)] Modify stats, negative numbers are cool. Whole numbers only.
[infect (person name) with (infection name) at (number)] -- has a (number)% chance of infecting the named person with the named infection.
[impregnate (person name) with (person name)] -- Causes a chance for babies. The first is the mother. Both need proper parts.

Example Code