|
Stowslee Wanderer
Joined: 20 Apr 2008 Posts: 69 Location: Watervliet, NY
|
Posted: Sat Jul 24, 2010 10:56 am
Checking A String List and Editing Variables |
Been starting to work with strings stored in variables and was hoping to be able to utilize them in setting other variables... might be the hard way of going about it so I am open to other ideas as well.
I currently have a variable @Cache which tracks the number of items I have stored within a specific location.
The ZMud script for it looks like this:
Code: |
bladder slice=253|blue ink=12|bone slice=149|castorite slice=798|cloth=49|eyeball slice=1917|gold ink=8|green ink=118|heart slice=262|iron=8|kidney slice=1147|leather=169|liver slice=1830|lung slice=104|ovary slice=24|pineal slice=135|purple ink=725|red ink=295|rope=7|spleen slice=73|stomach slice=243|sulphurite slice=110|testis slice=1819|tongue slice=341|tumor slice=920|yellow ink=165 |
This is set after using a trigger to collect the data from screen output. What I am trying to do is check the # associated with each item and if it is less then a particular amount (say 1000) then have it set an appropriate variable to true.
If it helps the screen output that I am collecting the information from is:
Code: |
Glancing into the cache, you see:
[ 253] bladder slice [ 12] blue ink [ 149] bone slice
[ 798] castorite slice [ 49] cloth [ 2] cohosh
[1917] eyeball slice [ 8] gold ink [ 118] green ink
[ 262] heart slice [ 8] iron [1147] kidney slice
[ 169] leather [1830] liver slice [ 104] lung slice
[ 24] ovary slice [ 135] pineal slice [ 725] purple ink
[ 295] red ink [ 7] rope [ 73] spleen slice
[ 243] stomach slice [ 110] sulphurite slice [1819] testis slice
[ 341] tongue slice [ 920] tumor slice [ 165] yellow ink
|
For example:
if bladder slice is <= 1000 then @NeedBladder = 1
How would I go about doing this, and is there a simpler way?
Thanks in advance. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sat Jul 24, 2010 3:25 pm |
The easiest way would simply be to loop through your @Cache variable using %loopdb() and checking if value < 1000 #additem NeedsList key.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|