|
aristotle Newbie
Joined: 23 Feb 2007 Posts: 8
|
Posted: Fri Feb 23, 2007 9:06 pm
Something amiss in Autoroll |
Here's the code I'm working with for my autoroll trigger. The problem arises when I report, the trigger fires on "you report" before checking the stats. Any ideas?
#CLASS {stats}
#VAR dstr {}
#VAR ddex {}
#VAR dint {}
#VAR dwis {}
#VAR dcha {}
#VAR dcon {}
#VAR dlck {}
#TRIGGER {Dexterity %s (%d)} {#var ddex %1}
#TRIGGER {Strength %s (%d)} {#var dstr %1}
#TRIGGER {Intelligence %s (%d)} {#var dint %1}
#TRIGGER {Wisdom %s (%d)} {#var dwis %1}
#TRIGGER {Charisma %s (%d)} {#var dcha %1}
#TRIGGER {Constitution %s (%d)} {#var dcon %1}
#TRIGGER {Luck %s (%d)} {#var dlck %1}
#TRIGGER {You report} {#if ((@dstr < 18) OR (@ddex < 18) OR (@dint < 9) OR (@dwis < 9) OR (@dcon < 12) OR (@dlck < 17)) {reroll;stat} {#if ((@dstr >= 18) AND (@ddex>= 18) AND (@dint >= 9) AND (@dwis >= 9) AND (@dcon >= 12) AND (@dlck >= 17)) {touch orb} }
#CLASS 0
Here's the text returned from the stat command, on which the trigger fires:
You report: 41/127 hp 139/139 mana 310/310 mv 293919 xp.
Your base stats: 14 str 14 int 11 wis 18 dex 12 con 11 cha 15 lck.
Your current stats: 18 str 19 int 15 wis 23 dex 18 con 11 cha 17 lck.
Any help would be amazing. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Feb 23, 2007 10:10 pm |
how about using a 3-state trigger? They will fire in exact order, everything about the patterns is easily accessible to every condition, and you can dump the trigger code into the last condition and thereby ensure all the stats are checked.
#Trigger {You report: (%d)/(%d) hp (%d)/(%d) mana (%d)/(%d) mv (%d) xp.} {}
#condition {Your base stats: (%d) str (%d) int (%d) wis (%d) dex (%d) con (%d) cha (%d) lck.} {}
#condition {Your current stats: (%d) str (%d) int (%d) wis (%d) dex (%d) con (%d) cha (%d) lck.} {if checks here}
EDIT: because of the multi-state trigger, you can use %t1...%t99 to reference the various (%d) wildcards in the #IF checks. This means that you only need to create the variables if you keep the stats. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
aristotle Newbie
Joined: 23 Feb 2007 Posts: 8
|
Posted: Fri Feb 23, 2007 10:15 pm |
That's a great idea. Just wonder how I define each (%d) though?
#condition {Your base stats: (%d) str (%d) int (%d) wis (%d) dex (%d) con (%d) cha (%d) lck.} {}
That's the line I'll use, I don't know how to reference each stat.
Also, how can I use addition inequalities? If i want to say
#str + #dex + #lck >= 53
How do i code that? |
|
|
|
xathil Beginner
Joined: 19 Feb 2007 Posts: 10
|
Posted: Fri Feb 23, 2007 10:42 pm |
#add total str
#add total dex
#add total lck
#if (total>53) {do your stuff;total = 0} {reroll (or whatever);total =0}
prolly a better way out there to add the 3 into total. but... yea |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 24, 2007 1:30 am |
Quote: |
Just wonder how I define each (%d) though?
|
Why do you need to define them? Do you need to use these values elsewhere besides in the trigger I gave you? If only the trigger I gave you uses them then there's no need for any of the #VARIABLE commands you used. You can access each (%d) via the appropriate %t1...%t99 variable; in the case of the base stats line you'd start with %t8 for strength:
#if ((%t8 + %t9 + %t10 + etc) >= 53) {} {} |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
aristotle Newbie
Joined: 23 Feb 2007 Posts: 8
|
Posted: Sat Feb 24, 2007 1:34 am |
Fixed everything; thanks for all the advice. here's the new trigger (very, very easy)
#Trigger {You report: (%d)/(%d) hp (%d)/(%d) mana (%d)/(%d) mv (%d) xp.} {}
#Trigger {You have %d gold} {reroll}
#Trigger {Your character's} {stat}
#Trigger {Your base stats:}
#condition {(&str) str (&int) int (&wis) wis (&dex) dex (&con) con (&cha) cha (&lck) lck.} {#if ((@str >15) and (@int > 12) and (@wis > 12) and (@dex > 10) and (@con > 13) and (@cha > 9) and (@lck > 10)) {pull cord} {gold}}
Numbers are simply test numbers, but it's a nice elegant trigger, I think. Much more than the first I was using |
|
|
|
xathil Beginner
Joined: 19 Feb 2007 Posts: 10
|
Posted: Sat Feb 24, 2007 2:04 am |
yea. one final suggestion. use variables for the numbers
mstr,mint etc to to variables. that way you can change them on the fly without going to the settings file each time you want to roll something new |
|
|
|
aristotle Newbie
Joined: 23 Feb 2007 Posts: 8
|
Posted: Sat Feb 24, 2007 2:51 am |
bah. something is still amiss.
The trigger seems to be working fairly well, but it is definitely passing w/o meeting all requirements. When I figure out what's wrong, I'll posit it. Here it is if any of you have bright ideas:
#Trigger {You have %d gold} {reroll}
#Trigger {Your character's} {stat}
#Trigger {Your base stats:}
#condition {(&str) str (&int) int (&wis) wis (&dex) dex (&con) con (&cha) cha (&lck) lck.} {#if ((@str >= 18) and (@int > 8) and (@wis > 8) and (@dex >= 18) and (@con > 8) and (@cha > 8) and (@lck >= 16)) {pull cord} {gold}}
The trigger fires on this text from the MUD
You report: 30/33 hp 100/100 mv 0 xp.
Your base stats: 14 str 17 int 11 wis 15 dex 17 con 9 cha 12 lck.
Your current stats: 15 str 18 int 12 wis 16 dex 19 con 9 cha 12 lck.
It's possible that the #condition command is getting (&str), etc. from the 'current stats' line, so I removed all EQ to be sure the two stats are identical, I'll see if that's the problem |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 24, 2007 3:24 am |
Why even go to all that trouble? Just complete the pattern from "Your base stats:". In this case, you don't even need to bother with #CONDITION.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
aristotle Newbie
Joined: 23 Feb 2007 Posts: 8
|
Posted: Sat Feb 24, 2007 4:02 am |
"Why even go to all that trouble? Just complete the pattern from "Your base stats:". In this case, you don't even need to bother with #CONDITION."
Without #condition, the trigger doesn't check stats, and simply rerolls |
|
|
|
aristotle Newbie
Joined: 23 Feb 2007 Posts: 8
|
Posted: Sun Feb 25, 2007 3:03 am |
All is well now, posting code in finished forum
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Feb 25, 2007 3:31 am |
Might I suggest a small tweak? In your final trigger, where the #IF check is, change all the numbers to the appropriate variables you created. Where you originally had the variables, switch them to the %1...%99 variables. The idea here is to let the user handle the @variables, preventing them from getting into a situation where they could potentially mess up the trigger code.
Similarly, an alias could be written that then allows the user to set these numbers and get the autoroller moving. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|