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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Index of Lua functions, events, and globals?

Index of Lua functions, events, and globals?

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


Posted by Tesagk   (52 posts)  [Biography] bio
Date Sat 02 Jul 2016 12:17 PM (UTC)
Message
Hello! It's been awhile since I've posted here.

I remember asking something about Mudlet LUA and I got this awesome link to a page describing the function. However, and I know this is user-error, not a fault with site navigation, I'm having trouble finding an index I can bookmark which displays all of the functions, globals, and events.

One of the things that has held me back from using MUSHclient more is that I don't know how to work within its own LUA code.

I use Mudlet for my main game, a MUD.

My own LUA skills are... "eh", but, fortunately, I have a lot of good help from another player of the MUD who has spent a lot of time making scripts for the game that everyone can use. Similarly, I have invested a much smaller amount, but enough that I can do most things if I bang my head against the wall enough.

I have no such support for MUSHclient, and, as mentioned, am having a difficult time finding a page like this: ( http://wiki.mudlet.org/w/Manual:Lua_Functions ).

One of the things I'll probably have the most difficulty with, but really need to find resources for if I'm going to set MUSHclient up the way I like it, is interacting with the GUI: making buttons (and tabs), windows, etc... but, in general, I really don't know what functions do a lot of even the most basic things.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 02 Jul 2016 08:29 PM (UTC)

Amended on Sat 02 Jul 2016 08:56 PM (UTC) by Nick Gammon

Message
I've put a lot of work into documenting and cross-referencing the various scripting functions. A good starting point is the main documentation page:

http://www.gammon.com.au/scripts/doc.php

That groups functions into the various sections (eg. relating to triggers, aliases, etc.)

Then there is an alphabetic function list:

http://www.gammon.com.au/scripts/doc.php?general=function_list

These same pages are available inside the client using the Help menu as they are generated from the same database.

In particular, if you press Ctrl+Alt+Shift+L you see a dialog box that lets you filter down to particular function names (or wildcard, eg. "trigger").

World functions


For historical reasons, the functions basically fall into two categories:


  • "World" functions, which are in the "world" table (note all lower-case). These are available to all supported scripting languages (eg. Lua, VBscript, Jscript, Python)

  • Lua-only functions. In particular the "normal" Lua libraries like "string", "table", "math" are all there, and work the same as described in the Lua Reference Manual. They are also documented by me, eg. http://www.gammon.com.au/scripts/doc.php?general=lua_string

    In addition to the standard Lua libraries, some extra functionality is provided by a few extra Lua libraries, such as the lpeg, bc, rex (PCRE regular expression), utils, luacom, and sqlite3 libraries.


Almost all of these are also documented in the built-in help (I can't find luacom in the help, but see http://www.gammon.com.au/forum/?id=6022 for more details about that).

Window manipulation



Quote:

I ... really need to find resources for if I'm going to set MUSHclient up the way I like it, is interacting with the GUI: making buttons (and tabs), windows ...


Initially the client only had limited support for buttons, etc. because it was a text client. A while back "miniwindows" were introduced which gave extra support for areas of the client window that could be used for status bars, inventory, mapper, etc.

For a lengthy tutorial and reference, see: http://www.gammon.com.au/mw

There are quite a few examples of miniwindows in use in the Miniwindows part of this forum.


Callbacks


Another part of the documentation worth exploring is the callbacks section, in particular plugin callbacks:

http://www.gammon.com.au/scripts/doc.php?general=plugin_callbacks

By supplying certain functions inside a plugin you can have the client "call back" to let you know something has happened, for example, you are about to send something to the server, you have just connected, the mouse has moved, etc.

- Nick Gammon

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

Posted by Tesagk   (52 posts)  [Biography] bio
Date Reply #2 on Sun 03 Jul 2016 01:04 AM (UTC)
Message
Thanks for the reply. The links will be helpful and your response has been so thorough! :)
[Go to top] top

Posted by Tesagk   (52 posts)  [Biography] bio
Date Reply #3 on Mon 08 Aug 2016 12:57 PM (UTC)
Message
The documentation is incredibly thorough. However, right now, as I'm going through it, I'm having difficulty finding how to reference a pattern match (right now, specifically in an alias, but I should know about how to do triggers as well).

In my alias, I had an if statement as follows: if %1 == "all", however, I get an unrecognized symbol error.


<aliases>
  <alias
   match="^dt(?:/(all))?"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if %1 == "all" then
  Send("cast 'detect invis'")
  Send("cast 'detect hidden'")
  Send("cast 'detect evil'")
  Send("cast 'detect good'")
else
  Send("cast 'detect invis'")
  Send("cast 'detect hidden'")
end</send>
  </alias>
</aliases>
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Mon 08 Aug 2016 02:42 PM (UTC)

Amended on Mon 08 Aug 2016 02:43 PM (UTC) by Fiendish

Message
Quote:
if %1 == "all"

That needs to at least be
if "%1" == "all"


This is a dirty, dark, not well understood or explained corner of MUSHclient scripts and plugins. %1,%2,etc replacements are done by the XML parser long before the code ever gets to the Lua script engine, and that has a few significant effects like requiring quotation marks around things that are meant to be strings and special care for symbols like < and > if not wrapped by CDATA tags.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Tesagk   (52 posts)  [Biography] bio
Date Reply #5 on Mon 08 Aug 2016 03:00 PM (UTC)
Message
I'll have to do my best to learn these rules then. Thank you.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Mon 08 Aug 2016 08:23 PM (UTC)
Message
Fiendish said:

This is a dirty, dark, not well understood or explained corner of MUSHclient scripts and plugins.


Apart from FAQ 32.

Template:faq=32 Please read the MUSHclient FAQ - point 32.

- Nick Gammon

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

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #7 on Tue 09 Aug 2016 04:47 PM (UTC)
Message
Nick Gammon said:

Fiendish said:

This is a dirty, dark, not well understood or explained corner of MUSHclient scripts and plugins.


Apart from FAQ 32.

(faq=32)

I meant the reason behind why it happens that way. :)
( xml parsing -> substitution -> handoff to script engine )

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Tesagk   (52 posts)  [Biography] bio
Date Reply #8 on Tue 09 Aug 2016 05:03 PM (UTC)
Message
Nick Gammon said:

Fiendish said:

This is a dirty, dark, not well understood or explained corner of MUSHclient scripts and plugins.


Apart from FAQ 32.

(faq=32)


Which I had thought to check out the FAQ.

I did a number of mushclient google searches trying to figure out what mushclient used for its matching-capture variable.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Tue 09 Aug 2016 08:54 PM (UTC)
Message
Fiendish said:

( xml parsing -> substitution -> handoff to script engine )


The XML parsing is done at serialization time, but I take your point.

Certainly there are lots of things I would improve if I ever wrote a new client.




Going back into the dim past, the substitution was done before scripting was even implemented. And initially scripting was only done in a script file (with the function name in the trigger). More recently there was "send to script" and the possibility of this sort of confusion. Plus the annoyance of having to double the number of backslashes, and double the number of "%" symbols if you don't want them to be a wildcard expansion.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


23,530 views.

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]