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.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Alias is too large

Alias is too large

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


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #15 on Sun 31 Mar 2019 06:56 AM (UTC)
Message
What I suggest you do is put the script into the world script file (not in "send to script" in the alias). Then just put the function name in the alias "Script" box. The function in the script file would look like this:


function myAlias (name, line, wildcards, styles)

-- your script here

end -- function


You would need some minor changes to the script. Instead of using %1 for the first wildcard (and so on) use:


wildcards [1]


The full matching line is stored in the "line" argument.

Apart from solving your problem, this will also be faster. If you use "send to script" the script has to be compiled by Lua every time it matches. This would tend to slow things down if it is long. If you use a script file the script is compiled once.

- Nick Gammon

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

Posted by Blixel   (80 posts)  Bio
Date Reply #16 on Mon 01 Apr 2019 10:41 PM (UTC)
Message
Nick Gammon said:

What I suggest you do is put the script into the world script file (not in "send to script" in the alias). Then just put the function name in the alias "Script" box.


This seems to work really well for my situation. I have 3 of these level grinding scripts so far.

Moving them to the script file definitely makes things a lot easier to read and maintain. And I haven't ran into any problems so far with other things breaking as a consequence (knock on wood).

Thanks for the tip.
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.


39,410 views.

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

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.