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


Joined: 21 Aug 2002
Posts: 9
Location: USA

PostPosted: Wed Aug 21, 2002 10:09 am   

Multiline Trigger Help.
 
I know I've seen the answer to this somewhere before, I've tried looking through the forums but can't seem to remember where I saw it. This is a bit different, not much though.

Alright, in the mud I play, there is mining, sometimes you mine 2 different ores, sometimes one, sometimes three or more. Most I've ever gotten was 3.

Digging up one ore would be:
You dig up Shale stone (19) and drop it on a stack!

and digging up 2+ would be:
You dig up copper (5) and drop it on a stack!
You dig up Shale stone (19) and drop it on a stack!

and then just keep adding them along. Well every time I see that I want it to "mine down" but I trigger on "You dig".
So my trigger goes off twice, or three times alot of times because of the multiple ores. How can I fix this problem? Thanks to any help received.

Wake me up, I'm dead. Is it something that I said?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Aug 21, 2002 10:22 am   
 
How about just kick off the request with a delay.

#TRIGGER {^You dig} {#ALARM DiggingAlarm +2 {mine down}}

If you dig up 3 then it will reset that alarm 2 more times then 2s later
dig.

Ton Diening
Reply with quote
LEit
Novice


Joined: 27 Jul 2002
Posts: 38
Location: USA

PostPosted: Wed Aug 21, 2002 3:21 pm   
 
That would delay the firing of the 'mine down' commands, but wouldn't prevent multiple firings.

I'm not running zmud now, so there are probably lots of bugs in this but:

#ALIAS mineall {#T+ DigDown; mine down}
#TR "DigDown" {You dig up %* and drop it on a stack!} {#T- DigDown; mine down; #ALARM +1 {T+ DigDown))

That will turn off the trigger for a second after receiving the first "You dig up ..." and then turn it back on, if you can mine in less then a second, well you could try #WAIT.

- LEit
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Aug 21, 2002 8:07 pm   
 
Leit, did you try Ton's script? It delays the mining down, and it also prevents multiple firings. The reason for this is that when the first "You dig" line is received, the alarm is created. The countdown begins immdeiately. However, when the second "You dig" line is received, it doesn't create another alarm, it resets the one already in progress. Thus, the "mine down" command will always be sent two seconds after the last "You dig" line is recived, provided that there is no more than two seconds between receiving any of the lines and the next one.

Kjata
Reply with quote
Varinas
Newbie


Joined: 21 Aug 2002
Posts: 9
Location: USA

PostPosted: Thu Aug 22, 2002 12:49 am   
 
Alright, didn't really work, but this also goes right along with creating a autoroller, rolling stats would look like:

Strength: 17 (Strong)
Dexterity: 10 (Average)
Constitution: 19 (Very fit)
Intelligence: 13 (Smart)
Wisdom: 11 (Average)
Charisma: 9 (Average)
Luck: 11 (Average)

Keep? (Y/N)

and so I need to see how to read it all as one line...

Wake me up, I'm dead. Is it something that I said?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Aug 22, 2002 2:04 am   
 
#TRIGGER {Strength: (%d) ~(*~)$Dexterity: (%d) ~(*~)$Constitution: (%d) ~(*~)$Intelligence: (%d) ~(*~)$Wisdom: (%d) ~(*~)$Charisma: (%d) ~(*~)$Luck: (%d) ~(*~)} {commands}

Kjata
Reply with quote
Varinas
Newbie


Joined: 21 Aug 2002
Posts: 9
Location: USA

PostPosted: Thu Aug 22, 2002 2:13 am   
 
Thats what I was looking for, thanks Kjata, *hail*.

I will now begin working on this, thanks everyone else as well.

Wake me up, I'm dead. Is it something that I said?
Reply with quote
Varinas
Newbie


Joined: 21 Aug 2002
Posts: 9
Location: USA

PostPosted: Thu Aug 22, 2002 2:41 am   
 
#trigger {Strength: (%d) ~(%*~)} {#If (%1 >= 15) {#echo Equal or Bigger} {#echo not bigger!}}
#trigger {Dexterity: (%d) ~(%*~)} {#If (%1 >= 15) {#echo Equal or Bigger} {#echo not bigger!}}
#trigger {Constitution: (%d) ~(%*~)} {#If (%1 >= 15) {#echo Equal or Bigger} {#echo not bigger!}}

