Difference between revisions of "String Parsing"

From Flexible Survival
Jump to: navigation, search
(Local Stats: - Custom Stats)
(Workarounds or Other Tricks)
 
(87 intermediate revisions by 11 users not shown)
Line 1: Line 1:
<br> String Parsing (SP) 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. While it's a bit limited in power compared to other languages, it's easy to read and learn.  
+
<br> String Parsing (SP) refers to some of the underlying guts of the MUCK. You can use it to liven up your creature submissions, rooms, and even your own description. While it's a bit limited in power compared to other languages, it's easy to read and learn.  
If you're new to programming, it's recommended you use notepad to work in. This lets you save your files localy in case of a disconnect, and avoids weird formatting issues that sometimes pop up in Word. If you're going to be using SP heavily, look for a text editor [http://notepad-plus-plus.org/ Notepad++] (Windows), [http://www.assembla.com/wiki/show/fraise Fraise] (Mac), or VI,eMacs,Etc (Linux).
+
If you're new to programming, it's recommended you use notepad to work in. This lets you save your files locally in case of a disconnect, and avoids weird formatting issues that sometimes pop up in Word. If you're going to be using SP heavily, look for a text editor [http://notepad-plus-plus.org/ Notepad++] and [https://dl.dropbox.com/u/40286482/FS%20string%20parser.zip language file] (Windows) or VI, eMacs, etc (Linux). *link to Fraise for Macs was broken, removed. Please add a good Mac alternative if you have a functioning link*
 +
 
 +
'''STAFF NOTE: This page is maintained largely by the Flexible Survival community. Any information herein may not be relevant to the current standard of String Parsing or reflect its full feature set. Please view the in-game helpfiles on String Parsing for an additional point of reference.'''
 +
 
  
 
== Basic Syntax  ==
 
== Basic Syntax  ==
Line 39: Line 42:
 
:[looker] - Name of the character viewing the description.
 
:[looker] - Name of the character viewing the description.
 
:[loser] - The loser of a fight. (For victory/defeat messages.)
 
:[loser] - The loser of a fight. (For victory/defeat messages.)
:[victor] - The winner of a fight (For Victory/defeat message.)
+
:[victor] - The winner of a fight (For victory/defeat messages.)
:[infected] - Returns target of infection (Creature infection message only. May not be valid still.)
 
  
 
=== Pronouns ===
 
=== Pronouns ===
Line 50: Line 52:
  
 
Available Pronouns
 
