Stat Rolling Trigger

Posted by Domnslave2003 on Wed 12 May 2004 08:11 AM — 7 posts, 33,061 views.

#0
I'm looking for someone to make me a stat rolling trigger(s)
for zmud v7.05 that will do either...

A: look at each stat and reroll the given set of scores if they're all not 14 or higher

OR

B: add up the sum of all the stats and reroll them if their total is less than 110


I ship off to basic training in 12 days so i need this fairly soon... as for the output of the mud when making a character .. its as follows:


Character stats
------------------------------

You may now roll for your character's stats.
You may roll as often as you like.


    Strength: 12 (Average)
   Dexterity: 10 (Average)
Constitution: 13 (Fit)
Intelligence: 14 (Smart)
      Wisdom:  9 (Average)
    Charisma:  8 (Average)
        Luck: 16 (Very lucky)

Keep? (Y/N)


ok .. hope that helps .. thanks.
Amended on Wed 12 May 2004 10:35 PM by Nick Gammon
USA #1
Entirely the wrong forum for zmud scripting support - try the forums over at zuggsoft, Im sure theyll be more helpful since thats the zmud support forums.
#2
wow how often does that happen

i can tell you how to do it in mushclient... i think..
Amended on Wed 12 May 2004 08:36 AM by Zendu
#3
okay ... same situation and whatnot .... now that i have mushclient, could someone help write up a trigger for mush?
USA #4
Copy this whole thing, then paste it in your triggers page (copy it, have it on your clipboard, then go to triggers, and click paste). It should work, some of the syntax might be a little off, let me know. Also, as they match, the triggers will change the text color to brown on black, if this doesnt happen, let me know.

(Nick, change the title of this thread? for archive purposes, or something?)

<triggers>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Charisma: (\d+) \(.*\) $"
   regexp="y"
   send_to="9"
   sequence="100"
   variable="RollCha"
  >
  <send>%1</send>
  </trigger>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Constitution: (\d+) \(.*\) $"
   regexp="y"
   send_to="9"
   sequence="100"
   variable="RollCon"
  >
  <send>%1</send>
  </trigger>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Dexterity: (\d+) \(.*\) $"
   regexp="y"
   send_to="9"
   sequence="100"
   variable="RollDex"
  >
  <send>%1</send>
  </trigger>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Intelligence: (\d+) \(.*\) $"
   regexp="y"
   send_to="9"
   sequence="100"
   variable="RollInt"
  >
  <send>%1</send>
  </trigger>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Keep\? \(Y\/N\) $"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>dim add, check
add = &quot;N&quot;
If (Cint(Getvariable(&quot;RollStr&quot;))+Cint(Getvariable(&quot;RollDex&quot;))+Cint(Getvariable(&quot;RollCon&quot;))+Cint(Getvariable(&quot;RollInt&quot;))+Cint(Getvariable(&quot;RollWis&quot;))+Cint(Getvariable(&quot;RollCha&quot;))+Cint(Getvariable(&quot;RollLck&quot;))) &gt;= 110 Then
add = &quot;Y&quot;
end if
check = &quot;Y&quot;
If Cint(Getvariable(&quot;RollStr&quot;) &lt; 14 then
check = &quot;N&quot;
end if
If Cint(Getvariable(&quot;RollDex&quot;) &lt; 14 then
check = &quot;N&quot;
end if
If Cint(Getvariable(&quot;RollCon&quot;) &lt; 14 then
check = &quot;N&quot;
end if
If Cint(Getvariable(&quot;RollInt&quot;) &lt; 14 then
check = &quot;N&quot;
end if
If Cint(Getvariable(&quot;RollWis&quot;) &lt; 14 then
check = &quot;N&quot;
end if
If Cint(Getvariable(&quot;RollCha&quot;) &lt; 14 then
check = &quot;N&quot;
end if
If Cint(Getvariable(&quot;RollLck&quot;) &lt; 14 then
check = &quot;N&quot;
end if
If check == &quot;N&quot; OR add == &quot;N&quot; then
world.send &quot;N&quot;
else
world.send &quot;Y&quot;
end if</send>
  </trigger>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Luck: (\d+) \(.*\) $"
   regexp="y"
   send_to="9"
   sequence="100"
   variable="RollLck"
  >
  <send>%1</send>
  </trigger>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Strength: (\d+) \(.*\) $"
   regexp="y"
   send_to="9"
   sequence="100"
   variable="RollStr"
  >
  <send>%1</send>
  </trigger>
  <trigger
   custom_colour="10"
   enabled="y"
   match="^Wisdom: (\d+) \(.*\) $"
   regexp="y"
   send_to="9"
   sequence="100"
   variable="RollWis"
  >
  <send>%1</send>
  </trigger>
</triggers>
Amended on Wed 12 May 2004 10:23 PM by Flannel
#5





*edit* drat flannel knows more about scipting than i...and hes faster
Amended on Wed 12 May 2004 08:20 PM by Zendu
Australia Forum Administrator #6
With the latest version of MUSHclient you can do that as a single multi-line trigger, like this:



<triggers>
<trigger
enabled="y"
lines_to_match="10"
match="(?x) ^\s*Strength\:\s*(?P&lt;str&gt;\d+)\s*\(.*\)\n \s*Dexterity\:\s*(?P&lt;dex&gt;\d+)\s*\(.*\)\n \s*Constitution\:\s*(?P&lt;con&gt;\d+)\s*\(.*\)\n \s*Intelligence\:\s*(?P&lt;int&gt;\d+)\s*\(.*\)\n \s*Wisdom\:\s*(?P&lt;wis&gt;\d+)\s*\(.*\)\n \s*Charisma\:\s*(?P&lt;cha&gt;\d+)\s*\(.*\)\n \s*Luck\:\s*(?P&lt;lck&gt;\d+)\s*\(.*\)\n \n \s*Keep\?\s+\(Y/N\)\s*$"
multi_line="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>


total = %&lt;str&gt; + %&lt;dex&gt; + %&lt;con&gt; + %&lt;int&gt; + _
        %&lt;wis&gt; + %&lt;cha&gt; + %&lt;lck&gt;

if %&lt;str&gt; &lt; 14 or _
   %&lt;dex&gt; &lt; 14 or _
   %&lt;con&gt; &lt; 14 or _
   %&lt;int&gt; &lt; 14 or _
   %&lt;wis&gt; &lt; 14 or _
   %&lt;cha&gt; &lt; 14 or _
   %&lt;lck&gt; &lt; 14 then
 ColourNote "white", "blue", "stats too low"
 Send "N"
elseif total &lt; 110 then
 ColourNote "white", "blue", "total too low (" &amp; total &amp; ")" 
 Send "N"
else
 ColourNote "white", "blue", "accepted stats" 
 Send "Y"
end if

   </send>
  </trigger>
</triggers>



This uses named wildcards and multi-line triggers to achieve the whole stat roller in a single trigger with fairly easily viewed arithmetic.

You can copy the whole lot and click the "paste" button in the trigger list to import it.