Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
moksha
Novice


Joined: 13 Oct 2002
Posts: 37
Location: United Kingdom

PostPosted: 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
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: 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
Reply with quote
moksha
Novice


Joined: 13 Oct 2002
Posts: 37
Location: United Kingdom

PostPosted: 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
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: 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
Reply with quote
moksha
Novice


Joined: 13 Oct 2002
Posts: 37
Location: United Kingdom

PostPosted: Thu Mar 06, 2003 5:23 pm   
 
Brilliant, works perfectly

Thanks Emit

Moksha
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net