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


Joined: 08 Nov 2001
Posts: 7
Location: USA

PostPosted: Sun Dec 02, 2001 5:19 pm   

A wierd AutoRoller Problem
 
Okay, Ive tried this different ways and methods and am finally frustrated... Here's the output:

Choose from any of the following groups of abilities...
Group: 1 2 3 4 5
Str: 13 15 13 13 14
Int: 13 12 15 12 14
Wis: 11 14 11 13 13
Dex: 18 13 12 17 13
Con: 13 16 15 15 13
Choose a group <1-5>, or press return to reroll -->

Ive actually scratched the autoroller attempt for just something that stops whenever is sees an 18.

#TRIGGER {18} {#cw bold,red;#add AutoRoller_Num18 1}

#TRIGGER {Choose a group ~<1-5~>, or press return to reroll ~--~>} {#if (@AutoRoller_Num18=0) {#cr};#var AutoRoller_Num18 0}

Okay, that seems very simple to me and it makes sense. Maybe I am not seeing something obviously wrong? The problem? zMud seems to read the prompt trigger Before the 18 trigger increments the variable. The trigger always ends by triggering #cr one too many times.

I don't know, Im confused.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Sun Dec 02, 2001 7:14 pm   
 
This seemed like a really challenging autoroller request, so I decided to go all out :)
The result looks sound, but you'll have to test it for yourself.

Here's what I came up with.

#CLASS {Autoroller}
#ONINPUT {str (%d) int (%d) wis (%d) dex (%d) con (%d)} {#VARIABLE Target {%1|%2|%3|%4|%5}}
#TRIGGER {Str: (%d) (%d) (%d) (%d) (%d)} {
#VARIABLE Strength {%1|%2|%3|%4|%5}}
#TRIGGER {Int: (%d) (%d) (%d) (%d) (%d)} {
#VARIABLE Intelligence {%1|%2|%3|%4|%5}}
#TRIGGER {Wis: (%d) (%d) (%d) (%d) (%d)} {
#VARIABLE Wisdom {%1|%2|%3|%4|%5}}
#TRIGGER {Dex: (%d) (%d) (%d) (%d) (%d)} {
#VARIABLE Dexterity {%1|%2|%3|%4|%5}}
#TRIGGER {Con: (%d) (%d) (%d) (%d) (%d)} {
#VARIABLE Constitution {%1|%2|%3|%4|%5}}
#TRIGGER {Choose a group ~<1~-5~>, or press return to reroll ~-~-~>} {
#SAY Calculating...
#FORALL {@Strength} {#IF (%item( @Strength, %i) >= %item( @Target, 1)) {#ADDITEM @StrCheck %i} {}}
#FORALL {@Intelligence} {#IF (%item( @Intelligence, %i) >= %item( @Target, 2)) {#ADDITEM @IntCheck %i} {}}
#FORALL {@Wisdom} {#IF (%item( @Wisdom, %i) >= %item( @Target, 3)) {#ADDITEM @WisCheck %i} {}}
#FORALL {@Dexterity} {#IF (%item( @Dexterity, %i) >= %item( @Target, 4)) {#ADDITEM @DexCheck %i} {}}
#FORALL {@Constitution} {#IF (%item( @Constitution, %i) >= %item( @Target, 5)) {#ADDITEM @ConCheck %i} {}}
#LOOP 5 {#IF (%ismember( %i, @StrCheck) AND %ismember( %i, @IntCheck) AND %ismember( %i, @WisCheck) AND %ismember( %i, @DexCheck) AND %ismember( %i, @ConCheck)) {Check = %i}}
#IF (!%null( @Check)) {@Check} {#CR}
StrCheck = %null
IntCheck = %null
WisCheck = %null
DexCheck = %null
ConCheck = %null
Check = %null
}
#CLASS 0

This probably looks a bit complicated so, I'll try to explain it.

To start, run the alias to set what stats you want as a minimum.
e.g. "str 15 int 16 wis 18 dex 13 con 14"
This will set minimum strength to 15, intelligence to 16, etc.

When you receive the mud's output, each line will be saved in a variable of that name.
e.g. you get "Str: 13 15 13 13 14"
The variable @Strength will be set to {13|15|13|13|14}

