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
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Fri Dec 03, 2004 1:12 am   

Autoroller that's not quite working.
 
I'm working on an autoroll script for my favorite mud, but I seem to have a little trouble getting it working.

Here is what I have. Can anyone tell me what's wrong?

#CLASS {autoroll} {enable}
#trigger {tie Elminster at chess!} {#var int 1} {1}
#trigger {a little faster than most.} {#var int 0} {1}
#trigger {average intelligence.} {#var int 0} {1}
#trigger {few cards short} {#var int 0} {1}
#trigger {inventive thinker.} {#var int 0} {1}
#trigger {slow learner.} {#var int 0} {1}
#trigger {Doorknobs} {#var int 0} {1}
#trigger {to endure!} {#var con 1}{1}
#trigger {good health.} {#var con 0} {1}
#trigger {and tire very easily.} {#var con 0} {1}
#trigger {sick and can run miles without tiring.} {#var con 0} {1}
#trigger {sick, and you heal quickly.} {#var con 0} {1}
#trigger {You tire easily.} {#var con 0} {1}
#trigger {It's a miracle you survived} {#var con 0} {1}
#trigger {religion} {#var chr 1} {1}
#trigger {social outcast.} {#var chr 0} {1}
#trigger {silver tongue.} {#var chr 1} {1}
#trigger {enjoy your company.} {#var chr 1} {1}
#trigger {annoying personality.} {#var chr 0} {1}
#trigger {are popular.} {#var chr 1} {1}
#trigger {No one likes you} {#var chr 0} {1}
#trigger {strength of an ox!} {#var str 1} {1}
#trigger {People don't often} {#var str 0} {1}
#trigger {weakling.} {#var str 0} {1}
#trigger {newborn kitten} {#var str 0} {1}
#trigger {tug-o-war} {#var str 0} {1}
#trigger {well-define} {#var str 0} {1}
#trigger {average strength} {#var str 0} {1}
#trigger {sunlight!} {#var dex 1} {1}
#trigger {good balance} {#var dex 0} {1}
#trigger {natural talent} {#var dex 1} {1}
#trigger {nimble and flexible.} {#var dex 1} {1}
#trigger {slightly clumsy and} {#var dex 0} {1}
#trigger {tendency to trip} {#var dex 0} {1}
#trigger {Pottery and porcelain} {#var dex 0} {1}
#trigger {Sages} {#var wis 1} {1}
#trigger {sound decisions.} {#var wis 0} {1}
#trigger {sometimes learn from your mistakes.} {#var wis 0} {1}
#trigger {rush in} {#var wis 0} {1}
#trigger {have outstanding} {#var wis 1} {1}
#trigger {excellent judgment.} {#var wis 1} {1}
#trigger {believe anything} {#var wis 0} {1}
#trigger {Do these stats look satisfactory to you? [y/n]:} {#math crit {$con&&$str&&$int&&$dex&&$wis&&$chr};#if ($crit=1) {yes} {no}} {1}
#variable chr {0}
#variable con {0}
#variable dex {0}
#variable int {0}
#variable str {0}
#variable wis {0}
#class {0}


zMud loads it just fine, but it doesn't work.

Any help would be appreciated.

(P.S. The highlighted part is the troublesome part.)
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Fri Dec 03, 2004 1:11 pm   
 
first of all, I assume you want it to make crit true if all values of those variables are set to 1.

You should use an #IF statement instead of #math, secondly, you access variable-values by @variable not $variable.

And comparing a variable in an if statement you would have to use 2 =... #IF (@crit == 1) {}{} ..

and in the trigger pattner you'll have to use ~ to allow special characters to be a part of the pattern. such as ~[ and ~]

Hope that helps a bit.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Dec 03, 2004 1:19 pm   
 
Well what doesnt it doo....... but here are some things to think about

using the default special chars you need @ not $
Also chances are this should be a PROMPT type trigger

#TRIGGER "roller" {Do these stats look satisfactory to you? [y/n]:} {
#IF (@con & @str &@int & @dex & @wis & @chr) {yes} {no}
#VAR con 0
#VAR str 0
#VAR int 0
#VAR dex 0
#VAR wis 0
#VAR chr 0
} "" {prompt|nocr}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Dec 03, 2004 1:24 pm   
 
