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 ➜ Weird error from alias

Weird error from alias

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


Posted by Xandler   (52 posts)  Bio
Date Sun 13 Jun 2021 03:06 PM (UTC)

Amended on Sun 13 Jun 2021 07:56 PM (UTC) by Nick Gammon

Message
Not sure quite where to post this, if this is the wrong spot, please move it to the correct area. Anyway, to my error.

I recently made an alias for withdraw/deposit on a mud I play, and sometimes when I'm chatting with people, I get strange errors: for example it errored on this and the message it gave is below that.

snet any good mobs with kame beside bardock and the prison guard?


Run-time error
World: Dragonball Evolution
Immediate execution
[string "Alias: "]:1: attempt to perform arithmetic on global 'kame' (a nil value)
stack traceback:
        [string "Alias: "]:1: in main chunk



I know it's due to this particular alias because I disabled it and typed that it went through re-enabled and it didn't.

The alias(es) is as follows:


<aliases>
  <alias
   match="(with|dep) (.*?)b"
   enabled="y"
   expand_variables="y"
   group="withdraw/deposit"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Send ("%1 " .. (%2 * 10000000))</send>
  </alias>
  <alias
   match="(with|dep) (.*?)m"
   enabled="y"
   expand_variables="y"
   group="withdraw/deposit"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Send ("%1 " .. (%2 * 1000000))</send>
  </alias>
  <alias
   match="bid (.*?)m"
   enabled="y"
   expand_variables="y"
   group="withdraw/deposit"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>Send ("bid " .. (%1 * 1000000))</send>
  </alias>
</aliases>


Can anyone tell me how I can fix this random error, or how to better write an alias for this?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 13 Jun 2021 08:01 PM (UTC)

Amended on Sun 13 Jun 2021 10:39 PM (UTC) by Nick Gammon

Message
Quote:


any good mobs with kame beside bardock and the prison guard?
              ^^^^^^^^^^^



The line you sent matches the alias for withdraw/deposit. You need to make the alias more specific, such as making it match on, say, "!withdraw". Or you could test the wildcard 2 and see if it is a number.

Or maybe make the "with" part match the start of the line, eg.


^(with|dep) (.*?)b


Now it won't match "with" in the middle of a line.

And make it match numbers, and nothing after the "b" like this:


^(with|dep) ([0-9]+)b$

- Nick Gammon

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

Posted by Xandler   (52 posts)  Bio
Date Reply #2 on Mon 14 Jun 2021 12:43 AM (UTC)
Message
Awesome, thanks for the reply! I will try both of your solutions to see if that makes it foolproof.
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.


8,735 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.