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


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Dec 09, 2007 2:28 pm   

complex trigger, needing help
 
Code:
trigger :There * * batch* of (%w) here. -> #var pickpos {%1}
#IF (^There are two batches of %1 here. = true) {
  dis
  pick @pickpos
  poisons
  } {
  #IF (^There is a single batch of %1 here. = true ) {

    dis
    pick @pickpos
    #wait 2000
    poisons
    } {
    dis
    #wait 2000
    pick @pickpos
    #wait 2000
    prep @pickpos
    inp 100 @pickpos
    poisons
    }
  }



other triggers in the same class
Code:

trigger: You cannot find any poisons here. -> plant @pickpos
plant @pickpos
rh
checkpos


Code:

alias: checkpos            spur steed
#wait 1500



Code:
trigger: You are carried elsewhere by a heavy horse. -> calm steed
poisons

-------

It seems to ignore the 1st and the 2nd command of the first trigger. and simply executes the 3rd one.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Dec 09, 2007 2:59 pm   
 
First your use of #WAIT really needs to be changed. #WAIT is horribly bugged. Second the usage in #IF is not correct which is why you are having trouble.
Code:
#TRIGGER {There {is|are} (%w) batch{es|} of (%w) here.$} {
#var pickpos {%2}
#IF (%1="two") {
 dis
 pick @pickpos
 poisons
} {
 #IF (%1="single") {
   dis
   pick @pickpos
   #ALARM "poisons" +2 {poisons}
  } {
   dis
   #ALARM "pick" +2 {pick @pickpos}
   #ALARM "prep" +4 {prep @pickpos;inp 100 @pickpos;poisons}
  }
 }
}
I have no idea why you have a #WAIT in your checkpos alias, but it is up to you to figure out whether it is needed. Also I would suggest that it is better to use other triggers instead of fixed timing like this.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Dec 09, 2007 3:13 pm   
 
Viji's already fixed your pattern, but just for future reference, the star matches any character as many times as it can. This means that the pattern "* *" is wasteful, because "*" on its own will match just as well.

Just noticed a problem with that pattern. You should use this instead:

There {is a|are} (%w) batch{es|} of (%w) here.$
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)

Last edited by Fang Xianfu on Sun Dec 09, 2007 3:24 pm; edited 1 time in total
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Dec 09, 2007 3:17 pm   
 
the #wait command is used to recover balance.
if you try to pick a poison, it will need to wait a while and then you regain equilibrium "Right hand Ready."

thanks for the edited script

EDIT:
There are forty-nine batches of wyg here.

it stops picking if this has a "-"
trying to fix that on my own...
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Dec 09, 2007 3:44 pm   
 
help appreciated...
There are forty-nine batches of wyg here.

it stops picking if this has a "-"
trying to fix that on my own...
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Dec 09, 2007 5:02 pm   
 

There {is a|are} ([%w-]) batch{es|} of (%w) here.$


Read the pattern-matching help file.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Dec 09, 2007 5:54 pm   
 
This is a really old problem from Avalon. There are many people who already have different working versions of this script. I know cause I have written three and seen others. It would likely be easier to ask people for theirs... Sorry, I'm not passing out mine and you may find that is the general answer but It is worth asking people.

This also vaguely resembles a clear-picking script. Highly frowned upon by almost everyone.

If you look around in the forums people have posted about number converting functions to change numbers from their word form to an actual number. From say forty-nine to 49 and then pick or not pick based on the number of an herb or poison in the room.

There {is a|are} (*) batch{es|} of (%w) here.$

Use the number converting function on %1 then pick the %2. Or just compare %2 to a list of poisons/herbs that you are wanting to pick.

#if (@numberConvert(%1)>@pickLimit) {pickNumber=(@pickLimit-@numberConvert(%1))}
Do other stuff...

This script can range from very complex to somewhat simple.

I also suggest you do away with the #wait command in your script and move on to a trigger based approach.

#trigger {Right hand ready.} {check a variable to see what you are picking and how many are left to pick. Are you preparing this time or picking. are you done?}

Avalon has been known to NOT send the Right hand ready line every time, especially in the presence of a power ritual so you may wish to use Vigilante's suggestion of an #alarm trigger instead of waiting on the "Right hand ready." message.

