| View previous topic :: View next topic |
| Author |
Message |
drenesh
Joined: 16 Aug 2007 Posts: 11
|
Posted: Thu Jan 31, 2008 9:18 pm Post subject: Question about variables in lists... |
|
|
I have a list of people that can order me to do stuff via tells...
I have a static list of people, and I want to add in whoever I'm following at the current time... I call the variable $tank... here's the list (names removed to protect the innocent):
| Code: | #VARIABLE {authUsers} { {$tank} {sam} {joe} {Albert} {george} {jordan} {mel} {gracie} {frankie} {wanda} {fishhead}}
|
and here's how its used:
| Code: | #ACTION {%0 tells you: "do %1"} {#list {authUsers} {fnd} {%0} {tmp};#IF {$tmp > 0} {%1} {tell %0 Sorry, you are not authorized.}} {5}
|
but the $tank variable never gets parsed it appears, as the person assigned to the $tank variable can't order me to do anything.
Any ideas? Thanks in advance  |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Fri Feb 01, 2008 4:05 am Post subject: |
|
|
You can't store variables inside variables, you could try the following though:
| Code: |
#ACTION {%0 tells you: "do %1"} {#list {authUsers} {fnd} {%0} {tmp};#IF {$tmp > 0 || "%0" == "$tank"} {%1} {tell %0 Sorry, you are not authorized.}} {5}
|
Another option is reserving the first item of the list for the tank and use: #list authUsers set 1 $tank whenever you switch tanks. |
|
| Back to top |
|
 |
drenesh
Joined: 16 Aug 2007 Posts: 11
|
Posted: Fri Feb 01, 2008 4:22 am Post subject: Thanks :) |
|
|
Thanks for the reply
I hadn't realized that you could use C style "or" switches. Good to know  |
|
| Back to top |
|
 |
|