Page 33 of 54

Re: Mudlet features and API requests

Posted: Tue Apr 09, 2013 1:52 pm
by Rakon
isActive() returns a 1 or 0. Considering in lua that 0 is not a Boolean false, isActive() should return true or false instead.

Example:

Code: Select all

local test = 0 
if test then echo ('not false') end
not false   -- Echoed.. ?? Why?
4554h, 4600m CxEK||HeSF -<08:33:43:487>  

local test = false
if test then echo ('not false') end
                   -- Nothing here.
4554h, 4600m CxEK||HeSF -<08:33:48:378> 

Re: Mudlet features and API requests

Posted: Tue Apr 09, 2013 1:58 pm
by Heiko
As a general rule there won't be any API changes to guarantee backward compatibility.

Re: Mudlet features and API requests

Posted: Tue Apr 09, 2013 8:32 pm
by Vadi
isActive returns the number of item(s) active. You can have more than one item with the same name in Mudlet, and the API is designed to work with that.

Re: Mudlet features and API requests

Posted: Tue Apr 23, 2013 2:15 pm
by Iocun
I would love a way to echo into the error console without actually raising an error with error(). Raising an actual error in Lua also aborts the process that called it, which I don't always want, so I'd love to be able to call a function with pcall() and simply print an error message to the console if it returned false, but without actually aborting anything.

Currently I either have to echo on the screen (which is too spammy), or write to an error log (which is more cumbersome to look things up in quickly).

Re: Mudlet features and API requests

Posted: Tue Apr 23, 2013 3:58 pm
by kevutian
Sending an arg to assert() does this, I recall, although that might just itself call error().

Re: Mudlet features and API requests

Posted: Tue Apr 23, 2013 9:07 pm
by Iocun
Yeah, I'm quite sure assert simply raises an error, and thus aborts the process too.

Re: Mudlet features and API requests

Posted: Tue Apr 23, 2013 9:13 pm
by Akaya
Another thing that would be great to have is a function that returns your current mouse cursor coordinates. The MousePress and MouseRelease events already give you that info when you click, but for some things (e.g. drag-and-drop of GUI elements) it would be useful to read the current mouse position at times where you aren't clicking too.
I'd like to see this too.

Re: Mudlet features and API requests

Posted: Tue Apr 23, 2013 9:44 pm
by Vadi
I agree on the error logging idea, something I wanted as well. The debugc function was actually supposed to do this, but it doesn't seem to work yet.

Re: Mudlet features and API requests

Posted: Wed Apr 24, 2013 5:41 am
by Vadi
Iocun wrote:I would love a way to echo into the error console without actually raising an error with error().
debugc() fixed with https://bugs.launchpad.net/mudlet/+bug/1172031

Re: Mudlet features and API requests

Posted: Sat Apr 27, 2013 11:37 pm
by Iocun
Awesome, thanks!