Wild card in Condition statement

Help and bugs.

Wild card in Condition statement

Postby defwheezer » August 19th, 2011, 12:02 am

Hi,

Is it possible to put a wild card (or some other named variable) in the "value" part of a Condition tag?


Code: Select all
<think>
<set name="choice"><star/></set>
</think>
<condition>
<li name="choice" value="1"> you have chosen apple </li> //works fine
<li name="choice" value="<star index="2"/>"> you have chosen the last star?! </li>  //?
<li name="choice" value="<get name="whatever"/>"> you have chosen <get name="whatever"/>. </li> //?
<li>1.apple 2.orange 3.pear</li>
</condition>


If not, what would be a work around?

-cb
defwheezer
Casual Member
 
Posts: 17
Joined: April 22nd, 2011, 6:18 am

Re: Wild card in Condition statement

Postby GeekCaveCreations » August 19th, 2011, 12:29 am

Hiya, CB! It's about time you posted something. :P

The answer to your question is yes, but the way you have it coded isn't quite correct. To illustrate, I'll use the code you posted:

Code: Select all
    <think>
    <set name="choice1"><star/></set>
    <set name="choice2"><star index="2"/></set>
    </think>
    <condition>
    <li name="choice1" value="1"> you have chosen apple </li>
    <li name="choice2" value="*"> you have chosen the last star?! </li>
    <li name="whatever" value="*"> you have chosen <get name="whatever"/>. </li>
    <li>1.apple 2.orange 3.pear</li>
    </condition>


Bear in mind that this only shows the 'proper' way to write code for certain <condition> tags, and that the code above probably won't work as it sits because it isn't "complete". You would need to check for "unset" values (e.g. if "whatever" was never set), and you may wish to check for other specific values (like the first <li> tag), as well. But this should get you pointed in the right direction.
Comforting the disturbed, and disturbing the comfortable
Chat with Morti
User avatar
GeekCaveCreations
Safe, Reliable Insanity, Since 1961
 
Posts: 1115
Joined: April 18th, 2011, 10:52 pm
Location: Nevada, USA


Return to Bugs and Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron