[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Strange problem with Reroll Script

Strange problem with Reroll Script

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


Pages: 1 2  

Posted by Invictus84   USA  (6 posts)  [Biography] bio
Date Fri 29 Jun 2007 06:56 AM (UTC)

Amended on Fri 29 Jun 2007 08:12 AM (UTC) by Invictus84

Message
Below is my basic version of a Realms of Despair reroll script. It'll roll fine for a few minutes, then halt with this error:

Error number: 0
Event:        Compile error
Description:  [string "Trigger: "]:1: unexpected symbol near '>='
Called by:    Immediate execution


Usually, I can manually reroll, type gold to set the stat check off and off it'll go again... for another few minutes, before halting again with the same thing.

Any help is greatly appreciated :)

PS. If it means anything to anyone, I'm using version 4.12.
PPS. Below here is that code I promised :P

<code>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="Strength              * *"
   send_to="9"
   sequence="1"
   variable="str"
  >
  <send>%1</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="Dexterity             * *"
   send_to="9"
   sequence="15"
   variable="dex"
  >
  <send>%1</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="Intelligence          * *"
   send_to="9"
   sequence="30"
   variable="int"
  >
  <send>%1</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="Wisdom                * *"
   send_to="9"
   sequence="45"
   variable="wis"
  >
  <send>%1</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="Charisma               * *"
   send_to="9"
   sequence="60"
   variable="cha"
  >
  <send>%1</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="Constitution          * *"
   send_to="9"
   sequence="75"
   variable="con"
  >
  <send>%1</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="Luck                  * *"
   send_to="9"
   sequence="90"
   variable="lck"
  >
  <send>%1</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="* You have * gold pieces."
   send_to="12"
   sequence="100"
  >
  <send>if @str &gt;= 18 and @dex &gt;= 18 and @int &gt;= 9 and @wis &gt;= 9 and @cha &gt;= 9 and @con &gt;= 9 and @lck &gt;= 16 then
Execute ("pull cord;save;save;quit")
return
end

if @str &lt; 18 or @dex &lt; 18 or @int &lt; 9 or @wis &lt; 9 or @cha &lt; 9 or @con &lt; 9 or @lck &lt; 9 then
Execute ("reroll;gold")
return
end</send>
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   match="If you know well the ways of this world, *, simply type: EXPERIENCED"
   sequence="100"
  >
  <send>help start
config +brief
config +nointro
config +beckon
experienced
get all sack
wear all
u
'path of the peaceful
nw</send>
  </trigger>
  <trigger
   back_colour="8"
   enabled="y"
   expand_variables="y"
   keep_evaluating="y"
   match="You have * gold pieces."
   match_back_colour="y"
   match_text_colour="y"
   send_to="12"
   sequence="100"
   text_colour="11"
  >
  <send>if @str &gt;= 18 and @dex &gt;= 18 and @int &gt;= 9 and @wis &gt;= 9 and @cha &gt;= 9 and @con &gt;= 9 and @lck &gt;= 16 then
Execute ("pull cord;save;save;quit")
return
end

if @str &lt; 18 or @dex &lt; 18 or @int &lt; 9 or @wis &lt; 9 or @cha &lt; 9 or @con &lt; 9 or @lck &lt; 9 then
Execute ("reroll;gold")
return
end</send>
  </trigger>
</triggers>
[Go to top] top

Posted by Invictus84   USA  (6 posts)  [Biography] bio
Date Reply #1 on Fri 29 Jun 2007 07:10 AM (UTC)

Amended on Fri 29 Jun 2007 08:14 AM (UTC) by Invictus84

Message
Some things I guess I should note... Yes, there is a duplicate trigger (the gold trigger) :) Sometimes, the return message from typing gold shows up on the prompt line, so I had to duplicate it with an asterisk at the beginning to account for it showing up on my prompt line.

Secondly, everything was carried out through the GUI. I'm a bit of a coding newb, so it was easier on my aching head to just input what code was needed to carry out a few functions and let MUSHclient input the rest for me :)

For anyone that may not have seen RoD's reroll output, looks like this:

Your character's base stats have been rerolled...
                     New             Previous
Strength              17                   15
Dexterity             14                   17
Intelligence          15                   15
Wisdom                14                   11
Charisma              10                    9
Constitution          14                   14
Luck                  11                   14


Sometimes the "Your character's base stats have been rerolled..." line appears on my prompt line, so I try to avoid using it as part of the triggers set.

One last thing, while I was typing this, I was letting it roll to see if it'd do anything different, and wouldn't you know it... it did. It happened to roll 18 strength and dex, however the luck was terrible (I have it set to look for 18 str/dex, 16lck) and instead of rerolling it or even trying to keep it, since two of the stats matched, it just stopped. No error message or anything, just sat there :|

Hope these bits help :)
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #2 on Fri 29 Jun 2007 08:03 AM (UTC)

Amended on Fri 29 Jun 2007 08:05 AM (UTC) by Shaun Biggs

Message
Can you give a list of the stats stored in the variables when the script crashes? Might give some idea of what it's trying to match that's failing. Also, if you could post the code within [code] tags, we could check for excess spaces easier, since the forums normally just eat them in display.

This is why I hate random roll generation... just begs to have people script a bot to get good stats. Not that I can really complain much, as I'd do the same thing.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 29 Jun 2007 08:08 AM (UTC)
Message
Considering your trigger basically does this:


