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
blairferrell
Newbie


Joined: 19 Aug 2011
Posts: 7

PostPosted: Tue Oct 11, 2011 8:44 pm   

Help with String lists!
 
So, I'm basically looking to fire off items from a string list, but I don't want my #forall command to fire them all off at once, this is what I'm looking at right now. It works, though I know right now focuswait isnt doing anything useful, I left them there for when I figure it out.

Quote:

#if (@focus=1 and @focuswait=0) {#forall @currentaffs {
#if %pos( %i, @currentaffs) {%i.afflist}
focuswait=1
#alarm +0.1 {focuswait=0}
}}


So, I want this alias to fire off only the first item on said stringlist (Currentaffs) with the appropriate key in AFFLIST. There is a longer route to doing this, but will take years off my life.

The second problem, one I'd solved before and thought I still knew the answer to, is the part of the script {%i.afflist}. I want to fire off the key thats associated with the first thing in currentaffs. So, for example, BLEEDING is the first thing in my currentaffs, and I have a key in AFFLIST that is Key=Bleeding Value="Focus Body". I thought I could just execute them like I have above, but it doesn't work that way.

Any help would be greatly appreciated!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Oct 11, 2011 8:49 pm   
 
Code:
#IF (@focus and !@focuswait) {#SEND %db(@afflist, %pop(@currentaffs));focuswait=1;#ALARM +0.1 {focuswait=0}}


That'll only send the first item in currentaffs, utilizing the afflist database and sending the command you have for it.
Reply with quote
blairferrell
Newbie


Joined: 19 Aug 2011
Posts: 7

PostPosted: Tue Oct 11, 2011 9:09 pm   
 
Doesnt %pop delete the item though? I dont want the item to be deleted until I get the appropriate cure message for it. Any work around the %pop?

I would have done something similar, but the dilemma is when I cure, it may cure something else, or it may be interrupted, so for the item to be deleted before I have the appropriate message would be detrimental to my cause.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Oct 11, 2011 9:14 pm   
 
Just use %item(@currentaffs,1) then.
Reply with quote
blairferrell
Newbie


Joined: 19 Aug 2011
Posts: 7

PostPosted: Tue Oct 11, 2011 9:34 pm   
 
the item thing is useful, except that I need to be able to draw the value from afflist. Any help on that? using a combination of the above and below, replacing pop, I get nothing. It fires, but doesn't find anything for some reason.

I'm basically looking to take the first item from currentaffs and fire off the corresponding value in a separate rec variable.

Edit:

So I've come this far. I think I've got it figured out, I'll post back with the results.


Last edited by blairferrell on Tue Oct 11, 2011 10:20 pm; edited 1 time in total
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Tue Oct 11, 2011 10:14 pm   
 
What Daern means is replace where I have %pop with the %item.
Reply with quote
blairferrell
Newbie


Joined: 19 Aug 2011
Posts: 7

PostPosted: Tue Oct 11, 2011 10:23 pm   
 
So, in case anyone perusing this thread wants to know what I did, it's this.

Quote:


#if (@focus=1 and @focuswait=0) {
#if (@currentaffs!=%null) {
#exec %db( @afflist, %item( @currentaffs, 1))
focuswait=1
#alarm +0.1 {focuswait=0}
}
}



Works fabulously. Thanks guys!
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