User:Venator: Difference between revisions
From Flexible Survival
Jump to navigationJump to search
String parsing example |
No edit summary |
||
| Line 1: | Line 1: | ||
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. | 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. | ||
<pre> | |||
[if [victor] is male and is not female] | [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 not female]Male on male VM[end if] | ||
| Line 25: | Line 25: | ||
[if [loser] is not male and is not female]Neuter on neuter VM[end if] | [if [loser] is not male and is not female]Neuter on neuter VM[end if] | ||
[end if] | [end if] | ||
</pre> | |||
Revision as of 04:59, 20 November 2011
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]