Auto Roller - Help

Posted by Fluffles on Thu 16 Apr 2020 03:17 PM — 4 posts, 17,504 views.

#0
Hey all, so I have minimal to zero knowledge of programming but I'm getting back into MUDs. I've been reading serval other forums on auto rollers and wanted to take a crack.

So based upon what I've read, I tried to mimic a lua string for my mud.

Basic MUD stats output:


Your abilities are:
  Str  [Weak       ]  Int  [Brilliant ]  Wis  [Above Avg   ]
  Dex  [Below Avg  ]  Con  [Below Avg ]  Cha  [Below Avg   ]
Roll again?(y/n): 


I keep getting this error:


Error number: 0
Event:        Compile error
Description:  [string "Script file"]:1: unexpected symbol near '<'
Called by:    Immediate execution



Below is the code I tried:

<triggers>
  <trigger
   ignore_case="y"
   lines_to_match="2"
   keep_evaluating="y"
   match="^  Str  \[(...........)\]  Int  \[(..........)\]  Wis  \[(............)\]\n  Dex  \[(...........)\]  Con  \[(..........)\] $"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>require "wait"

Str = Trim("%1")
Int = Trim("%2")
Wis = Trim("%3")
Dex = Trim("%4")
Con = Trim("%5")

YStr = "No"
YInt = "No"
YWis = "No"
YDex = "No"
YCon = "No"
YCha = "No"

if Str == "Strong" or 
   Str == "Potent" or 
   Str == "Muscular" or
then
   YStr = "Yes"
end

if Int == "Genius" or 
   Int == "Gifted" or 
then
   YInt = "Yes"
end

if Wis == "Shrewd" or
   Wis == "Crafty" or
then
   YWis = "Yes"
end

if Dex == "Agile" or
   Dex == "Nimble" or
   Dex == "Smooth" or
then
   YDex = "Yes"
end

if Con == "Sturdy" or
   Con == "Hardy" or
   Con == "Husky" or
then
   YCon = "Yes"
end

if YStr == "Yes" and 
   YInt == "Yes" and 
   YWis == "Yes" and 
   YDex == "Yes" and 
   YCon == "Yes" and 
   YCha == "Yes"
then 
    Send ("n")
else
    print ("** Stats rejected **  ", YStr, "  ", YInt, "  ", YWis, "  ",  YDex, "  ", YCon, "  ")
    DoAfter(0.25,"y")
end
</send>
  </trigger>
</triggers>
Amended on Sat 18 Apr 2020 01:27 AM by Nick Gammon
Australia Forum Administrator #1
Did you really copy and paste that as per this page?

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.



That trigger would never match because:

  • It is not enabled; and
  • You have a "$" at the end (after the Con stuff) and thus it wouldn't match on "Cha ... etc".



Assuming you fix that, this is wrong:


if Str == "Strong" or 
   Str == "Potent" or 
   Str == "Muscular" or
then
   YStr = "Yes"
end


You don't want that last "or", because it reads "or then". Ditto for elsewhere.
Australia Forum Administrator #2
Quote:

Description: [string "Script file"]:1: unexpected symbol near '<'


Actually that suggests that you have pasted the entire thing you showed above into the trigger "Send" box. For a trigger in XML (with <triggers> etc. in it) you need to follow this guideline:

Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


My earlier remarks still apply once you have done that.
#3
Thanks! got it working!