Automated rolls

Posted by Rhytnen on Sat 02 Nov 2002 11:16 PM — 19 posts, 88,457 views.

#0

Your ability scores:
Str: excellent Dex: very good Int: average
Wis: decent Con: very good Cha: poor

Press 'Y' to keep these stats, and 'N' to reroll:


The above is what rolling abilities looks like on the MUD I play.


Cha: average
Trigger input: no

Cha: awful
Trigger input: no

Cha: bad
Trigger input: no

Cha: below average
Trigger input: no

Cha: decent
Trigger input: no

Cha: excellent
Trigger input: *play sound*

Cha: good
Trigger input: no

Cha: poor
Trigger input: no

Cha: very good
Trigger input: *play sound*


These are the triggers I have set up for rolling abilities. "No" is the trigger input for all rolls save "excellent" and "very good." As you can see, my triggers are based entirely on charisma, and as a result, where my charisma may be excellent or very good, strength or some other ability is apt to be bad or poor or average. My question is, how can I get Cha: excellent or Cha: very good to prompt checks on strength, dexterity, intelligence, wisdom, and constitution to make sure they're all excellent, and if they're not all excellent, or one is not excellent, no will be the trigger input? Basically, how can I get the client to cease an automated roll until strength, dexterity, intelligence, wisdom, and constitution are all excellent, and charisma either very good or excellent? (It is a rarity that excellent charisma be ascertained.)


Your ability scores:
Str: excellent Dex: excellent Int: excellent
Wis: excellent Con: excellent Cha: excellent

or

Your ability scores:
Str: excellent Dex: excellent Int: excellent
Wis: excellent Con: excellent Cha: very good


The above is what I endeavor. How would I script an automated roll to accomplish this?
#1
Trigger:

(Str|Dex|Int|Wis|Con|Cha): (average|aweful|good| <etc> )

Let it match mulitiple times on the same line

In your script, you'll need 2 global variables, 1 to keep track of how many stats have been processed during this run, another to keep track of how many 'very good' and 'excellent' have been found.

When total matches is =6, then check to see if good matches =6, if not, world.send "no" and reset both numbers back to 0. If both are 6, then send the sound.
#2
Er, easy enough.

But, I know absolutely _nothing_ about scripting. Could you go into a little more detail please? =]

Thanks.
Australia Forum Administrator #3
Your first problem is that what you are attempting to do is not very realistic. I am assuming from your examples that the MUD randomly rolls stats for you, and you have an equal chance of being offered one of "excellent", "very good", "good", "decent", "average", "poor", "bad" or "awful". That means a 1 in 8 chance of each one. Now you have 6 stats, so to get excellent on all 8 you would have a 1 in 8 X 8 X 8 X 8 X 8 X 8 = 262,144 chance. You have said you would accept "very good" or "excellent" in charisma, which makes it slighly easier, namely 1 in 131,072 chance.

Put it another way, you need 131,072 rolls before you get that score, at say 10 seconds per roll, would take 21,845 minutes, which is 364 hours, which is 15 days. Frankly if I was the MUD admin and I found someone taking 15 days of continuous spamming of my MUD with attempts to roll the perfect stats I would boot them off for good.

However if you scale back your ambitions a bit, it can get easier. For example, you might want "average" or better for all stats (ie. 1 in 2 chance) plus "very good" or "excellent" for charisma. The odds for that should be:

4/8 X 4/8 X 4/8 X 4/8 X 4/8 X 2/8 = 1 in 128 chance. That is, only 128 rolls.

The plugin below will do that. It uses three triggers, the first one remembers the line with the Str, Dex and Int scores, the second one discards the roll if the above criteria are not met. The third trigger looks for the line "Your ability scores:", and uses that to enable the other triggers so you don't get false matches later on.

Just copy from below the line, and paste into a blank notepad window, and save as ScoreChecker.xml. Then add that file into MUSHclient using the plugins window.




<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, November 05, 2002, 5:34 PM -->
<!-- MuClient version 3.30 -->

<!-- Plugin "ScoreChecker" generated by Plugin Wizard -->

<muclient>
<plugin
   name="ScoreChecker"
   author="Nick Gammon"
   id="e5035cb194f55fc466334012"
   language="VBscript"
   purpose="Checks stat rolls"
   date_written="2002-11-05 17:32:55"
   requires="3.27"
   version="1.0"
   >
