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


Joined: 10 Jun 2003
Posts: 2
Location: USA

PostPosted: Tue Jun 10, 2003 4:20 am   

Autoroller
 
Can someone look over the script for me and offer a few suggestions, since I'm kinda stuck on this?

Mud output...
str int wis dex con chr lck
1) 13 8 14 11 14 7 13
2) 9 15 8 12 10 13 6
3) 7 10 8 11 8 13 12
4) 8 11 10 10 13 15 11
[Select 1-4, or ENTER for more choices]:

A script I modified from an old forum post. You guys might even recognize some of your handy work in the script...
#CLASS {AutoRoller}
#VAR StrRating {13|1|0}
#VAR IntRating {11|1|0}
#VAR WisRating {13|1|0}
#VAR DexRating {13|1|0}
#VAR ConRating {13|1|0}
#VAR ChrRating {11|1|0}
#VAR LckRating {11|1|0}
#VAR LineRatings {0|0|0|0}
#VAR Rating {0}
#TRIGGER {(%d)~) (%d) (%d) (%d) (%d) (%d) (%d) (%d)} {Rating=%eval((%2>=%item(@StrRating,1)));Rating=%eval(@Rating&(%3>=%item(@IntRating,1)));Rating=%eval(@Rating&(%4>=%item(@WisRating,1)));Rating=%eval(@Rating&(%5>=%item(@DexRating,1)));Rating=%eval(@Rating&(%6>=%item(@ConRating,1)));Rating=%eval(@Rating&(%7>=%item(@ChrRating,1)));Rating=%eval(@Rating&(%8>=%item(@LckRating,1)));#IF (@Rating) {Rating=0;#ADD Rating %eval((%2*%item(@StrRating,2))+((%2-%item(@StrRating,1))*%item(@StrRating,3)));#ADD Rating %eval((%3*%item(@IntRating,2))+((%3-%item(@IntRating,1))*%item(@IntRating,3)));#ADD Rating %eval((%4*%item(@WisRating,2))+((%4-%item(@WisRating,1))*%item(@WisRating,3)));#ADD Rating %eval((%5*%item(@DexRating,2))+((%5-%item(@DexRating,1))*%item(@DexRating,3)));#ADD Rating %eval((%6*%item(@ConRating,2))+((%6-%item(@ConRating,1))*%item(@ConRating,3)));#ADD Rating %eval((%7*%item(@ChrRating,2))+((%7-%item(@ChrRating,1))*%item(@ChrRating,3)));#ADD Rating %eval((%8*%item(@LckRating,2))+((%8-%item(@LckRating,1))*%item(@LckRating,3)));LineRatings=%replaceitem(@Rating,%1,@LineRatings);#SUB {%trigger Rated:@Rating}} {LineRatings=%replaceitem("0",%1,@LineRatings);#SUB {%trigger So Close!}}}
#TR {~[Select 1-6, or ENTER for more choices~]~:} {Rating=%ismember(%max(%replace(@LineRatings,"|",",")));#SUB {%trigger Highest:@Rating};#IF (@Rating>95) {#SEND @Rating} {#beep} {#SEND %null}}}
#Class 0

A few things that I had problems with...
1. I get 3x "Highest:0" when I hit Enter. Not a big deal if the mud doesn't see it, but annoying on the screen. Would like to correct it, if it is an output to the mud.
2. Right now it's not really an auto roller. Ideally I would like it to keep rerolling and stop to beep me only if I get a score of 95 or higher. The 'So Close' is cute for manual enter, but I don't need it as much if I can get this to just to show lines that exceeds a 95 score.
3. If someone can explain how the last If statement should be set up to truly auto reroll, especially with a 1 sec timer delay, it would help me immensely in the future.

I know I'm asking for a lot, so any assistance is greatly appreciated!
JB
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jun 10, 2003 5:45 am   
 
Hehe, I remember writing that mess. I was quite disturbed when the person didn't use it because I thought it was quite good. Anyhow there are a few minor bugs in the last trigger.

#TR {~[Select 1-6, or ENTER for more choices~]~:} {Rating=%ismember(%max(%replace(@LineRatings,"|",","))@LineRatings);#SUB {%trigger Highest:@Rating-%item(@LineRatings,@Rating)};#IF (%item(@LineRatings,@Rating)>95) {#SEND @Rating;#beep} {#SEND %null}}

If you read my original post of it it explains how I set up the rating system. Looking at the code the items were minimum|scoreForMinimum|bonusPerPointOver. You will have to tweak those values before it really calculates anything, and of course you will have to tweak them a lot to get a 95 out of it.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jun 10, 2003 6:52 am   
 
After spending quite a bit of time analyzing the script, I reached the following conclusions.

1. The trigger pattern doesn't allow for variable spaces between numbers and therefore won't trigger on any line containing single-digit attributes.

2. The first value in each preset variable is the minimum acceptable value for that attribute, the other two are for weighting but aren't really needed.

3. The final rating for each line will be 0 if any value is below the minimum.

4. With the variables as is (second value = 1, third value = 0), the final rating for each line will just be the total of the seven values if all are at or above minimum.

5. The second trigger is probably a prompt-type output from the MUD, but it doesn't have the prompt options set.

This looks unnecessarily complex to me, so I just started over.

