Mudlet features and API requests

Orlendr
Posts: 71
Joined: Thu May 12, 2011 11:04 pm

Re: Mudlet API requests

Post by Orlendr »

The Error box above a script/alias/trigger when there is an error, it would be nice if there was a way to copy and paste it as opposed to having to go back and forth in order to type it out...

Like this...
Lus syntax error:[string " local count = 0..."]:19: 'end' expected (to close 'for' at line 4) near"

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Mudlet API requests

Post by chris »

Or it could be optionally rerouted to the main console window. I'll look into that since I'd like my errors to be shown there

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Mudlet API requests

Post by Vadi »

importPackage() to import a zip/mpackage file
importMap() to import an MMP (the xml) map file. Or have loadMap take care of it as well as Mudlets format, whichever works.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Mudlet API requests

Post by Vadi »

An event for when the map is reloaded, so mapper scripts with update-reminding functionality can know if users updated their map.

Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: Mudlet API requests

Post by Darmir »

I would like to see a table.match function.
Syntax: table.match(s,pattern,var1,var2,...varN,varN+1)
--
test to see if string s matches the given Pattern. If it matches, the position of the match in the string is returned (starting with 1). If it doesn't match, zero is returned. The optional VarN arguments contain the names of variables to store any captured subpatterns (subpatterns surrounded by parenthesis). The additional VarN+1 variable name can be specified to hold the length of the matched pattern.

Example:
table.match("Joe says Hi","(\w+) says (.*)",Name,Message,X)
displays 1 and sets the Name variable to "Joe", the Message variable to "Hi" and the X variable to 12.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Mudlet API requests

Post by Vadi »

I'm not sure if that'll be very useful for common applications :/

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: Mudlet API requests

Post by Iocun »

Darmir wrote:I would like to see a table.match function.
Syntax: table.match(s,pattern,var1,var2,...varN,varN+1)
--
test to see if string s matches the given Pattern. If it matches, the position of the match in the string is returned (starting with 1). If it doesn't match, zero is returned. The optional VarN arguments contain the names of variables to store any captured subpatterns (subpatterns surrounded by parenthesis). The additional VarN+1 variable name can be specified to hold the length of the matched pattern.

Example:
table.match("Joe says Hi","(\w+) says (.*)",Name,Message,X)
displays 1 and sets the Name variable to "Joe", the Message variable to "Hi" and the X variable to 12.
You can do pretty much that with:
Code: [show] | [select all] lua
Name, Message = rex.match("Joe says Hi", "(\\w+) says (.*)")
Or if you prefer doing it with Lua patterns:
Code: [show] | [select all] lua
Name, Message = string.match("Joe says Hi", "(%a+) says (.+)")
If you also need the position of the match returned, simply add a rex.find or string.find after that as well.
I therefore don't see why a new function is needed, simply to combine match+find.

I also don't quite understand why you're calling it "table.match" when it operates on strings, not tables. Am I missing something there?

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Mudlet API requests

Post by Rakon »

Functions to get the html code of the currently selected line.

IE getHtml(window,linenumber) if no window, main is used. If no line number, then the last non ga or newline line is used. getHtml() would return the full html code of that line (exactly how copy html in the right context menu does) for further usage.

Gauroth
Posts: 22
Joined: Tue Sep 07, 2010 2:44 pm

Re: Mudlet API requests

Post by Gauroth »

The ability to search room names for an exact match would be helpful in certain cases. Perhaps a toggle to the existing searchRoom() function could be added to force only exact matches to be returned?

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Mudlet API requests

Post by chris »

Why can't you just iterate through the table returned for an exact match?

Post Reply