<description trim="y">
<![CDATA[
This checks your stats (str, dex, wis etc.) and replies "Y" (to accept) 
if they are OK, and "N" (to reject) if not.

See: 
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1936

for more details.

]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="Your ability scores:"
   script="OnStart"
   sequence="100"
  >
  </trigger>
  <trigger
   custom_colour="3"
   group="scores"
   match="Str: * Dex: * Int: *"
   script="OnLine1"
   sequence="100"
  >
  </trigger>
  <trigger
   custom_colour="4"
   group="scores"
   match="Wis: * Con: * Cha: *"
   script="OnLine2"
   sequence="100"
  >
  </trigger>
</triggers>

<!--  Script  -->


<script>
<![CDATA[
sub OnStart (sName, sLine, wildcards)
  world.EnableGroup "scores", 1
end sub

'
' converts a word score into a number
'
function RateIt (score)
 
 select case score
   case "excellent" RateIt = 8
   case "very good" RateIt = 7
   case "good"      RateIt = 6
   case "decent"    RateIt = 5
   case "average"   RateIt = 4
   case "poor"      RateIt = 3
   case "bad"       RateIt = 2
   case "awful"     RateIt = 1
   case else        RateIt = 0
 end select

end function

sub OnLine1 (sName, sLine, wildcards)
'
'  remember str, dex, int for next time
'
  world.SetVariable "str", wildcards (1)
  world.SetVariable "dex", wildcards (2)
  world.SetVariable "int", wildcards (3)
end sub

sub OnLine2 (sName, sLine, wildcards)
  dim str, dex, int, wis, con, cha, ok

  str = world.GetVariable ("str")
  dex = world.GetVariable ("dex")
  int = world.GetVariable ("int")
  wis = wildcards (1)
  con = wildcards (2)
  cha = wildcards (3)

  ok = vbTrue

'
'  see if it OK
'

  if RateIt (str) < 4 then ok = vbFalse
  if RateIt (dex) < 4 then ok = vbFalse
  if RateIt (int) < 4 then ok = vbFalse
  if RateIt (wis) < 4 then ok = vbFalse
  if RateIt (con) < 4 then ok = vbFalse
  if RateIt (cha) < 7 then ok = vbFalse

'
'  accept scores if ok
'    

  if ok then
    world.send "Y"
  else
    world.send "N"
  end if

  world.EnableGroup "scores", 0
end sub


]]>
</script>


</muclient>
Greece #4
Not to mention that the MUD probably assigns a predefined number of stat points to each stat, i.e. if you get one stat as excellent, another one will be bad, etc, so you can naver get excellent in all stats. I might be wrong though.
#5
Am I allowed to modify this plug in for a different mud type? If so, can someone help me modify - the stats screen looks like this


Your stats are:
Current Racial
Stat Max
Agility : 43 85
Stamina : 40 80
Strength : 78 100
Quickness : 82 105
Willpower : 26 50
Perception : 65 65
Intelligence: 71 75
Is this acceptable?

Then you say Y or N
Australia Forum Administrator #6
You are allowed to, certainly, plugins are provided for your playing pleasure.

You would need a trigger per line (or a more complex regular-expression trigger), where each one remembers its score, and then on the "Is this acceptable?" line you would look at the saved scores and make a decision.

Bear in mind what I said above for trying for too high a score.
#7
A new mud I have tried to play looks like this:

Your stats are:

Str: AVG. Int: AVG. Wis: HIGH. Dex: BAVG.
Con: LOW. Chr: LOW. Luc: HIGH. - Accept? (Y/N):

How would I change the trigger start to account for the return between "Your stats are:" and "Str: AVG. Int: AVG. Wis: HIGH. Dex: BAVG."?
Australia Forum Administrator #8
Ignore it. The important lines are the other three. You need three triggers, like this:

Your stats are:
Str: *. Int: *. Wis: *. Dex: *.
Con: *. Chr: *. Luc: *. - Accept? (Y/N):

The first one enables the other two.

The second one remembers the results (str, int, wis, dex) in variables.

The third one makes the decision. If it accepts (sends Y) then it disables all three triggers. If not, it sends N and waits for the lines to appear again.

The blank line will not trigger anything and won't cause any harm.

#9
I tried it again. But it still seems to acknoledge the return because I tried it on a mud without the space between "Your stats are:" and the Stats and it worked. But with the space it didn't. Please help me to realize why it won't ignore the return.
Australia Forum Administrator #10
It won't be the blank line, but you might need to carefully look at each trigger. For example, is there a trailing space after "Your stats are:"?

Set each trigger to a different colour, then you will see which, if any, are matching. If they don't match you need to check that you have them right. An extra space here or there will throw them out.
#11
The mud i play at is anotherworld.org p:4000.
can anyone help me addapt/write a scrip for rolling the perfect stats on it.
it looks like this

Your abilities are:
Str(5spaces)Excellent
Int(5spaces)Excellent
Wis(5spaces)Excellent
Dex(5spaces)Excellent
Con(5spaces)Excellent
Cha(5spaces)i dont care about this one

Do you want to retain these abilities? [y/N]

So can anyone help me?
Also this mud forces the last stats you rolled on you after some 15-20 min or rolling. I would like to know if a way to reconnect, chose a certain gender, race, and class then keep rolling is possible (so i dont have to go back doing it :)
All your help would be mutch apprichiated
Australia Forum Administrator #12
Ah, this is the post I was talking about.

You are being given 20 minutes, but it might take 9 hours to get 5 excellents. It seems they are on to you. :)

