|
moksha Novice
Joined: 13 Oct 2002 Posts: 37 Location: United Kingdom
|
Posted: Thu Mar 06, 2003 2:24 pm
Script help please |
Hi all
I need a bit of help sorting out a script.
What I'm trying to do is run through a list of variables, find the one I want and stop the script. Problem is that there is about 100 variables to be checked and its really slow as its checking all even if the one i want is the first.
#tr {Blah, blah in the (%*).} {name = %1;#if {@item1=""} {item1=@name};#if {@item2=""} {item2=@name};#if {@item3=""} {item3=@name};#if {@item4=""} {item4=@name};....etc}
How would i go about speeding up and/or shortening this?
I hope this is enough information
Thanks in advance
Moksha |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Thu Mar 06, 2003 3:09 pm |
you could at an
#abort 1
statement to each of your condition true statements. There might be other options, also, like string lists or the #case statement, but its hard to tell what exactly you're trying to do.
--------
moon.icebound.net:9000 |
|
|
|
moksha Novice
Joined: 13 Oct 2002 Posts: 37 Location: United Kingdom
|
Posted: Thu Mar 06, 2003 3:33 pm |
Hi Emit, thanks for the swift reply.
What I'm trying to do is locate objects/mobs etc in game and put their locations in the status window for future use. I have an alias which I use to clear the @var I want to locate.
#al {find} {#var %1 = ""; ~find %1}
then I trigger on the response as shown above.
What I want to be able to do is run through the list of variables, find the "" one, fill it with the @name and stop the script.
Mokhsa |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Thu Mar 06, 2003 4:07 pm |
ah! i'm beginning to see.
quote:
#al {find} {#var %1 = ""; ~find %1}
you could save the name of the variable in a different variable
#al {find} {#var %1 "";#var curvar %1;~find %1}
#tr {Blah, blah in the (*)} {#var {@curvar} %1}
putting the curly braces around @curvar in the last statement will force it to be evaluated before the variable is created/value assigned.
--------
moon.icebound.net:9000 |
|
|
|
moksha Novice
Joined: 13 Oct 2002 Posts: 37 Location: United Kingdom
|
Posted: Thu Mar 06, 2003 5:23 pm |
Brilliant, works perfectly
Thanks Emit
Moksha |
|
|
|
|
|