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


Joined: 30 Dec 2002
Posts: 1

PostPosted: Mon Dec 30, 2002 11:20 pm   

Trouble with an autoroller.
 
I have been trying to make this autoroller work correctly, and it does: with one vital flaw. It is always responding to the one before current stats. Aka: it responds correctly but is always one input behind. Any ideas on how to make it work correctly? Thanks.

#TRIGGER {Str: %1 Int: %2 Wis: %3 Dex: %4 Con: %5 Accept} {#MATH total %1+%2+%3+%4+%5;answer}
#ALIAS Answer {%if(@total > 85,accept,n)
#ALIAS Accept {#BEEP 1;y}
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Dec 31, 2002 12:16 am   
 
quote:

I have been trying to make this autoroller work correctly, and it does: with one vital flaw. It is always responding to the one before current stats. Aka: it responds correctly but is always one input behind. Any ideas on how to make it work correctly? Thanks.

#TRIGGER {Str: %1 Int: %2 Wis: %3 Dex: %4 Con: %5 Accept} {#MATH total %1+%2+%3+%4+%5;answer}
#ALIAS Answer {%if(@total > 85,accept,n)
#ALIAS Accept {#BEEP 1;y}



Get rid of the answer alias and put the %if (which probably should be an #IF) in the trigger. What's happening is that the trigger sees the call to ANSWER and starts running that alias concurrently with the math statement. Apparently ANSWER is faster than the #MATH command, and so @Total is not yet changed to the new value.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Humpton
Apprentice


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Tue Dec 31, 2002 5:19 am   
 
It's also safer to take out the %1 %2 etc in the #TRIGGER part and use (%d).

And I always thought you had to use () to capture something with a wild card? I guess not?

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

Core 2651: For those who prefer the future to the past.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Dec 31, 2002 5:43 am   
 
quote:

It's also safer to take out the %1 %2 etc in the #TRIGGER part and use (%d).

And I always thought you had to use () to capture something with a wild card? I guess not?

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

Core 2651: For those who prefer the future to the past.



You still have to use () to capture, but don't the %1...%99 variables work just like &variable in a trigger pattern?

li'l shmoe of Dragon's Gate MUD
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Dec 31, 2002 2:08 pm   
 
Yeah, they do, except the &varname syntax lets you specify what wildcard to use instead of the default * and %1..%n are not technically variables. However they are never recommended in the pattern. It may produce unexpected results and since it is not proper syntax, it may break without warning in the future.

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Dec 31, 2002 7:31 pm   
 
quote:
It is always responding to the one before current stats. Aka: it responds correctly but is always one input behind.

You need to use Trigger on Prompt instead of Trigger on Newline. This can be done from the command line using the options nocr and prompt or on the Options tab in the trigger editor.
#TR {Str: (%d) Int: (%d) Wis: (%d) Dex: (%d) Con: (%d) Accept} {#IF ((%1 + %2 + %3 + %4 + %5) > 85) {#BEEP 1;y} {n}} {} {nocr|prompt}

LightBulb
Senior Member
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