This will be done for all 5 stats, then when you get to the last line (Choose a group...), each variable will be checked for matches and the variable @StrCheck, @IntCheck, etc will be set to the numbers of the group that match.

Last but not least, the variable @Check will be set to the group that passes all minimums for stats.

Reading through that it still looks confusing, but just give it a try to see if it works (since I have no way of testing it).

Acaila
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Sun Dec 02, 2001 7:22 pm   
 
#trigger {Str: (%d) (%d) (%d) (%d) (%d)} {str1 = %1; str2 = %2; str3 = %3; str4 = %4; str5 = %5}
#trigger {Int: (%d) (%d) (%d) (%d) (%d)} {int1 = %1; int2 = %2; int3 = %3; int4 = %4; int5 = %5}
#trigger {Wis: (%d) (%d) (%d) (%d) (%d)} {wis1 = %1; wis2 = %2; wis3 = %3; wis4 = %4; wis5 = %5}
#trigger {Dex: (%d) (%d) (%d) (%d) (%d)} {dex1 = %1; dex2 = %2; dex3 = %3; dex4 = %4; dex5 = %5}
#trigger {Con: (%d) (%d) (%d) (%d) (%d)} {con1 = %1; con2 = %2; con3 = %3; con4 = %4; con5 = %5}

#TRIGGER {Choose a group ~<1-5~>, or press return to reroll ~--~>} {chose_stats}

Now you need to decide what stats you want. I am going to try to code it so that each stat will be a minimum of 16. If this is too much or too little, you'll have to tweak it a bit. This would be a lot cleaner if you used a list to call the values from, but Im not very good at lists. It will be messy.

#ALIAS choose_stats
{
#VAR total1 0
#VAR total2 0
#VAR total3 0
#VAR total4 0
#VAR total5 0

#IF (@str1 >= 16) {#add total1 1}
#IF (@int1 >= 16) {#add total1 1}
#IF (@wis1 >= 16) {#add total1 1}
#IF (@dex1 >= 16) {#add total1 1}
#IF (@con1 >= 16) {#add total1 1}

#IF (@str2 >= 16) {#add total2 1}
#IF (@int2 >= 16) {#add total2 1}
#IF (@wis2 >= 16) {#add total2 1}
#IF (@dex2 >= 16) {#add total2 1}
#IF (@con2 >= 16) {#add total2 1}

#IF (@str3 >= 16) {#add total3 1}
#IF (@int3 >= 16) {#add total3 1}
#IF (@wis3 >= 16) {#add total3 1}
#IF (@dex3 >= 16) {#add total3 1}
#IF (@con3 >= 16) {#add total3 1}

#IF (@str4 >= 16) {#add total4 1}
#IF (@int4 >= 16) {#add total4 1}
#IF (@wis4 >= 16) {#add total4 1}
#IF (@dex4 >= 16) {#add total4 1}
#IF (@con4 >= 16) {#add total4 1}

#IF (@str5 >= 16) {#add total5 1}
#IF (@int5 >= 16) {#add total5 1}
#IF (@wis5 >= 16) {#add total5 1}
#IF (@dex5 >= 16) {#add total5 1}
#IF (@con5 >= 16) {#add total5 1}

#IF (@total1 == 5) {1} {#IF (@total2 == 5) {2} {#IF (@total3 == 5) {3} {#IF (@total4 == 5) {4} {#IF (@total5 == 5) {5} {%cr}}}}}
}

I think that should work, tho the final ifcheck might be a bit buggy. It should check the numbers until a suitable total is found, then, if it finds one, enter that number; if it doesn't find one, it should enter a carriage return.

You can modify your wanted stats by changing the '16' in all the checks for that stat to '17' or '18' or whatever.

Hope it works!
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Sun Dec 02, 2001 7:25 pm   
 
Hmm... ok, Acaila's lists don't look much cleaner after all

Both sets of triggers pretty much do exactly the same thing, and both should work.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Sun Dec 02, 2001 8:11 pm   
 
And I thought mine was messy
(Cleaned it up a bit though)

Acaila
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