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


Joined: 09 Nov 2005
Posts: 3

PostPosted: Tue Jan 17, 2006 1:48 am   

Nested Aliases and #IF Statements and Triggers
 
Ok what I am trying to do is set up a Loop that make an item the number of times I tell it to. The problem is you sometimes fail to make it. But you still get the Pass message right after the Fail message, so the only difference you see on the screen is the Fail messages right before the Pass messages.

Right now Ive got an Aliases to make the poison. It works great. The problem is I have to do my hand each time I want to make it, I would like to just be able to type "makepoison 19" and it try to make it 19 times, and each time it fails put the weapon in my pack, and each time it works put it in my pouch.


Ok this is what I have for the aliases:

Code:

get mortar hole
get feather pack
pu feather mortar
get darkness pack
pu darkness mortar
get flake bag
pu flake mortar
get blood bag
pu blood mortar
hold mortar
get spear pack
poison dragonsbane spear
pu spear dragon
hold @hold

This works fine make and all is good. Here are the Triggers for Pass or Fail
Code:

#TRIG {You failed and spill some on yourself.  Ouch!} {
get spear pouch
pu spear pack}
#TRIG {you failed.}{
get spear pouch
pu spear pack}

You pour the poison over an ivory tipped spear, which glistens wickedly!

The above is the pass message that is right after the failed, and this is the only message if it does pass nothing after this


So I am not sure how to go about this, I first tried a #WHILE statement but all that did was dump the number of times I wanted it run right to the mud so it expanded the aliases that number of times and the fail triggers never had chance to run between each try so the spears got mixed up and I had to go back and move them back and forth myself.
Reply with quote
luggage
Novice


Joined: 20 Jul 2004
Posts: 38
Location: Australia

PostPosted: Tue Jan 17, 2006 9:43 am   
 
Well, one way of doing it would be to create an alarm that triggers on the pass message that does the next poison making in x seconds.
Then you would need to create a variable as a counter as well.

First you would need an alias to start the loop, and set the counter:

Code:
#ALIAS makepoison {
    #VAR poisoncounter %1
    dopoisonweapon}


Then you use an alias to poison the weapon and decrement the counter:

Code:
#ALIAS dopoisonweapon {
   get mortar hole
   get feather pack
   ....
   ....
   hold @hold
   #ADD poisoncounter -1}


Then trigger on a fail..

Code:
#TRIG {You failed and spill some on yourself. Ouch!} {
   get spear pouch
   pu spear pack}
#TRIG {you failed.}{
   get spear pouch
   pu spear pack}


Finally trigger on the pass message which always occurs to re-attempt it if there are counters left with a delay of 2 seconds after receiving the pass message. The delay is to allow you to reposition the spears if you fail, allow for lag, etc. Feel free to change the delay.

Code:
#TRIG {You pour the poison over an ivory tipped spear, which glistens wickedly!} {
   #ALARM poisonalarm +2 {
      #IF (@poisoncounter > 0) {dopoisonweapon}}



This is untested tho. But, taking it further, you can move the #ADD poisoncounter -1 to within the alarm, so you would then attempt it continuously until you poisoned X amount of spears.

Luggage
Reply with quote
pithlit
Newbie


Joined: 09 Nov 2005
Posts: 3

PostPosted: Tue Jan 17, 2006 10:49 am   
 
Thank you very much for the fast responce, I am going to try this out right now.

Ok Thanks it works like a charm, and is a lot simpler then the answer I came up with last night right as I was falling alseep. Never fails, spend an hour trying to figure something out then as soon as you start to fall asleep you get an idea on how to do it....but this way is alot simpler then what I came up with when half-asleep.
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