#CLASS AutoRoller
#VAR StrRating {13}
#VAR IntRating {11}
#VAR WisRating {13}
#VAR DexRating {13}
#VAR ConRating {13}
#VAR ChrRating {11}
#VAR LckRating {11}
#VAR Rating {0}
#VAR Reroll 1 1
#TRIGGER {%d~) %s (%d) %s (%d) %s (%d) %s (%d) %s (%d) %s (%d) %s (%d)} {#MATH Rating (%1 + %2 + %3 + %4 + %5 + %6 + %7);#IF ((%1 >= @StrRating) AND (%2 >= @IntRating) AND (%3 >= @WisRating) AND (%4 >= @DexRating) AND (%5 >= @ConRating) AND (%6 >= @ChrRating) AND (%7 >= @LckRating) AND (@Rating > 94)) {#BEEP;#VAR Reroll 0;#SUB {%trigger Rated:@Rating}}}
#TR {~[Select 1-4, or ENTER for more choices~]:} {#IF (@Reroll = 1) {#ALA +1 {#CR}} {#BEEP;#VAR Reroll 1}} {} {nocr|prompt}
#CLASS 0

This should show you the rating for any line that meets minimums and has a total of at least 95. When it does, it should also beep and leave the decision to you. If none of the four lines meets these criteria, it should roll again after a 1-second pause.

LightBulb
Advanced Member
EDIT: Over an hour behind Vijilante's post, it definitely took some time to analyze.
Reply with quote
JBLittleman
Newbie


Joined: 10 Jun 2003
Posts: 2
Location: USA

PostPosted: Wed Jun 11, 2003 4:45 am   
 
Thanks for the responses.

Vijilante...coding for the rating system worked quite well as I understood your logic for the bonuses values. It was perfect for what I want to do with class rolls. Didn't experience any problems tweaking to get the calculation done either. It was the trigger for the reroll I had problems with. With the latest revision of your #TR line, I would get 2 enter prompts and then a
stop and still have that Highest:0- value when I presseed ENTER. Wondering if there's a way to get the trigger to keep rerolling or was I suppose to wait for something?

Lightbulb...simplicity worked well for me and should be posted in done script, since it's an interesting autoroller. A few quick questions tho...is '%s' for any spacing? Couldn't find the command in the help file. Which command in the trigger created the 1 sec delay: {#ALA +1 {#CR}}?

Again, thanks for the help. Definitely appreciated the tutorial as I've been stuck with using basic triggers until this little research project.
JBLittleman
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jun 11, 2003 7:58 am   
 
%s matches any amount of white space (spaces, tabs)

It does require at least one space (or tab) though, it won't match no white space. It can be found in the topic Pattern Matching. I usually get there from the index, using pattern or wild card, but there are many links to it in related topics such as #TRIGGER.

Yes, the delay is created by the #ALARM.

I can't post this in Finished Scripts because I don't know what MUD it's for (and can't think of any that use this system).

LightBulb
Advanced Member
Reply with quote
lewolf
Newbie


Joined: 20 Jun 2003
Posts: 1
Location: USA

PostPosted: Fri Jun 20, 2003 7:46 pm   
 
I'll admit up front to being clueless, so I hope you will all have patience for me. I've read the Zugg tutorials, but I just don't get all of it.

I'm trying to creat a simple autoroller. The mud outputs text like this:

STR : You have an average strength.
DEX : You are slightly clumsy and uncoordinated.
INT : You are a brilliant and inventive thinker.
WIS : You have outstanding judgment--you are wise beyond your years.
CON : You are in good health.
CHR : You have an annoying personality.

Do these stats look satisfactory to you? [y/n]:

There are 7 values for each stat. What I'd like to do is have it parse the str value. If it's one of the five lowest, it outputs n. If not, it does nothing. Then I'd like it to parse dex, and do the same thing. However, if it triggers on one of the str no's, I need it not to trigger at all on the dex line.

I tried using trigger states, but I can't find a way for it to advance one state and then fire on any one of a list of conditions.

I also thought of adding conditions with a skip next 5 lines, but I don't know the syntax for that either.

I'm using 6.26a beta.

Any help is greatly appreciated.


For reference, the str output states are:

You are feeble as a newborn kitten!
People don't often ask you to lift heavy objects.
You have an average strength.
You have a slight advantage in a tug-of-war.
You have a well defined, muscular physique.
Your strength is amazing!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jun 26, 2003 7:58 am   
 
It's usually best to start a new topic when your problem is significantly different from the one being discussed, such as word descriptions of attributes in place of numbers.

This should be fairly simple. Start with an assumption of "yes" (1) and change it to "no" (0) if anything is unsatisfactory. Give the response following the CHR line.
#TR {^STR : (*)} {#IF ("%1" = "You are feeble as a newborn kitten!") {#VAR answer 0} {#VAR answer 1}}
#COND {^DEX : (*)} {#IF ("%1" = "You are as clumsy as possible") {#VAR answer 0}}
#COND {^INT : (*)} {#IF ("%1" = "You are as stupid as possible") {#VAR answer 0}}
#COND {^WIS : (*)} {#IF ("%1" "You are as foolish as possible") {#VAR answer 0}}
#COND {^CON : (*)} {#IF ("%1" = "You are as sickly as possible") {#VAR answer 0}}
#COND {^CHR : (*)} {#IF ("%1" "You are as annoying as possible") {#VAR answer 0};#IF (@answer = 0) {no} {#NOOP}}
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