In refrence to misterbalrog----

== is undocumented in the expressions help file but I believe acts the same as =
But since any number in zmud greater than 0 ='s true you can do without the comparison.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Fri Dec 03, 2004 1:45 pm   
 
nexela wrote:
Well what doesnt it do


Well, what it doesn't do is return anything when the triggers are tested: Not yes or no, just nothing.

nexela wrote:
#TRIGGER "roller" {Do these stats look satisfactory to you? [y/n]:} {
#IF (@con & @str &@int & @dex & @wis & @chr) {yes} {no}
#VAR con 0
#VAR str 0
#VAR int 0
#VAR dex 0
#VAR wis 0
#VAR chr 0
} "" {prompt|nocr}


Ok, so how I'm reading this is, if all the vars are true, then it will output yes, otherwise it will output no, and then reset all the variables to 0, then send the output to the MUD. Yes?
Reply with quote
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Fri Dec 03, 2004 2:17 pm   
 
I'm looking at a condensed way of writing this particular trigger, just so I can understand what exactly is happening.

Would this be an accurate re-writing of what you wrote?

#TRIGGER “roller” {Do these stats look satisfactory to you? [y/n]:} {#IF (@con & @str & @int & @dex & @wis & @chr) {yes} {no};#VAR chr 0;#VAR con 0;#VAR dex 0;#VAR int 0;#VAR str 0;#VAR wis 0} “” {prompt|nocr}


Last edited by metroiceberg on Fri Dec 03, 2004 3:06 pm; edited 1 time in total
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Dec 03, 2004 2:48 pm   
 
Yes and yes
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Fri Dec 03, 2004 3:14 pm   
 
Very Happy Thanks a bunch for all your help. It'll make it much easier to make new ones in the future with this knowledge.
Reply with quote
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Sat Dec 04, 2004 1:20 am   Still not working.
 
The variables are all storing their values now, but the "reroll" trigger is still not firing. Any more suggestions?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Dec 04, 2004 12:06 pm   
 
Chances are the pattern doesn't correctly match or that it might not be a prompt trigger make sure you copy and past the trigger from my post into your command line if it still doesn't work remove the "" {prompt|nocr} from the end and try again
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Sat Dec 04, 2004 2:21 pm   Clarification of trigger options
 
Quote:
#TRIGGER "roller" {Do these stats look satisfactory to you? [y/n]:} {
#IF (@con & @str &@int & @dex & @wis & @chr) {yes} {no}
#VAR con 0
#VAR str 0
#VAR int 0
#VAR dex 0
#VAR wis 0
#VAR chr 0
} "" {prompt|nocr}


Shouldn't this actually be:

Quote:
#TRIGGER "roller" {Do these stats look satisfactory to you? [y/n]:} {
#IF (@con & @str &@int & @dex & @wis & @chr) {yes} {no}
#VAR con 0
#VAR str 0
#VAR int 0
#VAR dex 0
#VAR wis 0
#VAR chr 0
} "" "prompt|nocr"
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Dec 04, 2004 2:47 pm   
 
You need to use tildes before the brackets in the pattern.
Do these stats look satisfactory to you? ~[y/n~]:

Technically the ? should also be tilded, but since it is the pattern wildcard for any single character it will match itself.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Sat Dec 04, 2004 3:13 pm   
 
Ok, so I use the the ~ escape character for the brackets. As far as the prompt|nocr, should this be in {} or ""?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Dec 04, 2004 3:44 pm   
 
*Whap self* thanks for catching that Vij :P

As for the prompt|nocr I put it between {} because I know it works that way however it should work with "" but Im not gonna test it.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
metroiceberg
Beginner


Joined: 19 Feb 2004
Posts: 18
Location: USA

PostPosted: Sat Dec 04, 2004 3:48 pm   
 
thanks for all the help. (can you tell I'm a virtual noob in all this scripting? Not quite the same as programming, is it?)
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