 |
talonnb Apprentice
Joined: 30 Oct 2004 Posts: 127
|
Posted: Mon Jul 24, 2006 10:30 pm
Array Accessing. |
Currently in my system I have:
#If (@stupidity = 1) {eat goldenseal}
#if (@dizziness = 1) {eat goldenseal}
Stuff like that.
I have many variables that could be linked and processed at the same time. I'm wondering if there's a way to do multiple checks on the same variable, like:
GlobalVariable contains all afflictions, the first 10 of which are goldenseal afflictions.
Soooo is there anything like this that would work?
#if (@GlobalVariable.[0-9] = 1) {eat goldenseal} |
|
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Mon Jul 24, 2006 10:39 pm |
#loop 0,9 {#if (@globalvariable.%i = 1) {eat goldenseal}}
probably won't work since the 0 probably won't do anything. 1,10 won't work cause you get the wrong numbers.
Try
#loop 1,10 {#if (@globalvariable.%eval(%i - 1) = 1) {eat goldenseal}}
or
#loop 1,10 {#if (@globalvariable.{%eval(%i - 1)} = 1) {eat goldenseal}} |
|
_________________ Taz :)
Last edited by Taz on Mon Jul 24, 2006 10:44 pm; edited 1 time in total |
|
|
 |
talonnb Apprentice
Joined: 30 Oct 2004 Posts: 127
|
Posted: Mon Jul 24, 2006 10:43 pm |
I'll give it a try once I get the global variable all set up, appreciate the help.
|
|
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Mon Jul 24, 2006 10:51 pm |
Scrub all the extra stuff I put it seems that 0,9 will work perfectly. Oh and note the edit I did to change %1 to %i, very important.
|
|
_________________ Taz :) |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4774 Location: Pensacola, FL, USA
|
Posted: Mon Jul 24, 2006 11:49 pm |
try a case statment with %ismember() for the number, it will return which possition the item is located in the array
|
|
_________________ Discord: Shalimarwildcat |
|
|
 |
|
|
|