The stat roller is simple enough, you need 5 or 6 triggers (or one more complex one) with a bit of scripting. See the other posts about rollers, at least the triggers for yours will be easy enough.
#13
I know this is probably a lot simplier than what your previous example was but I've never used scripts before.
What I'm trying to match is:

Str: 19 Int: 14 Wis: 15 Dex: 8 Con: 12 Cha: 11 Lck: 13
Keep? (Y/N)
n

Str: 19 Int: 14 Wis: 17 Dex: 7 Con: 13 Cha: 13 Lck: 17
Keep? (Y/N)

Something similar to this. I attempted to modify what you had....though I have no clue how close I've come to success or dismal faliure :P

Any help would be appreciated.
What I've changed it to is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, November 05, 2002, 5:34 PM -->
<!-- MuClient version 3.30 -->

<!-- Plugin "ScoreChecker" generated by Plugin Wizard -->

<muclient>
<plugin
name="ScoreChecker"
author="Nick Gammon"
id="e5035cb194f55fc466334012"
language="VBscript"
purpose="Checks stat rolls"
date_written="2002-11-05 17:32:55"
requires="3.27"
version="1.0"
>
<description trim="y">
<![CDATA[
This checks your stats (str, dex, wis etc.) and replies "Y" (to accept) if they are OK, and "N" (to reject) if not.

See:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1936

for more details.

]]>
</description>

</plugin>


<!-- Triggers -->

<triggers>
<trigger
custom_colour="3"
group="scores"
match="Str: * Int: * Wis: * Dex: * Con: * Cha: * Lck: *"
script="OnLine1"
sequence="100"
>
</trigger>
</triggers>

<!-- Script -->


<script>
<![CDATA[

'
' converts a word score into a number
'


sub OnLine1 (sName, sLine, wildcards)
'
' remember str, dex, int for next time
'
world.SetVariable "str", wildcards (1)
world.SetVariable "int", wildcards (2)
world.SetVariable "wis", wildcards (3)
world.SetVariable "dex", wildcards (4)
world.SetVariable "con", wildcards (5)
world.SetVariable "cha", wildcards (6)
world.SetVariable "lck", wildcards (7)

end sub

ok = vbTrue

'
' see if it OK
'

if wildcards (1) < 15 then ok = vbFalse
if wildcards (2) < 15 then ok = vbFalse
if wildcards (3) < 15 then ok = vbFalse
if wildcards (4) < 15 then ok = vbFalse
if wildcards (5) < 15 then ok = vbFalse
if wildcards (6) < 15 then ok = vbFalse
if wildcards (7) < 15 then ok = vbFalse

'
' accept scores if ok
'

if ok then
world.send "Y"
else
world.send "N"
end if

world.EnableGroup "scores", 0
end sub


]]>
</script>


</muclient>


Once again, thanks.
-Eli hamblet
Amended on Thu 29 Apr 2004 06:39 AM by Elihamblet
Australia Forum Administrator #14
You get syntax errors I presume? It seems to be missing a Sub here and there.

Your example looks simple enough for one trigger. Something like this:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="Str: * Int: * Wis: * Dex: * Con: * Cha: * Lck: *"
   send_to="12"
   sequence="100"
  >
  <send>if (%1 + %2 + %3 + %4 + %4 + %6 + %7) &gt; 30 then
  Send "Y"
else
  Send "N"
end if</send>
  </trigger>
</triggers>

Amended on Thu 29 Apr 2004 06:51 AM by Nick Gammon
#15
I play a mud that has a stat roll setup similar to the first one mentioned in this forum subject. The only issue is there is a two space indention for the stats like so (forum won't show so I'm substituting "~" for a space):

Your ability scores:
~~Str: * Dex: * Int: *
~~Wis: * Con: * Cha: *

Using Nick Gammon's unaltered code the trigger recognized the 'Your ability scores:' but stopped. However, when I tried to compensate for the indention in the code provided by Nick Gammon by adding two spaces in front of 'Str:', 'match="~~Str: * Dex: * Int: *"' (Lines 49 and 57), the trigger recognized the text but would not accept stats within the limmits I gave it. For example, I changed all the stats to accept at least a 'poor' or 'awful' but even when all the stats were at least 'average' or 'decent' trigger would still output "N" to the mud.

