 |
Dyron Apprentice
Joined: 08 Apr 2004 Posts: 103 Location: USA
|
Posted: Thu Jan 24, 2008 3:54 am
Variables changing other variables. |
Alright, I have a variable for @item. It could be moss, valerian, cohosh, etc...
I am trying to make a trigger to read that
#if (@item > 0 and @picking = 1) {pick cohosh}
The problem is I want the @item to be judging whatever herb that is in question...
So lets say @item = cohosh
#if (@item(cohosh) > 0 and @picking = 1) {pick cohosh}
Thanks for your help folks! |
|
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu Jan 24, 2008 4:21 am |
It sounds like you want a database variable.
VarName:Herbs
Value
cohosh=12
valerian=1
moss=3
| Code: |
#addkey Herbs cohosh 12
#addkey Herbs valerian 1
#addkey Herbs moss 3 |
VarName:item
Value:cohosh
| Code: |
| #show You want to pick @{Herbs.@item} @item. |
Displays:You want to pick 12 cohosh.
| Code: |
| #if (@{Herbs.@item} > 0 and @picking = 1) {pick @item} |
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Last edited by Arminas on Thu Jan 24, 2008 4:29 am; edited 1 time in total |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4782 Location: Pensacola, FL, USA
|
Posted: Thu Jan 24, 2008 4:24 am |
You could try
#IF (@item and @picking=1) {pick @item}
then its just checking to make sure @item has a non 0 value
Unless I am misunderstanding your intent. |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jan 24, 2008 9:56 am |
I think the idea is that @item would contain the string "cohosh" and @cohosh will contain a number. In that case, you can use @{@item} to access the value of @cohosh. However, I really would advise doing it Arminas' way - it's neater, probably faster, and makes for more readable code.
|
|
|
|
 |
|
|
|