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 » Tue Apr 09, 2013 1:52 pm

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 » Tue Apr 09, 2013 1:58 pm

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

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

Re: Mudlet features and API requests

Post by Vadi » Tue Apr 09, 2013 8:32 pm

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 » Tue Apr 23, 2013 2:15 pm

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 » Tue Apr 23, 2013 3:58 pm

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 » Tue Apr 23, 2013 9:07 pm

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

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

Re: Mudlet features and API requests

Post by Akaya » Tue Apr 23, 2013 9:13 pm

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: 4720
Joined: Sat Mar 14, 2009 3:13 pm

Re: Mudlet features and API requests

Post by Vadi » Tue Apr 23, 2013 9:44 pm

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: 4720
Joined: Sat Mar 14, 2009 3:13 pm

Re: Mudlet features and API requests

Post by Vadi » Wed Apr 24, 2013 5:41 am

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 » Sat Apr 27, 2013 11:37 pm

Awesome, thanks!

Post Reply

Who is online

Users browsing this forum: Kevenlync and 2 guests