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
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Tue Aug 03, 2004 3:43 pm   

healing ailias script help
 
will someone help me script a healing ailias?
there are 2 methods of healing i want to use:
1. potion
2. herb
I always want to use the potion if i can, you can only take a sip once about every 10 seconds or so. when i use it i get this message:
The healing liquid sends a tingle down your spine.
i want a trigger? or something to disable potion drinking within the ailias untill i get the message:
You could take another health or mana potion.
if i try to use the ailias while the potion is disabled i want to fall back on the herb where i get the message:
The fruity taste invigorates you, banishing pain from your mind.
now i want to disable herb eating untill i get the message:
You could take a healing herb again.
if both the potion and herb are disabled it would be nice if the ailias would just not do anything.
this is over my head, so if there are any nice guru's out there who would like to take a stab at this i would appreciate it.
Reply with quote
Loto
Apprentice


Joined: 05 May 2003
Posts: 194

PostPosted: Tue Aug 03, 2004 3:59 pm   
 
This is different then what you said, but I think it would work if there's a message saying you can't sip if you try. Might be spammy though.

#ALIAS heal {sip potion}
#TRIGGER {You can't take another health or mana potion} {eat herb}

I assumed you take potions with sip potion, you would need to change that. I made up a random message for not being able to take potions, if there is one, just replace it with the real one. If there isn't, this won't work. I also assumed eat herb was the command to eat an herb.
_________________
*Llewlyn* makes a strange sound but is suddenly very silent as you place a silver sai in his back!
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Wed Aug 04, 2004 3:25 pm   
 
I have something like that now. If i sip a potion and get the message You must wait before you could take another healing potion I have a trigger to eat the herb. However, I still waste a sip of potion it just does nothing. This can get extremely wastefull, and because I dont have the ability to mix potions can leave me without potions until i find an alchemist. Also you tend to go through more herbs than necessary.
Is there a way to use if statements within zmud.
Perhaps I could use seperate ailises for potion drinking and herb eating, and use them withing a macro? after i sip a potion wouldnt the %null command disable the ailias untill something turned it back on? ive seen script doing something like what i want, but i cant remember how it goes. Embarassed
well im going to mess with it some more, i may get lucky and stumble onto a solution.
I would still appreciate it if someone has a quick answer for this.
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Wed Aug 04, 2004 8:57 pm   
 
I think ive found somewhat of a solution.
I make a variable called @redef, which has a default value of sip @healthpotion.
my healing ailias just executes whatever command is in the variable.
when i get the text for sipping the potion, i have a trigger change the value of @redef to eat herb.
when i get the message that im able to sip the potion again i have a trigger change @redef back to sip @healthpotion.
this is a little wastefull with my herbs because i dont disable herb eating, but these are much easier for me to come by.
the reason i decided not to disable herb eating is there could be timing problems. ie: if i get the message that i could sip potions and then a second later got the message that i could eat herbs the ailias would be hopelessly stuck eating herbs.
someone give me some feedback. is there a better way?
Reply with quote
luggage
Novice


Joined: 20 Jul 2004
Posts: 38
Location: Australia

PostPosted: Thu Aug 05, 2004 11:10 am   
 
Hrm, I would use 2 variables to show whether you have recently eaten herbs or sipped a potion recently. Like:

#VA sipped_potion 0
#VA eaten_herb 0

Then set up 2 triggers so when you get the messages that you can eat or sip again, it changes the appropriate variable. Like:

#TR {You could take another health or mana potion.} {#VA sipped_potion 0}
#TR {You could take a healing herb again.} {#VA eaten_herb 0}

Now comes the main healing alias. In here you first check whether you can sip a potion, else you will eat a herb. If you sip a potion, or eat a herb, you will then change the appropriate variable. What I suggest is to use a case statement, and simply treat the eaten_herb and sipped_potion as two numbers and add them together and the result is what status you are at at the momemt. So...

if sipped_potion = 0, then you can sip again.
if sipped_potion = 1, then you cannot sip for a while.
if eaten_herb = 0, then you can eat a herb again.
if eaten_herb = 2, then you cannot eat for a while.

The reason I use the number 2 for eating herbs, is because I want to add the two numbers together to get a result, and if I use the number 1, if you have a result of 1, you cannot tell whether you can sip or eat..
So the result of adding eaten_herb and sipped_potion would be
0 + 0 = 0 (You can sip and eat)
1 + 0 = 1 (You can only eat a herb)
0 + 2 = 2 (You can only sip a potion)
1 + 2 = 3 (You cannot do anything right now)
Anyway, the heal alias would look like this:

#ALIAS heal {#CASE eaten_herb+sipped_potion+1 {sip potion;#VA sipped_potion 1} {eat herb;#VA eaten_herb 2} {sip potion;#VA sipped_potion 1} {#SHOW Wait! You cannot sip or eat yet!}

You can also do this by using two nested #IF commands, but personally I think a case statement is more flexible, especially if you want to do more things with the script.
Anyway, just double-check that I have put all the punctuaction in the right spot, as I
don't have zmud handy atm to check.

Luggage
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