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


Joined: 08 Aug 2005
Posts: 70

PostPosted: Sun Oct 02, 2005 11:39 am   

Wait
 
Currently i have quite a few looping aliases, which are using wait commands to hold up progression, how would i set it to stop the process until the phrase "you have regained balance" was sent by the MUD?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Oct 02, 2005 2:47 pm   
 
Break all of it apart into seperate chunks and use a trigger for the balance phrase to preform the next portion. Let the mud do the waiting for you. You should never need to use the #WAIT command. If your script is waiting for the mud to do something at any given point then that is where you put that portion into another trigger.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Fergal1982
Wanderer


Joined: 08 Aug 2005
Posts: 70

PostPosted: Sun Oct 02, 2005 3:24 pm   
 
but surely that would mean all these triggers would be firing every time i regained balance?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Oct 02, 2005 4:19 pm   
 
That is what classes, multistate triggers and a few other thing are for. Perhaps you should post the existing script and a run through of the mud output when things go right.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Fergal1982
Wanderer


Joined: 08 Aug 2005
Posts: 70

PostPosted: Sun Oct 02, 2005 5:11 pm   
 
Ok, the alias is:
Code:
#var herbs %1
#loop @herbs {
  gather %2
  inh %2
  #wa 3500
  }
herbs = 0 0


producing the following output when run with %1 set to 2

Code:
You skillfully gather a single batch of laika.
1560/1560h 195/195m 38xp u>
You place a clump of Laika into your herb satchel.
1560/1560h 195/195m 38xp u>
You have recovered balance.
1560/1560h 195/195m 38xp >
You skillfully gather a single batch of laika.
1560/1560h 195/195m 38xp u>
You place a clump of Laika into your herb satchel.
1560/1560h 195/195m 38xp u>
You have recovered balance.
1560/1560h 195/195m 38xp >
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Oct 02, 2005 10:03 pm   
 
#CLASS Harvester
#VARIABLE Herbs {} {}
#VARIABLE HerbTarget {} {}
#ALIAS ga {#IF ((%numparam>1)&(%mod(%numparam,2)=0)) {#LOOP %eval(%numparam/2) {#ADDITEM Herbs {%concat(%param(%eval(%i*2-1))," ",%param(%eval(%i*2)))}};Herbs=%sort(@Herbs,1);#T+ Gathering;HerbTarget=%word(%item(@Herbs,1),2);gather @HerbTarget} {#ECHO "Usage ga number herb (number herb (number herb (etc.)))"};#NOOP}
#TRIGGER "Gathering" {^You skillfully gather a single batch of *{@HerbTarget}*.$} {inh @Herb Target;#FORALL @Herbs {#IF (%pos(@HerbTarget,"%i") {#IF (%word("%i",1)!="1") {#ADDITEM Herbs {%concat(%eval(%word("%i",1)-1)," ",@HerbTarget)}};#DELITEM Herbs {%i}}};#IF (%numitems(@Herbs)) {Herbs=%sort(@Herbs,1);HerbTargert=%word(%item(@Herbs,1),2)} {HerbTarget=""}} "" {disable|case}
#COND {^You have recovered balance.$} {#IF (@HerbTarget) {gather @HerbTarget} {#T- Gathering}} {case}
#CLASS 0

That should suit you. Just use 'ga 7 laika 12 myrhh 3 blah'.
As with all scripts I write here it is untested having been directly typed, and may be missing a closing something or other.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Fergal1982
Wanderer


Joined: 08 Aug 2005
Posts: 70

PostPosted: Mon Oct 03, 2005 7:09 pm   
 
*blink* and i was hoping i could make sense of it and convert it to other alii'.

doesnt seem to work. i can get the herbs to harvest, but it wont put the herb into the satchel. and it seems to go one further than i tell it to.
other than that, it seems to work fine
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Oct 04, 2005 11:48 pm   
 
Can't get it to put herbs into the satchel...This may be caused by the pattern I have here:
^You skillfully gather a single batch of *{@HerbTarget}*.$
I wasn't sure if you included enough information so I surrounded the {@HerbTarget} with asterisks. However the way those are handled might not be the best. You might have to supply another set of data so a proper conversion between actual trigger text and short name text can be done.

Doing a loop once more then desired is often a logic problem. Since all the logic is handled by the trigger with a matching pattern to above, and you are expressing there is a problem in the logic; then I must conclude that the trigger is indeed firing. Simply ignore the previous statement that the pattern might be flawed. On to the logic problem. I can see a spot where my shortcutting could actually cause a problem. I aimed at shrinking the alias and gaining a small amount of speed per loop in the process. The error is somewhat buried. but findable.

I would suggest you take the time to read the help for every function and command in that script, and actually learn what is needed to correct it. I wrote it off the top of my head in about as much time as it takes me to type. That doesn't make me the perfect scripter, it just means that I am good enough to know what I have to look up and how to access it quickly. Yes, I still look at the help reference section nearly everytime I write a script. The scripts I write here are more aimed at pointing you in the directions you need to learn. I always try to respond to a request by having it do more then was asked for; I just think there are so many things in zMud that no one ever noticed, and want to point them out. In any case, the short of it is that my use of %pos isn't entirely logically connected with the removal of that herb from the list. That is the reason for the count going too high. As to the 'inh herb' command not working properly I am stumped, since that is the first thing the trigger does. Personnaly I would aim at grouping them and then doing the 'inh' once, but I realize the extra effort that would take on your particular MUD.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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