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
stark62
Wanderer


Joined: 04 Apr 2003
Posts: 94
Location: United Kingdom

PostPosted: Thu Sep 06, 2012 9:44 pm   

#IF multiple times
 
Im trying to get multiple tasks done with one alias so

I am putting conditon and cure in an #if

so if i use alias heal I tried

#if (%ismember( chunder, @healing)) {cast sp3} {}
#if (%ismember( worms, @healing)) {cast sp4} {}
#if (%ismember( plague, @healing)) {drink tonic3} {}
#if (%ismember( vomit, @healing)) {drink potion4} {}
#if (%ismember( cramps, @healing)) {cast sp4} {}
#if (%ismember( bleeding, @healing)) {drink tonic2} {}
#if (%ismember( desperation, @healing)) {drink tonic3} {}

I then have triggers to #delitem when cured eg

#t your worms have vanished thanks to your magic
#delitem healing worms

but it only tends to do one cure even if there are 3 ailments in @
healing. I want it to cast or drink all the spels/tonics for the ailments in @healing - so in theory every time i type heal i cure all the things in @healing
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Sep 06, 2012 10:39 pm   
 
To be honest, I'd do it this way:

Code:
#VAR HealDB {chunder="cast sp3"|worms="cast sp4"|vomit="drink tonic3"|cramps="drink potion4"|cramps="cast sp4"|bleeding="drink tonic2"|desperation="drink tonic3"}
#ALIAS heal {#FOR @healing {#SEND %db(@HealDB, %i)}}


What that will do is loop through your healing variable and cure everything in it. Use your triggers for deleting items, and you should be good to go.
Reply with quote
stark62
Wanderer


Joined: 04 Apr 2003
Posts: 94
Location: United Kingdom

PostPosted: Fri Sep 07, 2012 11:54 am   
 
Awesome - so what would the alias be if I just wanted to take the first on the list from @healing (first time i seen or used a data record which is awesome)

so

heal2 would take first item from @healing and use the cure in HealDB?
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Sep 07, 2012 12:19 pm   
 
%db(@HealDB, %item(@healing, 1)). If you want to remove the first item from healing too, you could use %db(@HealDB, %pop(healing)).
Reply with quote
stark62
Wanderer


Joined: 04 Apr 2003
Posts: 94
Location: United Kingdom

PostPosted: Fri Sep 07, 2012 12:40 pm   
 
thanks
Reply with quote
stark62
Wanderer


Joined: 04 Apr 2003
Posts: 94
Location: United Kingdom

PostPosted: Fri Sep 07, 2012 4:13 pm   
 
sorry cant get it working - I got the Charneus code working to do all items at one go but can not get it to work using Daern for the first item from Healing using commands in HealDB ???? tried it a million ways
Reply with quote
stark62
Wanderer


Joined: 04 Apr 2003
Posts: 94
Location: United Kingdom

PostPosted: Fri Sep 07, 2012 5:14 pm   
 
OK got it working now thanks Embarassed Embarassed
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