Available Pronouns
(Examples are not valid code. They are only demonstrating where
 
 
:%p/%P for possessive pronouns (his/her/its <item>, His/Her/Hir/Its <item>)
 
:%p/%P for possessive pronouns (his/her/its <item>, His/Her/Hir/Its <item>)
::Example: Who's book is it? It's %p book.
+
::Example: Who's book is it? It's [%p of [player]] book.
 
:%a/%A for absolute possessive pronouns (his/hers/hirs/its, His/Hers/Hirs/Its)
 
:%a/%A for absolute possessive pronouns (his/hers/hirs/its, His/Hers/Hirs/Its)
::Example: Who's book is it? It's %a.
+
::Example: Who's book is it? It's [%a of [player]].
 
:%s/%S for subjective pronouns (he/she/shi/it, He/She/Shi/It)
 
:%s/%S for subjective pronouns (he/she/shi/it, He/She/Shi/It)
::Example: %S got the book.
+
::Example: [%S of [player]] got the book.
 
:%o/%O for objective pronouns  (him/her/hir/it, Him/Her/Hir/It)
 
:%o/%O for objective pronouns  (him/her/hir/it, Him/Her/Hir/It)
::Example: The book fell on %o.
+
::Example: The book fell on [%o of [player]].
:%r/%R for reflexive pronouns  (himself/herself/hirself/itself,Himself/Herself/hirself/Itself)
+
:%r/%R for reflexive pronouns  (himself/herself/hirself/itself, Himself/Herself/hirself/Itself)
::Example: Chris did it all by %r.
+
::Example: Chris did it all by [%r of [player]].
:::'''Warning''': Currently (as of 1/10/12) %r is buggy. When used in descriptions, it will cause a linebreak rather than a reflexive pronoun to appear.
+
:%n/%N for the player's name. '''STAFF NOTE: Please use [player] instead.
:%n/%N for the player's name. (Also can just use [''target''] by itself.)
+
::The shopkeeper's name is [%n of [player]].
::The shopkeeper's name is %n .
+
 
 +
=== Flags ===
 +
You can check if the target owns any of the following flags:
 +
:Barbed, Beaked, Candy, Clawed, Feathered, Feral, Flared, Furred, Hooved, Inorganic, Knotted, Latex, Legless, Mouthless, Multiarms, Multiheads, Oviparous, Ovipositor, Pouch, Scaled, Serpentine, Snout, Tailed, Tails, Taur, Udder, Winged
 +
:Example: [if clawed present in [player]] what sharp claws they have[end if]
 +
 
 +
To check those flags in-game, type list flags.
  
 
=== Stats ===
 
=== Stats ===
 
You can use SP to retrieve information about a target using [stat ''stat'' of [''target'']]
 
You can use SP to retrieve information about a target using [stat ''stat'' of [''target'']]
 
:HP - Returns current raw HP.
 
:HP - Returns current raw HP.
 +
 +
<code>[stat rut of [target]]</code> will return the target's rut level. <br>
 +
<code>[stat pregnant of [target]]</code> will return the target's time until birth. <br>
 +
<code>[status fertile of [target]]</code> will return the target's heat status (either 1 or 0)
  
 
=== Local Stats ===
 
=== Local Stats ===
You can create your own custom stats specific to your character, and test for them like any other in your description. @set me=foo:bar, and then use [local stat foo of [player]] in your parsed description.
+
You can create your own custom stats specific to your character, and test for them like any other in your description. '''lset foo=bar''', and then use [local stat foo of [player]] in your parsed description.
  
Please use "custom/<i>mystat</i>" for your custom stats. This will help keep the user config files clean, and prevent accidental overwriting of important variables. If you have a lot of custom stats, consider "custom/<i>mystats</i>/<i>stat1</i>, custom/<i>mystats</i>/<i>stat2</i>" etc.
+
Custom stats of a form can be viewed by typing '''lstats (form here)'''. Mastered forms with local stats can be viewed by typing '''formlist #lstat'''.
  
If you feel like your custom stat may be of use to others, please add it to the list of [[Community Custom Stats]].
+
:Example: lset eyecolor=blue will make '...with piercing [if local stat eyecolor of [player] does exist][local stat eyecolor of [player]][else]defaultcolor[end if] eyes.' read as '...with piercing blue eyes.'
 +
You can also organize your values with lset something/foo=bar.
 +
ALWAYS use "''Form Name/stat''" when submitting monsters with custom stats, like [local stat Female Husky/eyecolor of [player]]. This will help keep the user config files clean and prevent accidental overwriting of a player's other custom stats.
 +
Example of local stats:
 +
:lset piercings/number=three
 +
:lset piercings/type=silver
 +
:lset piercings/side=left
  
:Example: @set me=eyecolor:blue will make '...with piercing [local stat eyecolor of [player]] eyes.' read as '...with piercing blue eyes.'
 
You can also organize your values with @set me=something/foo:bar. Example:
 
:@set me=piercings/number:three
 
:@set me=piercings/type:silver
 
:@set me=piercings/side:left
 
 
"They have [local stat piercings/number of [player]] [local stat piercings/type of [player]] rings in their [local stat piercings/side of [player]] ear." will now read as "They have three silver rings in their left ear."
 
"They have [local stat piercings/number of [player]] [local stat piercings/type of [player]] rings in their [local stat piercings/side of [player]] ear." will now read as "They have three silver rings in their left ear."
  
 
=== Body Parts ===
 
=== Body Parts ===
 
You can retrieve the numerical value of body parts with [stat ''part'' of [''target'']]
 
You can retrieve the numerical value of body parts with [stat ''part'' of [''target'']]
:Breasts - Number of breasts
+
:Breasts -- number of breasts
:Breast Size - Returned as a numerical value (1, 2, 3) ''not'' cup size.
+
:Breast Size -- returned as a numerical value (1, 2, 3) ''not'' cup size.
:Cocks - Number of Cocks
+
:Cocks -- number of cocks
 
:Cock Length
 
:Cock Length
:Cock Width - Ball Size
+
:Ball Size
:Cunts - Number of counts
+
:Cunts -- number of cunts
:Cunt Length - Depth of Cunt
+
:Cunt Length -- depth of cunt
  
 
(Not sure how [[Modest Appearance]] [[Perks|perk]] affects this.)
 
(Not sure how [[Modest Appearance]] [[Perks|perk]] affects this.)
  
 
==== Mutations  ====
 
==== Mutations  ====
Using [stat ''mutation/part'' of [''target''] will retrieve the mutation present in that location.
+
Using [stat ''mutation/part'' of [''target'']] will retrieve the mutation present in that location.
:mutation/skin - returns skin mutation
+
:mutation/skin -- returns skin mutation
:mutation/head - returns head mutation
+
:mutation/head -- returns head mutation
:mutation/arms - returns arms mutation
+
:mutation/arms -- returns arms mutation
:mutation/torso - returns torso mutation
+
:mutation/torso -- returns torso mutation
:mutation/cock - returns groin mutation
+
:mutation/cock -- returns groin mutation
:mutation/legs - returns legs mutation
+
:mutation/legs -- returns legs mutation
  
 
=== Other Values ===
 
=== Other Values ===
 
These values do not need to be proceeded by 'stat'. use "''value'' of [''target'']".
 
These values do not need to be proceeded by 'stat'. use "''value'' of [''target'']".
:hp - shows the percentage of total HP. A target at 50% health will return '50'. (To get raw HP, use '[stat HP of [''target'']') Will return 0 or 100 after mentoring up/down until the next reg 'tick'.
+
:hp -- shows the percentage of total HP. A target at 50% health will return '50'. (To get raw HP, use '[stat HP of [''target'']') Will return 0 or 100 after mentoring up/down until the next reg 'tick'.
:pregnant - returns pregnancy value as 0 or 1 (pregnant).   
+
::When writing forms, use [if [hp of [loser]] > x] in Defeat messages and [if [hp of [victor]] > x] in Victory messages. This allows you to change text according to remaining HP, and, if x = 0, allows you you to create a message that triggers only when submitting.
:[skin] -- returns the primary user's skin, primary user can be tricky at times, safest to use in descs and transformations. (better to use mutation/skin)
+
:pregnant -- returns pregnancy value as 0 or 1 (pregnant).   
:freecred - returns target's freecred balance
+
:[skin] -- returns the primary user's short skin description, primary user can be tricky at times, safest to use in descs and transformations. (better to use mutation/skin)
:level - returns target's true level
+
:freecred -- returns target's freecred balance
:mentor - returns target's mentored level
+
:level -- returns target's true level
 +
:mentor -- returns target's mentored level
 +
:[legs] -- informs the game that legs are being accounted for in this description (such as in a tauric ass infection), and omits the normal legs from the automatic description.
 +
:[breastdesc] -- informs the game that you are describing the breasts in this description, and subsequently omits the "He/she has X Y-sized breasts" part of the automatic description.
  
 
=== Flags ===
 
=== Flags ===
  
 
You can check for certain features in a target using [[flags]].
 
You can check for certain features in a target using [[flags]].
[if ''flag'' is present in [''target'']]You have something that's ''flag''.[end if]
+
[if (flag) present in [target]]You have something that's (flag).[end if]
 
For a list of available flags to check for, see the [[flags|flag list]].
 
For a list of available flags to check for, see the [[flags|flag list]].
 +
 +
=== Workarounds or Other Tricks ===
 +
 +
These are some workarounds to use for interesting or unique parsing situations.
 +
:Because [if [target] is [player]] has been deprecated, a known workaround is using an evaluation that checks for: [if stat month of [player]>0] since only player entities have that stat.
  
 
== Functions ==
 
== Functions ==
Line 123: Line 143:
  
 
=== Tests ===
 
=== Tests ===
:If-Then tests are formatted as [if X]item 1[otherwise]item 2[end if].
+
:If-Then tests are formatted as [if X]string 1[else]string 2[end if].
::You do not need to include [otherwise] but you must finish with [end if]
+
::You do not need to include [else], but you must finish with [end if].
::To test multiple items in one check use [if a and b and c], Not [if a and if b and if c]
+
::To test multiple items in one check use [if a and b and c].
 
::You can nest if-thens, but remember your [end if]s.
 
::You can nest if-thens, but remember your [end if]s.
 
:Comparisons
 
:Comparisons
 
::[if X is Y] or [if X is not Y]
 
::[if X is Y] or [if X is not Y]
::[if stat (stat name) of (person name) = (number)]
+
::[if stat (stat name) of [target] = (string)]
::[if stat (stat name) of (person name) > (number)]
+
::[if stat (stat name) of [target] == (number)]
::[if stat (stat name) of (person name) < (number)] -- Do stat comparisons!
+
::[if stat (stat name) of [target] > (number)]
:test for a power [if POWER NAME is owned by TARGET]
+
::[if stat (stat name) of [target] < (number)] -- Do stat comparisons!
:Test gender
+
:[if (power name) owned by [target]] -- Test for a power.
::[if TARGET is male] - Does TARGET have a cock?
+
:Test sex
::[if TARGET is female] - Does TARGET have a pussy?
+
::[if [target] is male] -- Does [target] have a cock?
::[if TARGET is not male] and [if TARGET is not female] - Testing for absence of cock/pussy
+
::[if [target] is female] -- Does [target] have a pussy?
::[if TARGET is neuter] - Is TARGET Neuter (same as above, but shorter)
+
::[if [target] is not male] and [if [target] is not female] -- Testing for absence of cock/pussy.
::[if TARGET is not male and TARGET is not female] - Combining tests. Only a neuter will pass this.
+
::[if [target] is neuter] -- Is [target] neuter?
::[if TARGET is male and TARGET is female] - Combining tests. Only a herm will pass this.
+
::[if [target] is herm] -- Is [target] a herm?
::[if TARGET is herm] - Is TARGET a herm? (same as above, but shorter)
+
:Test gender (accounts for appearance merits before checking sex - use for appearance)
:Test ferility
+
::[if [target] is masculine] -- Does the [target] look male?
::[if TARGET is fertile] - Non-females cannot be fertile and will always fail this test.
+
::[if [target] is feminine] -- Does the [target] look female?
 +
::[if [target] is hermy] -- Does the [target] look hermaphroditic?
 +
::[if [target] is neutral] -- Does the [target] look neuter?
 +
:Test fertility
 +
::[if [target] is fertile] -- Non-females cannot be fertile and will always fail this test.
  
 
=== Randoms ===
 
=== Randoms ===
[one of]X[or]Y[or]Z[at random]. Do NOT nest randoms.
+
[one of]X[or]Y[or]Z[at random]
 +
*Generates one of the specified values at random.
 +
[random X to Y]
 +
*Generates a number between X and Y.
  
 
=== Nesting ===
 
=== Nesting ===
You may nest [if..][end if] tests. Do NOT nest [one of]...[at random] sections.
+
You may nest [if ][end if] and [one of][or][at random] sections.
  
 
:[if [player] is male]I'm a boy[if [player] is female] and a girl[end if]![end if]
 
:[if [player] is male]I'm a boy[if [player] is female] and a girl[end if]![end if]
Do NOT use [else].
 
  
 
== Colors ==
 
== Colors ==
 
You can add color to your text. (Also works with @emit command.)
 
You can add color to your text. (Also works with @emit command.)
:Surround the color name in carets (for example, ^red^), then return to normal with ^normal^
+
:Surround the color name in carets (for example, ^red^), then return to normal with ^normal^. Note that colors are escaped on a per-line basis. You should never end a line in ^normal^ after the last character.
:Valid colors: Red, blue, green, cyan, yellow, brown, black, white, gray/grey, possibly others. Use 'colors' command to see full list.
+
:Valid colors: Red, blue, green, cyan, yellow, brown, black, white, gray, possibly others. Use 'colors' command to see full list.
:You can also use ^bold^, ^italics^, ^underline^, and yes, even ^blink^.  
+
:You can also use ^bold^, ^italics^, and ^underline^. ^blink^ appears as normal italics in most clients and is strongly discouraged.
  
 
== Advanced Code ==
 
== Advanced Code ==
Line 164: Line 190:
  
 
Functions
 
Functions
:[increase the (stat) of (person name) by (number)] Modify stats, negative numbers are cool. Whole numbers only.
+
:[increase the (stat) of [target] by (number)] -- Modify stats, negative numbers are cool. Whole numbers only.
:[impregnate (person name) with (person name)] -- Causes a chance for babies. The first is the mother. Both need proper parts.
+
:[impregnate [target1] with [target2]] -- Causes a chance for babies. The first is the mother. Both need proper parts.
 
:[end] -- Used in defeat# and victory# to end the processing in that block if [end] remains after displaying that block.
 
:[end] -- Used in defeat# and victory# to end the processing in that block if [end] remains after displaying that block.
 +
::ONLY use [end] for multi-line Victory/Defeat Messages! These are not necessary unless you require a line break.
  
 
Targets
 
Targets
:[here] -- used to identify the room (not its name, its DB ref)
+
:[here] -- Used to identify the room (not its name, its DB ref).
  
 
== Limits ==
 
== Limits ==
 
String Parsing ''cannot'':
 
String Parsing ''cannot'':
* Compare two variables. (If cocks > cunts)
 
* Test for effects. (DamResist)
 
 
* Test for combat.
 
* Test for combat.
 
* Message other players or provide other output.
 
* Message other players or provide other output.
* Do math. (1 + 2)
 
  
 
== Example Code  ==
 
== Example Code  ==
Line 185: Line 209:
 
You want to say, have a particular name hang about, on the player, so that once they have given in
 
You want to say, have a particular name hang about, on the player, so that once they have given in
  
:[if stat Fox/Name of player = 0]"Oh, have we not met? My name is [one of]Lilly[increase the Fox/Name of player by 1][or]Michelle[increase the Fox/Name of player by 2][or]Jenny[increase the Fox/Name of player by 3][at random], and I am going to fuck you nine ways from tuesday!"[otherwise]"Oh, [player]!" [if stat Fox/Name of player = 1]Lilly[end if][if stat Fox/Name of player = 2]Michelle[end if][if stat Fox/Name of player = 3]Jenny[end if] says, "Its tuesday again!"[end if]
+
:"Oh, [if stat Fox/Name of [player] does exist][player]!" [if stat Fox/Name of [player] == 1]Lilly[else if stat Fox/Name of [player] == 2]Michelle[else if stat Fox/Name of [player] == 3]Jenny[end if] says, "It's Tuesday again[else]have we not met? My name is [one of]Lilly[set the Fox/Name of [player] to 1][or]Michelle[set the Fox/Name of [player] to 2][or]Jenny[set the Fox/Name of [player] to 3][at random], and I am going to fuck you nine ways from Tuesday[end if]!"
  
 +
Note that you MUST use 'formstat/Monster Name/statname' if you set this via a monster. Use [set the formstat/Monster Name/statname of [target] to x] as the write-function syntax and [stat formstat/Monster Name/statname of [target]] as the read-function.
  
 
=== Set player color ===
 
=== Set player color ===
 
by Damaged:
 
by Damaged:
  
:str /Infection/Goo Girl/Skin/Transform:A ripple of tingles rushes through your entire body as you sink towards the ground, then rise again, wobbling along the way. A glance at a hand shows that you can see right through your now [set the Goo Girl/texture of player to [one of]jellied[or]gelatine like[or]translucent[at random]] [set the Goo Girl/color of player to [one of]blue[or]red[or]purple[at random]]
+
Goo Girl skin transform: A ripple of tingles rushes through your entire body as you sink towards the ground, then rise again, wobbling along the way. A glance at a hand shows that you can see right through your now [set the formstat/Goo Girl/texture of player to [one of]jellied[or]gelatine like[or]translucent[at random]] [set the formstat/Goo Girl/color of player to [one of]blue[or]red[or]purple[at random]]
 
 
  
 
== Deprecated Code ==
 
== Deprecated Code ==
Line 198: Line 222:
 
These functions and items do not work anymore, but are listed for legacy purposes.
 
These functions and items do not work anymore, but are listed for legacy purposes.
  
:[infect (person name) with (infection name) at (number)] -- has a (number)% chance of infecting the named person with the named infection.
+
:[infect [target] with (infection name) at (number)] -- once had a (number)% chance of infecting the named person with the named infection. This is now done by default in Defeat scenes.
 +
:[otherwise] -- used to be a synonym for [else], but deprecated due to performance concerns.
 +
:[infected] -- used to be a [target] attribute, similar to [player].
  
 
== Resources ==
 
== Resources ==
[http://web.flexiblesurvival.com/viewtopic.php?f=9&t=218 Damage's Original 'Guides' post]
+
[http://web.flexiblesurvival.com/viewtopic.php?f=9&t=218 Damage's Original 'Guides' post] '''Not up-to-date information.'''
  
[http://web.flexiblesurvival.com/viewtopic.php?f=9&t=221 Help on String Parsing]
+
[http://dl.dropbox.com/u/40286482/FS%20string%20parser.zip Notepad++ contextual plugin, courtesy of Kaytlin]
  
 +
[https://atom.io/packages/language-flexiblesurvival Syntax highlighter] for the [https://atom.io/ atom.io] editor by [[User:Inutt|Inutt]]
  
 
[[Category:Guides]][[Category:Code]]
 
[[Category:Guides]][[Category:Code]]

Latest revision as of 13:18, 18 March 2020


String Parsing (SP) refers to some of the underlying guts of the MUCK. You can use it to liven up your creature submissions, rooms, and even your own description. While it's a bit limited in power compared to other languages, it's easy to read and learn. If you're new to programming, it's recommended you use notepad to work in. This lets you save your files locally in case of a disconnect, and avoids weird formatting issues that sometimes pop up in Word. If you're going to be using SP heavily, look for a text editor Notepad++ and language file (Windows) or VI, eMacs, etc (Linux). *link to Fraise for Macs was broken, removed. Please add a good Mac alternative if you have a functioning link*

STAFF NOTE: This page is maintained largely by the Flexible Survival community. Any information herein may not be relevant to the current standard of String Parsing or reflect its full feature set. Please view the in-game helpfiles on String Parsing for an additional point of reference.


Basic Syntax

Formatting

Everything in SP is contained in brackets []. Though SP is supposedly case insensitive, it's recommended you use only lowercase.

There should be no spaces after the leading bracket or before the trailing bracket.

[like this]
[ not like this ]

Line breaks are bad. Avoid them within brackets, and within [if...][end if] sections.

This is bad.

Hi [player]![if [player] is male]
I'm a
boy![end if]

This is good.

Hi! [player]!
[if [player] is male]I'm a boy![end if]

Variables

SP can retrieve, test, and display certain pieces of information about characters.

Targets

A Target refers to a specific character. Targets must be enclosed in their own set of brackets. A [target] by itself will return the target's name.

Hi [player]!

returns

Hi Nuku!

Valid Targets:

[player] - Name of character the description is on.
[looker] - Name of the character viewing the description.
[loser] - The loser of a fight. (For victory/defeat messages.)
[victor] - The winner of a fight (For victory/defeat messages.)

Pronouns

These will display the correct gender of the pronoun according to the target.

Use:

[pronoun of [target]]
Example: You see an employee badge hanging from [%p of [player]] coat.

Available Pronouns

%p/%P for possessive pronouns (his/her/its <item>, His/Her/Hir/Its <item>)
Example: Who's book is it? It's [%p of [player]] book.
%a/%A for absolute possessive pronouns (his/hers/hirs/its, His/Hers/Hirs/Its)
Example: Who's book is it? It's [%a of [player]].
%s/%S for subjective pronouns (he/she/shi/it, He/She/Shi/It)
Example: [%S of [player]] got the book.
%o/%O for objective pronouns (him/her/hir/it, Him/Her/Hir/It)
Example: The book fell on [%o of [player]].
%r/%R for reflexive pronouns (himself/herself/hirself/itself, Himself/Herself/hirself/Itself)
Example: Chris did it all by [%r of [player]].
%n/%N for the player's name. STAFF NOTE: Please use [player] instead.
The shopkeeper's name is [%n of [player]].

Flags

You can check if the target owns any of the following flags:

Barbed, Beaked, Candy, Clawed, Feathered, Feral, Flared, Furred, Hooved, Inorganic, Knotted, Latex, Legless, Mouthless, Multiarms, Multiheads, Oviparous, Ovipositor, Pouch, Scaled, Serpentine, Snout, Tailed, Tails, Taur, Udder, Winged
Example: [if clawed present in [player]] what sharp claws they have[end if]

To check those flags in-game, type list flags.

Stats

You can use SP to retrieve information about a target using [stat stat of [target]]

HP - Returns current raw HP.

[stat rut of [target]] will return the target's rut level.
[stat pregnant of [target]] will return the target's time until birth.
[status fertile of [target]] will return the target's heat status (either 1 or 0)

Local Stats

You can create your own custom stats specific to your character, and test for them like any other in your description. lset foo=bar, and then use [local stat foo of [player]] in your parsed description.

Custom stats of a form can be viewed by typing lstats (form here). Mastered forms with local stats can be viewed by typing formlist #lstat.

Example: lset eyecolor=blue will make '...with piercing [if local stat eyecolor of [player] does exist][local stat eyecolor of [player]][else]defaultcolor[end if] eyes.' read as '...with piercing blue eyes.'

You can also organize your values with lset something/foo=bar. ALWAYS use "Form Name/stat" when submitting monsters with custom stats, like [local stat Female Husky/eyecolor of [player]]. This will help keep the user config files clean and prevent accidental overwriting of a player's other custom stats. Example of local stats:

lset piercings/number=three
lset piercings/type=silver
lset piercings/side=left

"They have [local stat piercings/number of [player]] [local stat piercings/type of [player]] rings in their [local stat piercings/side of [player]] ear." will now read as "They have three silver rings in their left ear."

Body Parts

You can retrieve the numerical value of body parts with [stat part of [target]]

Breasts -- number of breasts
Breast Size -- returned as a numerical value (1, 2, 3) not cup size.
Cocks -- number of cocks
Cock Length
Ball Size
Cunts -- number of cunts
Cunt Length -- depth of cunt

(Not sure how Modest Appearance perk affects this.)

Mutations

Using [stat mutation/part of [target]] will retrieve the mutation present in that location.

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

Other Values

These values do not need to be proceeded by 'stat'. use "value of [target]".

hp -- shows the percentage of total HP. A target at 50% health will return '50'. (To get raw HP, use '[stat HP of [target]') Will return 0 or 100 after mentoring up/down until the next reg 'tick'.
When writing forms, use [if [hp of [loser]] > x] in Defeat messages and [if [hp of [victor]] > x] in Victory messages. This allows you to change text according to remaining HP, and, if x = 0, allows you you to create a message that triggers only when submitting.
pregnant -- returns pregnancy value as 0 or 1 (pregnant).
[skin] -- returns the primary user's short skin description, primary user can be tricky at times, safest to use in descs and transformations. (better to use mutation/skin)
freecred -- returns target's freecred balance
level -- returns target's true level
mentor -- returns target's mentored level
[legs] -- informs the game that legs are being accounted for in this description (such as in a tauric ass infection), and omits the normal legs from the automatic description.
[breastdesc] -- informs the game that you are describing the breasts in this description, and subsequently omits the "He/she has X Y-sized breasts" part of the automatic description.

Flags

You can check for certain features in a target using flags. [if (flag) present in [target]]You have something that's (flag).[end if] For a list of available flags to check for, see the flag list.

Workarounds or Other Tricks

These are some workarounds to use for interesting or unique parsing situations.

Because [if [target] is [player]] has been deprecated, a known workaround is using an evaluation that checks for: [if stat month of [player]>0] since only player entities have that stat.

Functions

SP provides a few simple functions for data processing.

Tests

If-Then tests are formatted as [if X]string 1[else]string 2[end if].
You do not need to include [else], but you must finish with [end if].
To test multiple items in one check use [if a and b and c].
You can nest if-thens, but remember your [end if]s.
Comparisons
[if X is Y] or [if X is not Y]
[if stat (stat name) of [target] = (string)]
[if stat (stat name) of [target] == (number)]
[if stat (stat name) of [target] > (number)]
[if stat (stat name) of [target] < (number)] -- Do stat comparisons!
[if (power name) owned by [target]] -- Test for a power.
Test sex
[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 neuter] -- Is [target] neuter?
[if [target] is herm] -- Is [target] a herm?
Test gender (accounts for appearance merits before checking sex - use for appearance)
[if [target] is masculine] -- Does the [target] look male?
[if [target] is feminine] -- Does the [target] look female?
[if [target] is hermy] -- Does the [target] look hermaphroditic?
[if [target] is neutral] -- Does the [target] look neuter?
Test fertility
[if [target] is fertile] -- Non-females cannot be fertile and will always fail this test.

Randoms

[one of]X[or]Y[or]Z[at random]

  • Generates one of the specified values at random.

[random X to Y]

  • Generates a number between X and Y.

Nesting

You may nest [if ][end if] and [one of][or][at random] sections.

[if [player] is male]I'm a boy[if [player] is female] and a girl[end if]![end if]

Colors

You can add color to your text. (Also works with @emit command.)

Surround the color name in carets (for example, ^red^), then return to normal with ^normal^. Note that colors are escaped on a per-line basis. You should never end a line in ^normal^ after the last character.
Valid colors: Red, blue, green, cyan, yellow, brown, black, white, gray, possibly others. Use 'colors' command to see full list.
You can also use ^bold^, ^italics^, and ^underline^. ^blink^ appears as normal italics in most clients and is strongly discouraged.

Advanced Code

These will not work in personal or room descriptions. Mostly for use in creature creation and other NPC scripts.

Functions

[increase the (stat) of [target] by (number)] -- Modify stats, negative numbers are cool. Whole numbers only.
[impregnate [target1] with [target2]] -- Causes a chance for babies. The first is the mother. Both need proper parts.
[end] -- Used in defeat# and victory# to end the processing in that block if [end] remains after displaying that block.
ONLY use [end] for multi-line Victory/Defeat Messages! These are not necessary unless you require a line break.

Targets

[here] -- Used to identify the room (not its name, its DB ref).

Limits

String Parsing cannot:

  • Test for combat.
  • Message other players or provide other output.

Example Code

NPC Name Tracking

By Damaged: You want to say, have a particular name hang about, on the player, so that once they have given in

"Oh, [if stat Fox/Name of [player] does exist][player]!" [if stat Fox/Name of [player] == 1]Lilly[else if stat Fox/Name of [player] == 2]Michelle[else if stat Fox/Name of [player] == 3]Jenny[end if] says, "It's Tuesday again[else]have we not met? My name is [one of]Lilly[set the Fox/Name of [player] to 1][or]Michelle[set the Fox/Name of [player] to 2][or]Jenny[set the Fox/Name of [player] to 3][at random], and I am going to fuck you nine ways from Tuesday[end if]!"

Note that you MUST use 'formstat/Monster Name/statname' if you set this via a monster. Use [set the formstat/Monster Name/statname of [target] to x] as the write-function syntax and [stat formstat/Monster Name/statname of [target]] as the read-function.

Set player color

by Damaged:

Goo Girl skin transform: A ripple of tingles rushes through your entire body as you sink towards the ground, then rise again, wobbling along the way. A glance at a hand shows that you can see right through your now [set the formstat/Goo Girl/texture of player to [one of]jellied[or]gelatine like[or]translucent[at random]] [set the formstat/Goo Girl/color of player to [one of]blue[or]red[or]purple[at random]]

Deprecated Code

These functions and items do not work anymore, but are listed for legacy purposes.

[infect [target] with (infection name) at (number)] -- once had a (number)% chance of infecting the named person with the named infection. This is now done by default in Defeat scenes.
[otherwise] -- used to be a synonym for [else], but deprecated due to performance concerns.
[infected] -- used to be a [target] attribute, similar to [player].

Resources

Damage's Original 'Guides' post Not up-to-date information.

Notepad++ contextual plugin, courtesy of Kaytlin

Syntax highlighter for the atom.io editor by Inutt