Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Auto Roller - Help

Auto Roller - Help

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Fluffles   (3 posts)  Bio
Date Thu 16 Apr 2020 03:17 PM (UTC)

Amended on Sat 18 Apr 2020 01:27 AM (UTC) by Nick Gammon

Message
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>
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 18 Apr 2020 01:33 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #2 on Mon 20 Apr 2020 09:07 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fluffles   (3 posts)  Bio
Date Reply #3 on Sun 26 Apr 2020 11:28 AM (UTC)
Message
Thanks! got it working!
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,826 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.