|
Nobeer Newbie
Joined: 01 Jan 2006 Posts: 2 Location: Denmark
|
Posted: Sun Jan 01, 2006 4:01 pm
Multi trigger Autoroller help |
I need a little help for an autoroller using multi triggers..
What i want is to be able to either set the min stats on each attribute, like @str > 15, @int > 17, @wis >= 18 ect.
Or i need to be able to set a min total roll, like @total >= 85..
Then it need to select the group 1-5 that has the stats im looking for.
The stats i see when i roll is like this..
Code: |
Choose from any of the following groups of abilities...
Group: 1 2 3 4 5
Str: 15 16 13 11 13
Int: 14 15 13 10 14
Wis: 9 12 13 15 12
Dex: 12 16 13 12 13
Con: 11 12 17 11 12
Choose a group <1-5>, or press return to reroll(Help <attribute> for more information) --> |
Hope you can help me out..
Editted by Vijilante to include code tags. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jan 01, 2006 7:01 pm |
The state structure is way easy to figure out so I'll leave that to you. As for code, try this out:
STATE 0
//zeroes out all 5 stats in the 5 datarecord variables--@Group1, @Group2, @Group3, @Group4, and @Group5
#loop 1,5 {#forall "str|int|wis|dex|con" {#addkey %j %i 0}} //the order of %i and %j may/may not need to be reversed
STATES 2-5 (replace "Stat" with proper stat name)
//sets each stat to proper value for each group
#loop 1,5 {Group%i.stat = %%i}
STATES 6 (con)
//sets each group's CON stat to proper value, then totals up all stats for each group
#loop 1,5 {Group%i.con = %%i;Group%i.total = %eval(@Group%i.str + @group%i.int + @group%i.wis + @group%i.dex + @group%i.con)}
STATE 7 (min total)
//loops through each group to see if it's over the minimum, and adds it to a pick list if so
//if a choice comes up, the autoroller will pause and wait for your decision
//choosing "none of the above" or clicking the cancel button will send a return
/choosing a number, that number is sent
Total.choices = "";#loop 1,5 {#if (@Group%i.total >= @Total.min) {#additem Total.choices %i}};#if (@Total.choices) {Answer = %pick("p:Choose which group you want to keep","o:1",%concat(@total.choices,"none of the above"));#if ((@Answer = 0) or (@Answer = "none of the above")) {#cr} {@answer}} |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Nobeer Newbie
Joined: 01 Jan 2006 Posts: 2 Location: Denmark
|
Posted: Mon Jan 02, 2006 1:04 pm |
I was looking for it in multi triggers, couse i wanna learn multi triggers, and its always easier to do with some code you know yourself.
So if you could just give me a structure like you just did, using multi triggers it would be real cool.
BTW the state structure works.. :D |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Jan 02, 2006 11:09 pm |
state = multi. Use #TRIGGER for state 0, with the pattern being the "Choose..." line. Everything else uses the #CONDITION command.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Tue Jan 03, 2006 6:49 am |
Code: |
#REGEX {^\s*Choose from any of the following groups of abilities\.\.\.\s*$} {}
#COND {Str:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)} {} {regex}
#COND {Int:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)} {} {regex}
#COND {Wis:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)} {} {regex}
#COND {Dex:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)} {} {regex}
#COND {Con:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)} {#show %format( "&-6s &-5.0n &-5.0n &-5.0n &-5.0n &-5.0n", "Tot:", %eval( %t1+%t6+%t11+%t16+%t21), %eval( %t2+%t7+%t12+%t17+%t22), %eval( %t3+%t8+%t13+%t18+%t23), %eval( %t4+%t9+%t14+%t19+%t24), %eval( %t5+%t10+%t15+%t20+%t25));#if ((%t1+%t6+%t11+%t16+%t21 > @roller.tot) & ((%t1 > @roller.str) & (%t6 > @roller.int) & (%t11 > @roller.wis) & (%t16 > @roller.dex) & (%t21 > @roller.con))) {#show Group 1 is an acceptable choice.};#if ((%t2+%t7+%t12+%t17+%t22 > @roller.tot) & ((%t2 > @roller.str) & (%t7 > @roller.int) & (%t12 > @roller.wis) & (%t17 > @roller.dex) & (%t22 > @roller.con))) {#show Group 2 is an acceptable choice.};#if ((%t3+%t8+%t13+%t18+%t23 > @roller.tot) & ((%t3 > @roller.str) & (%t8 > @roller.int) & (%t13 > @roller.wis) & (%t18 > @roller.dex) & (%t23 > @roller.con))) {#show Group 3 is an acceptable choice.};#if ((%t4+%t9+%t14+%t19+%t24 > @roller.tot) & ((%t4 > @roller.str) & (%t9 > @roller.int) & (%t14 > @roller.wis) & (%t19 > @roller.dex) & (%t24 > @roller.con))) {#show Group 4 is an acceptable choice.};#if ((%t5+%t10+%t15+%t20+%t25 > @roller.tot) & ((%t5 > @roller.str) & (%t10 > @roller.int) & (%t15 > @roller.wis) & (%t20 > @roller.dex) & (%t25 > @roller.con))) {#show Group 5 is an acceptable choice.}} {regex}
|
Set up a db variable with the minimum acceptable stats named roller, with the form..
#addkey roller tot 85
#addkey roller str 18
..and so on.
Most of it's pretty basic, just bloody repetative with all the math.
P.S. I tried to set up a loop in the form #5 {%{t%eval(%i)} + %{t%eval(%1+1}...} but obviously that was more then it was willing to bend, would've made the code neater though. |
|
|
|
|
|
|
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
|
|