PDA

View Full Version : Help with custom quickslots


aens
03-24-2011, 08:25 AM
Hey!

Last night I did some first time ever experiementing with Lua and so far I've done a script that prints "Hello world" every 5 minutes (now how cool it that? :p). Now I would want it to do an emote, but I'm struggling with the lack of help from LuaDocumentation, other plugins that does that same kind of a thing or anywhere else in the web. Do you have to use custom quickslots made with Lua, aliases or can you just enter /emote somewhere?

Question goes: is that kind of a system possible?

I found this comment from another thread:
I guess the only way to write to chat is to make quickslot, then set a command alias for it in Lua. The user has to click it himself though for the text to be pasted into chat.

-Chiran
So must you click the quickslot to make it fire or can you make the code fire the quickslot for you?

lunarwtr
03-24-2011, 09:19 AM
those sort of actions cannot be performed via lua (I assume to prevent people from writing bots). You need user interaction, hence the quickslot. You can get creative with it though...


create quickslot
place it behind an image icon
set a timer to highlight the image (so it flashy the user) ever 5 minutes to indicate they need to click it to get another pellet.

Digital_Utopia
03-25-2011, 02:41 AM
Sadly no - that's not possible, as you can't send chat commands with Lua - only print things out to the chat window.

You can however create a quickslot that will perform an emote, but again, since it's not part of Lua (it uses the macro system) you won't be able to do it at a set interval.

aens
03-26-2011, 11:30 AM
Sadly no - that's not possible, as you can't send chat commands with Lua - only print things out to the chat window.

You can however create a quickslot that will perform an emote, but again, since it's not part of Lua (it uses the macro system) you won't be able to do it at a set interval.

I don't get it. You can perform emotes with Lua (with quickslots, yes), but you can't do it at a set interval. How is that protected? If I can print "Hello world" every 5 minutes, setting the interval to a function containing "Turbine.Shell.WriteLine "Hello world";", can't you put the "use quickslot" code inside that function and make it work that way?

Garan
03-26-2011, 01:29 PM
I don't get it. You can perform emotes with Lua (with quickslots, yes), but you can't do it at a set interval. How is that protected? If I can print "Hello world" every 5 minutes, setting the interval to a function containing "Turbine.Shell.WriteLine "Hello world";", can't you put the "use quickslot" code inside that function and make it work that way?

The text written to the standard channel by the WriteLine method does not get processed by the chat window, i.e. no "/" commands actually get run, the text is just output, unprocessed, to your chat window, and ONLY your chat window, no one else sees the text. So, you can't actually "perform" emotes programmatically, all you can do is change the alias in the Lua quickslot so that the next time the user clicks the Lua quickslot the alias is processed (and if it is an emote, the emote is performed). Additionally, the quickslots we can change are those that are created as part of a Lua plugin, NOT to be confused with the Quickslot bars that are part of the UI - we have no control over the built-in Quickslot bars via Lua.

When using an icon to cover a quickslot, remember to SetMouseVisible(false) on the icon so that mouse clicks get passed through to the shortcut. It also helps to put the quickslot inside another additional container Control, size the quickslot larger than it's container and position it at negative coordinates so that the ugly text part of the quickslot is hidden from any transparent portions of your image. Also be sure to set dragdrop(false) on the quickslot if you don't want your users overriding your alias and add a MouseLeave event handler that resets the alias since even with dragdrop(false), the user can still drag the alias out of the quickslot.

Digital_Utopia
03-26-2011, 07:13 PM
I don't get it. See, that's just it - you can't do emotes with Lua. You can create quickslots and you can display text in the chat panel, but you can't send any commands. So yes, you can display "Hello World" every 5 minutes, but if you attempt to do that with "/bow" - all you will see is the text "/bow" instead of the emote being performed