Mudlet features and API requests

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

Re: Mudlet features and API requests

Post 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> 

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Mudlet features and API requests

Post by Heiko »

As a general rule there won't be any API changes to guarantee backward compatibility.

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

Re: Mudlet features and API requests

Post 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.

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

Re: Mudlet features and API requests

Post 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).

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: Mudlet features and API requests

Post by kevutian »

Sending an arg to assert() does this, I recall, although that might just itself call error().

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

Re: Mudlet features and API requests

Post by Iocun »

Yeah, I'm quite sure assert simply raises an error, and thus aborts the process too.

User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: Mudlet features and API requests

Post 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.

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

Re: Mudlet features and API requests

Post 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.

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

Re: Mudlet features and API requests

Post 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

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

Re: Mudlet features and API requests

Post by Iocun »

Awesome, thanks!

Post Reply