Difference between revisions of "String Parsing"
(Think I've got it all now.) |
|||
Line 8: | Line 8: | ||
== Functions == | == Functions == | ||
− | :[ | + | :[variable] will show the value of that variable. |
− | :If-Then tests are formatted as [if X]item 1[otherwise]item 2[end if]. | + | :[stat (stat name) of (person name)] -- Show a stat! |
+ | :If-Then tests are formatted as [if X]item 1[otherwise]item 2[end if]. | ||
+ | ::You do not need to include [otherwise] 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] | ||
+ | ::You can nest if-thens, but remember your [end if]s. | ||
:Randoms are [one of]X[or]Y[or]Z[at random]. Do NOT nest randoms. | :Randoms are [one of]X[or]Y[or]Z[at random]. Do NOT nest randoms. | ||
:Comparisons | :Comparisons | ||
Line 24: | Line 28: | ||
::[if TARGET is male and is female] - Combining tests. Only a herm will pass this. | ::[if TARGET is male and is female] - Combining tests. Only a herm will pass this. | ||
− | + | == Targets == | |
− | == | ||
:<code>victor</code> - returns the name of the winner in a fight (creature desc only) | :<code>victor</code> - returns the name of the winner in a fight (creature desc only) | ||
:<code>loser</code> - returns the loser of a fight (creature desc only) | :<code>loser</code> - returns the loser of a fight (creature desc only) | ||
− | :<code>player</code> - returns the container of the description | + | :<code>player</code> - returns the container(player) of the description |
:<code>looker</code> - returns the viewer of a description | :<code>looker</code> - returns the viewer of a description | ||
+ | :infected - returns target of infection (creature infection message only) | ||
+ | |||
+ | |||
+ | == Stats == | ||
+ | |||
+ | :pregnant - returns pregnancy value. Anything over 0 means pregnant. | ||
+ | [If stat pregnant of loser >0] | ||
+ | :Adventuring Group - returns name of [[Groups|player group]] | ||
+ | :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) | ||
+ | :freecred - returns target's freecred balance | ||
=== Sub-values === | === Sub-values === | ||
Line 41: | Line 54: | ||
== Creature Only Code == | == Creature Only Code == | ||
+ | |||
+ | These will not work in personal or room descriptions. | ||
:[increase the (stat) of (person name) by (number)] Modify stats, negative numbers are cool. Whole numbers only. | :[increase the (stat) of (person name) 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 (person name) with (person name)] -- Causes a chance for babies. The first is the mother. Both need proper parts. | ||
+ | :[set the <variable> of <person> to <value>] - Set a custom value on the target. | ||
+ | :[end] -- Used in defeat# and victory# to end the processing in that block if [end] remains after displaying that block. | ||
+ | :infected - returns target of infection (creature infection message only) | ||
== Example Code == | == 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 | ||
+ | |||
+ | [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] | ||
+ | |||
+ | |||
+ | === Set player color === | ||
+ | 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]] | ||
+ | |||
+ | == Deprecated Code == | ||
+ | |||
+ | :[infect (person name) with (infection name) at (number)] -- has a (number)% chance of infecting the named person with the named infection. | ||
+ | These do not work anymore. | ||
+ | |||
+ | |||
[[Category:Guides]] | [[Category:Guides]] |
Revision as of 17:03, 19 May 2011
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.
Contents
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
- [variable] will show the value of that variable.
- [stat (stat name) of (person name)] -- Show a stat!
- If-Then tests are formatted as [if X]item 1[otherwise]item 2[end if].
- You do not need to include [otherwise] 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]
- You can nest if-thens, but remember your [end if]s.
- 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.
Targets
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(player) of the descriptionlooker
- returns the viewer of a description- infected - returns target of infection (creature infection message only)
Stats
- pregnant - returns pregnancy value. Anything over 0 means pregnant.
[If stat pregnant of loser >0]
- Adventuring Group - returns name of player group
- 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)
- freecred - returns target's freecred balance
Sub-values
mutation/skin
- returns skin mutationmutation/head
- returns head mutationmutation/arms
- returns arms mutationmutation/torso
- returns torso mutationmutation/cock
- returns groin mutationmutation/legs
- returns legs mutation
Creature Only Code
These will not work in personal or room descriptions.
- [increase the (stat) of (person name) 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.
- [set the <variable> of <person> to <value>] - Set a custom value on the target.
- [end] -- Used in defeat# and victory# to end the processing in that block if [end] remains after displaying that block.
- infected - returns target of infection (creature infection message only)
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
[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]
Set player color
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]]
Deprecated Code
- [infect (person name) with (infection name) at (number)] -- has a (number)% chance of infecting the named person with the named infection.
These do not work anymore.