2 seconds isn't ALWAYS the time required to get back your balance sometimes it is slightly less sometimes it is slightly more. I suggest 2.5 seconds if you are going with the alarm over the trigger. Personally I used the Right hand ready in my scripts.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Dec 09, 2007 7:05 pm   
 
Quote:
This also vaguely resembles a clear-picking script. Highly frowned upon by almost everyone.


since you should have noticed, i stop preparing at 2 poisons/herbs left.
then i pick them, and plant them at the end.
for all the 60-2 poisons i prepare and inpouch.


for now i had no trouble with timing balance.
but i will try to implant these trigger into classes sometime.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Dec 10, 2007 2:49 pm   
 
Apologies, as I didn't follow the scripts through completely before posting.

My brain processed that the script would pick everything clean as it was and threw the rest out the window...
Never mind what you were TRYING to accomplish.

Vijilante's example is how that particular IF method should be used. It is so elegant that I just never thought of it.
Though it is clear from his confusion that he's no ranger; he did understand your meaning.

Please disregard my laziness/bone-pigheadednesses...
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Mon Dec 10, 2007 5:52 pm   
 
not sure wether to start a new topic or not, but anyhow, i got another problem. when i tried fighting with some strong guy and i had him pinned i tried spitting shirolos on him.
well, seems like i had a problem with still having another target set and i was issueing the command : spit shirolos at scorp fran, and then order scorp fran drop 10000 gold, which was completely fault.

i decided to make a trigger on this

Code:
#trigger {You spit %w %w %w  at %w (%w).} {
#if (%1 = @target) {#echo target correct} {
  #echo target incorrect
  target = %1
  }
}


now, it won't work.


EDIT: i removed this trigger due to errors posted later


Last edited by illyism on Mon Dec 10, 2007 8:12 pm; edited 1 time in total
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Dec 10, 2007 7:05 pm   
 
Firstly yes you should have started another thread. New problem = new thread.

This makes it easier for people to search the forums for a solution.

Now this although it is a scripting question is more of a logical and in game problem.

If your target were incorrect how is it that you managed to spit in ANYONE's face?
Answer if it were incorrect then you wouldn't have succeeded at all.

So this trigger would not help you. Generally if you have a single @target variable and use it within all of your scripts you won't have a problem with being able to stab/jab someone and not spit at them.

Oh, and you might look into using ucklice and wirren... In case your scripts weren't to blame.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Mon Dec 10, 2007 8:08 pm   
 
Code:
#alias {comp} {
outp shirolos
spit shirolos at %1 @target
inp shirolos
#wait 2000
order %1 @target %2 }


i was typing
Code:
comp scorp drop 1000 gold



so, if i had a target set, it would give
Code:
order scorp 'target' drop 1000 gold

i always use ucklice, iorthir/wirren

now, if i had this trigger to work, i would have typed comp drop 1000 gold, but that is wrong , it would think %1 is drop , and still be wrong, so i think the easy solution would be to remove the %1, and only leave the target.
then i'll be more needing this trigger i posted earlier.

this trigger is then nonsense.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Dec 10, 2007 8:49 pm   
 
Code:
#alias comp {
outp shirolos
spit shirolos at @target
inp shirolos
#wait 2000
order @target %-1}


Then you would type.

comp drop 1000 gold

Again your viewpoint on how to accomplish things is vastly different than what I expected.
Still the trigger for setting your target shouldn't be needed if you use this approach.

Again I'll mention the obligatory mention that this could be better accomplished using an alarm. If only because of the problems #wait can cause in Zmud.

Code:
#ALIAS comp {outp shirolos;spit shirolos at @target;inp shirolos;sOrder=%-1;#T+ sOrderAl}
#VAR Target {Scorp}
#VAR sOrder {}
#ALARM "sOrderAl" {2} {order @target @sOrder;#T- sOrderAl} "" {disable}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Damien2582
Newbie


Joined: 28 Jun 2016
Posts: 1
Location: Flower Mound, Tx

PostPosted: Tue Mar 14, 2017 11:36 am   hahah hey illysm been awhile
 
Hey....thats me...im scorp. funny stuff
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