if @str >= 18 and @dex >= 18 ... and so on



... and your error message is "unexpected symbol near '>='", then I am guessing that the variables contain something unusual.

I would put in a debugging display, like:


Note ("str = @str, dex = @dex" )


(and do on), so you can see what the variable is, at the time it fails.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Fri 29 Jun 2007 08:11 AM (UTC)
Message
Quote:

It happened to roll 18 strength and dex, however the luck was terrible ...


I think I have worked out in the past, that to get a good score on everything you probably have to spend thousands of hours of server time. Quite apart from the load on the MUD, you will have a long wait.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Invictus84   USA  (6 posts)  [Biography] bio
Date Reply #5 on Fri 29 Jun 2007 08:47 AM (UTC)

Amended on Fri 29 Jun 2007 08:48 AM (UTC) by Invictus84

Message
I just watched it run for a few minutes and kept checking the variables, see if they were pulling the correct numbers and what have you... and here's the odd part - Some of them come back blank every so often, and at that point the script shoots back that error message. So, I think that in itself is the cause. Can't check A against B if A doesn't contain anything.

Unfortunately, still leaves me a bit lost. Something is obviously is going awry in the capture, but what? It's left me more than slightly confused :p Still unsure why it just stopped that one time, maybe it'll go away on it's own when the bigger issue gets taken care of.

And yeah, the reroll system has cursed all of us players who try to actively play. I've been known to have 4 and 5 rerolling characters going at the same time for in excess of 2 weeks at a time, waiting for just one to come out with stats I want.
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #6 on Fri 29 Jun 2007 09:38 AM (UTC)
Message
I think I figured it out and how to solve the problem. Does it crash out when a stat is rolled that's below 10? The single digit stats look like they have different spacing, so the trigger might not pick them up. You can fix this with a regex trigger match like this:

match="^Strength/w+(/d+).+"

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #7 on Fri 29 Jun 2007 09:43 AM (UTC)
Message
Quote:
And yeah, the reroll system has cursed all of us players who try to actively play. I've been known to have 4 and 5 rerolling characters going at the same time for in excess of 2 weeks at a time, waiting for just one to come out with stats I want.

Doing some quick math, that's about 2000 hours put in for character creation just rolling stats. If I were the person running a mud that worked like this, I think I'd code in a way to limit rerolls to 100 per IP address per day. Or just give up and make it some sort of point based system to completely cut down on people wasting the server's processing power and bandwidth with something so inane.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Fri 29 Jun 2007 09:45 AM (UTC)
Message
I think Shaun is right. A trigger like this:


Match: "Intelligence          * *"


... has very specific spacing. One space more or less and it won't match. I would do what he suggests and make a regexp to match an indefinite number of spaces.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Fri 29 Jun 2007 09:49 AM (UTC)
Message
Quote:

I've been known to have 4 and 5 rerolling characters going at the same time for in excess of 2 weeks at a time, waiting for just one to come out with stats I want.


Message to MUD admins: I have suggested it before, and I'll suggest it again. If you are wondering where all your network bandwidth, and CPU power is going, it is your random stats system.

I suggest you replace random stats with fixed stats (perhaps fixed per class/race) so there is no point in using stats rollers. You could give players a "pool" of extra stats to distribute as they see fit, so everyone doesn't start with exactly the same stats (although that is exactly what World of Warcraft does -simply allocates fixed stats based on the class you choose to play).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Isthiriel   (113 posts)  [Biography] bio
Date Reply #10 on Fri 29 Jun 2007 01:51 PM (UTC)

Amended on Fri 29 Jun 2007 01:53 PM (UTC) by Isthiriel

Message
Realms of Despair used to have a name-munger so your choice of name predetermined the stats you'd start with. Not that that mattered very much on RoD with the number of stat boosters floating around.

... though, on reflection, since RoD is the reference implementation of Smaug that is probably something that everyone already knows. *sigh*
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #11 on Fri 29 Jun 2007 02:00 PM (UTC)
Message
All that did was get people to create charts of which letters in which positions gave you which stats. It became a game of picking the right name to get good stats while being able to pass off the name as a "natural" one.

IMHO any kind of randomness in character development is a bad idea. It either encourages this kind of repetitive stat hammering to get a good dice roll, or it creates unfairness which over time can cumulate to big differences in ability (e.g. a few points in constitution, compounded over 45 level gains, can make for a good number of hit points).

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Invictus84   USA  (6 posts)  [Biography] bio
Date Reply #12 on Fri 29 Jun 2007 09:48 PM (UTC)
Message
As suggested, I went back and converted all the capture triggers to regular expressions. I also put in the full spacing for each return message from reroll and so far, it's been rolling on it's own for quite a while without a single stop, so I think that's got it :)

Thanks everyone for the help, it's greatly appreciated :)
[Go to top] top

Posted by Nick Gammon   Australia  (22,966 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Fri 29 Jun 2007 10:09 PM (UTC)
Message
It's quite funny to think that if the MUD admins ever did a profile on their code usage it might look like this:


Players fighting and walking around: 1%
Players spending weeks rerolling for better stats: 99%


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Antwon00   (1 post)  [Biography] bio
Date Reply #14 on Tue 13 Sep 2011 11:55 PM (UTC)
Message
What would the finished product of this script be. I am not a savvy computer expert in any way but would like to use this script for realms. Thanks for the assistance.
[Go to top] 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.


45,453 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]