Skip to content

Commit

Permalink
select and either to use Tsplit
Browse files Browse the repository at this point in the history
This allows text processor directives to be nested properly, following a suggestion here:
http://textadventures.co.uk/forum/quest/topic/-o9xg96m6uurrtgkez5mdg/text-processor-again
  • Loading branch information
ThePix authored Jul 18, 2018
1 parent 3279e97 commit dd0bd96
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions WorldModel/WorldModel/Core/CoreOutput.aslx
Original file line number Diff line number Diff line change
Expand Up @@ -267,25 +267,27 @@
</function>

<function name="ProcessTextCommand_Either" parameters="section, data" type="string">
<![CDATA[
command = Mid(section, 8)
colon = Instr(command, ":")
if (colon = 0) {
l = Tsplit(command)
if (ListCount(l) = 1) {
return ("@@@open@@@either " + command + "@@@close@@@")
}

text = Mid(command, colon + 1)
colon2 = Instr(colon + 1, command, "|")
if (colon2 = 0) {
text2 = ""
condition = StringListItem(l, 0)
text = StringListItem(l, 1)
if (ListCount(l) = 2) {
sep = Instr(text, "|")
if (sep = 0) {
text2 = ""
}
else {
text2 = Mid(text, sep + 1)
text = Replace(text, "|" + text2, "")
}
}
else {
text2 = Mid(command, colon2 + 1)
text = Replace(text, "|" + text2, "")
text2 = StringListItem(l, 2)
}
condition = Left(command, colon - 1)
result = eval(condition, ParamsForTextProcessor())

if (result) {
return (ProcessTextSection(text, data))
}
Expand All @@ -297,7 +299,6 @@
return (ProcessTextSection(text2, data))
}
}
]]>
</function>

<function name="ProcessTextCommand_Here" parameters="section, data" type="string">
Expand Down Expand Up @@ -738,7 +739,7 @@

<function name="ProcessTextCommand_Select" parameters="section, data" type="string"><![CDATA[
elements = Mid(section, 8)
elementslist = Split(elements, ":")
elementslist = Tsplit(elements)
objectandatt = StringListItem (elementslist, 0)
list remove (elementslist, objectandatt)
objectandattlist = Split(objectandatt, ".")
Expand Down

0 comments on commit dd0bd96

Please sign in to comment.