I'm ignorant of all the scripting languages accepted by MUSHclient but with knowledge in C++ I understand some of what I see in the script provided by Nick Gammon. Therefore it would be helpful if someone could explain what I did wrong as well as show me what corrections to make.
Amended on Mon 18 Jul 2005 12:20 AM by Stryker
#16
Alright, I dunno if anyone is around to help on this anymore, but I am finally trying to build a stat roller for "The Final Challenge" (Which is the mud that Saladin was trying to play, as that is a dear friend of mine, that brought a smile to my face, I remember him rolling Saladin)



Saladin said:

I tried it again. But it still seems to acknoledge the return because I tried it on a mud without the space between "Your stats are:" and the Stats and it worked. But with the space it didn't. Please help me to realize why it won't ignore the return.


So the problem I think we're having (because I've been working on modifying the trigger to work with TFC with meh for success) is that it only gives the start line a single time (Your stats are). I tried setting the start line to register as line 1 and keep eveluating (Str: *. Int: *. etc) and am still having issues getting this to fire right. Can anyone help? My scripting skills are negligible but I'm trying! :P
#17
Ok, so here is a copy/paste of the tweaked code I have that isn't working...if anyone sees where they can point me in the proper direction...

I did try shifting it to include the .'s into the structure, but it rolled forever, so now trying to uninclude them.

Some of these tweaks are resultant of reading other threads to try to make this more efficient...

Using 4.27 still...would updating help? Maybe I should try that...though last time I tried my color triggers broke, heh...

-----------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, November 05, 2002, 5:34 PM -->
<!-- MuClient version 3.30 -->

<!-- Plugin "ScoreChecker" generated by Plugin Wizard -->

<muclient>
<plugin
name="ScoreChecker"
author="Nick Gammon"
id="e5035cb194f55fc466334012"
language="VBscript"
purpose="Checks stat rolls"
date_written="2002-11-05 17:32:55"
requires="3.27"
version="1.0"
>
<description trim="y">
<![CDATA[
This checks your stats (str, dex, wis etc.) and replies "Y" (to accept) if they are OK, and "N" (to reject) if not.

See:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1936

for more details.

]]>
</description>

</plugin>


<!-- Triggers -->

<triggers>
<trigger
custom_colour="1"
keep_evaluating="y"
enabled="y"
match="Str: *. Int: *. Wis: *. Dex: *."
script="OnStart"
sequence="1"
>
</trigger>
<trigger
custom_colour="3"
enabled="y"
group="scores"
match="Str: *. Int: *. Wis: *. Dex: *."
script="OnLine1"
sequence="1"
>
</trigger>
<trigger
custom_colour="4"
enabled="y"
group="scores"
match="Con: *. Chr: *. Luc: *. - Accept? (Y/N):"
script="OnLine2"
sequence="1"
>
</trigger>
</triggers>

<!-- Script -->


<script>
<![CDATA[
sub OnStart (sName, sLine, wildcards)
world.EnableGroup "scores", 1
end sub

'
' converts a word score into a number
'
function RateIt (score)

select case score
case "MAX" RateIt = 6
case "HIGH" RateIt = 5
case "AAVG" RateIt = 4
case "AVG" RateIt = 3
case "BAVG" RateIt = 2
case "LOW" RateIt = 1
case else RateIt = 0
end select

end function

sub OnLine1 (sName, sLine, wildcards)
'
' remember str, int, wis, dex for next time
'
world.SetVariable "str", "%1"
world.SetVariable "int", "%2"
world.SetVariable "wis", "%3"
world.SetVariable "dex", "%4"
end sub

sub OnLine2 (sName, sLine, wildcards)
dim str, int, wis, dex, con, chr, luc, ok

str = world.GetVariable ("str")
int = world.GetVariable ("int")
wis = world.GetVariable ("wis")
dex = world.GetVariable ("dex")
con = "%1"
chr = "%2"
luc = "%3"

ok = vbTrue

'
' see if it OK
'

if RateIt (str) < 2 then ok = vbFalse
if RateIt (int) < 2 then ok = vbFalse
if RateIt (wis) < 2 then ok = vbFalse
if RateIt (dex) < 2 then ok = vbFalse
if RateIt (con) < 2 then ok = vbFalse
if RateIt (chr) < 2 then ok = vbFalse
if RateIt (luc) < 5 then ok = vbFalse

'
' accept scores if ok
'

if ok then
world.send "Y"
else
world.send "N"
end if

world.EnableGroup "scores", 0
end sub


]]>
</script>


</muclient>
Australia Forum Administrator #18
I'm not a big fan of stat rollers these days because they can clog up the server with thousands of rolls.

Quote:

... that isn't working ...


Can you be more specific? What arrives? What happens?