I'm attempting to create a crude tutorial through a gadget, but to do that I would like to both make use of synced controls, such as CreateUnit and TransferUnit while also being able to display dialog boxes that would only disappear after being clicked on. I've stumbled upon a problem however, as I don't know how to do the dialogs; how do I catch mouse clicks through a gadget?
I've tried looking through the wiki, but if the information is there then I've missed it.
Mouse clicks in LUA
Moderator: Moderators
Re: Mouse clicks in LUA
synced can write anything, but should be limited to synced reading.
unsynced can read anything, but should be limited to unsynced writing.
use send to unsynced function, and receive from synced functions, to communicate between unsynced and synced, to draw the box, i will explain later.
unsynced can read anything, but should be limited to unsynced writing.
use send to unsynced function, and receive from synced functions, to communicate between unsynced and synced, to draw the box, i will explain later.
Re: Mouse clicks in LUA
to make the box make an xyz point 2d array like this:
box = {}
box[1] = {0,0,0}
box[2] = {0,0,8}
box[3] = {0,60,6}
box[4] = {0,9000,5637374383}
(just examples)
use the mouse click calls to find out the position, to check if it is in the box, do a bunch of checks with the position.
box = {}
box[1] = {0,0,0}
box[2] = {0,0,8}
box[3] = {0,60,6}
box[4] = {0,9000,5637374383}
(just examples)
use the mouse click calls to find out the position, to check if it is in the box, do a bunch of checks with the position.
Re: Mouse clicks in LUA
I would assume I would have been able to make a box either way, but what I'd need is what function I have to use to actually catch the mouse clicks?
Re: Mouse clicks in LUA
Code: Select all
local callInLists = {
'Shutdown',
'Update',
'TextCommand',
'CommandNotify',
'AddConsoleLine',
'ViewResize',
'DrawScreen',
'KeyPress',
'KeyRelease',
'MousePress', <-
'MouseWheel', <-
'IsAbove',
'GetTooltip',
'GroupChanged',
'CommandsChanged',
'TweakMousePress',
'TweakMouseWheel',
'TweakIsAbove',
'TweakGetTooltip',
Re: Mouse clicks in LUA
I should have checked a few more things before asking really, but thank you for that, should be all I need.
Re: Mouse clicks in LUA
That looks like the widget list, are you sure that works in gadgets?
Re: Mouse clicks in LUA
LuaGadgets have no access to the mouse at all (neither pos nor buttons)
period
(tip: use Spring.SendLuaRulesMsg() in a widget)
period
(tip: use Spring.SendLuaRulesMsg() in a widget)
Re: Mouse clicks in LUA
I worked on a tutorial for some time. My solution was to make both a gadget and a widget. The gadget sends events to the widget when needed.
Here are my files: http://trac.caspring.org/browser/trunk/mods/ca-tutorial
Don't try to run them though, the tutorial doesn't work in .76.
Here are my files: http://trac.caspring.org/browser/trunk/mods/ca-tutorial
Don't try to run them though, the tutorial doesn't work in .76.