User:Venator

From Flexible Survival
Revision as of 04:59, 20 November 2011 by Venator (talk | contribs) (String parsing example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Just a quick string parsing example. Note that this is a rather inefficient way of setting it up, but it catches all possibilities. It's quite possible to use nested if/otherwise/end ifs for shorter code with less redundancy, but for those new to string parsing this is safer.

[if [victor] is male and is not female]

  [if [loser] is male and is not female]Male on male VM[end if]
  [if [loser] is male and is female]Male on herm VM[end if]
  [if [loser] is female and is not male]Male on female VM[end if]
  [if [loser] is not male and is not female]Male on neuter VM[end if]

[end if] [if [victor] is male and is female]

  [if [loser] is male and is not female]Herm on male VM[end if]
  [if [loser] is male and is female]Herm on herm VM[end if]
  [if [loser] is female and is not male]Herm on female VM[end if]
  [if [loser] is not male and is not female]Herm on neuter VM[end if]

[end if] [if [victor] is female and is not male]

  [if [loser] is male and is not female]Female on male VM[end if]
  [if [loser] is male and is female]Female on herm VM[end if]
  [if [loser] is female and is not male]Female on female VM[end if]
  [if [loser] is not male and is not female]Female on neuter VM[end if]

[end if] [if [victor] is not male and is not female]

  [if [loser] is male and is not female]Neuter on male VM[end if]
  [if [loser] is male and is female]Neuter on herm VM[end if]
  [if [loser] is female and is not male]Neuter on female VM[end if]
  [if [loser] is not male and is not female]Neuter on neuter VM[end if]

[end if]