That right there is my little basic script, but when Strength is bigger then 15 or equal to, and triggers "Equal or Bigger" then the Dexterity trigger doesn't even work at all, otherwise it works all the time! But con always works as well... what am I doing wrong?

Wake me up, I'm dead. Is it something that I said?
Reply with quote
Varinas
Newbie


Joined: 21 Aug 2002
Posts: 9
Location: USA

PostPosted: Thu Aug 22, 2002 2:43 am   
 
uh hold on, I see that its only doing it when the number is below 10. So if Dexterity is 8, or 9, it never echos. Why does it do that? And how can I fix it?

Wake me up, I'm dead. Is it something that I said?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Aug 22, 2002 7:56 am   
 
You don't need to use %*. It's strongly discouraged unless there's no other way to match a pattern, because it can leave you vulnerable to malicious spoofs.

If you want an autoroller, you should have stuck to Kjata's script. Here's the commands for all values 15 or greater, you can easily change the values if you prefer something different.

#TRIGGER {Strength: (%d) ~(*~)$Dexterity: (%d) ~(*~)$Constitution: (%d) ~(*~)$Intelligence: (%d) ~(*~)$Wisdom: (%d) ~(*~)$Charisma: (%d) ~(*~)$Luck: (%d) ~(*~)} {#IF ((%1 > 14) AND (%2 > 14) AND (%3 > 14) AND (%4 > 14) AND (%5 > 14) AND (%6 > 14) AND (%7 > 14)) {Y} {N}}

If you just want something to do #ECHO's, you should probably include some way to tell them apart:
#TR {Strength: (%d)} {#IF (%1 >= 15) {#ECHO Strength is Equal or Bigger} {#ECHO Strength is not bigger!}}
#TR {Dexterity: (%d)} {#IF (%1 >= 15) {#ECHO Dexterity is Equal or Bigger} {#ECHO Dexterity is not bigger!}}
#TR {Constitution: (%d)} {#IF (%1 >= 15) {#ECHO Constitution is Equal or Bigger} {#ECHO Constitution is not bigger!}}

If Dexterity (or any of the others) triggers only on two-digit values, then the MUD probably has a fixed-width field for the number. If that's the case, then it's probably easiest to use the one-line triggers and make two for each stat. One trigger would have a single space before the (%d) that captures the number, the other trigger would have two spaces before the (%d).

LightBulb
Senior Member
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Aug 22, 2002 11:54 am   
 
Yes, single digits do have an extra space in front of them. I can see that when I try to edit Varinas post.

Anyway, to work around this, you can either do what LightBulb suggested (two triggers for each attribute, one with the space, and one without it) or modify the trigger for each attribute to this:
#TRIGGER {Strength:%s(%d)~(*~)} {#IF (%1 >= 15) {#ECHO Strength is Equal or Bigger} {#ECHO Strength is not bigger!}}
#TRIGGER {Dexterity:%s(%d)~(*~)} {#IF (%1 >= 15) {#ECHO Dexterity is Equal or Bigger} {#ECHO Dexterity is not bigger!}}
etc.

The %s will match any amount of whitespace (in this case, either one or two.)

Kjata
Reply with quote
LEit
Novice


Joined: 27 Jul 2002
Posts: 38
Location: USA

PostPosted: Thu Aug 22, 2002 7:53 pm   
 
quote:

Leit, did you try Ton's script? It delays the mining down, and it also prevents multiple firings. The reason for this is that when the first "You dig" line is received, the alarm is created. The countdown begins immdeiately. However, when the second "You dig" line is received, it doesn't create another alarm, it resets the one already in progress. Thus, the "mine down" command will always be sent two seconds after the last "You dig" line is recived, provided that there is no more than two seconds between receiving any of the lines and the next one.



No, I didn't try it (very bad I know, I'm sorry). Why does the second alarm replace the first? Is it because they are named?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Aug 22, 2002 8:40 pm   
 
Exactly. Because I named the alarm DiggingAlarm, every time you match
the "You dig" it will reset that alarm time to 2 seconds.

#TRIGGER {^You dig} {#ALARM DiggingAlarm +2 {mine down}}

Very useful if you have alarms you want to now and then reset its
time and not create another alarm.



Ton Diening
Reply with quote
Ziah
Novice


Joined: 11 Mar 2005
Posts: 40

PostPosted: Tue Dec 13, 2005 9:47 pm   
 
i play this same mud... its alot more convinient to just set the alarm to like, 0.001 seconds or something... it works with no delay
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