View previous topic :: View next topic |
Author |
Message |
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Tue May 24, 2016 4:53 am Post subject: Possible to use TShortCutDialog,TShortCutGrabBox with Lua? |
|
|
Just to confirm, these classes and their functions are not exposed to CE's lua engine thus it's not possible for me to create new ones and use them, right?
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue May 24, 2016 5:35 am Post subject: |
|
|
There are handy Lua functions allowing you to write your own.
quick&dirty example:
Code: | function userPressedKey(sender, key)
if userDefinedHotkey[4]==0 then
for i=1,4 do
if userDefinedHotkey[i]==0 then
userDefinedHotkey[i]=key
break
else
if userDefinedHotkey[i]==key then break end
end
end
end
UDF1.CEEdit1.Text=convertKeyComboToString(userDefinedHotkey)
return 0
end
UDF1.CEEdit1.OnKeyDown = userPressedKey
function clearHotkey()
userDefinedHotkey={0,0,0,0}
UDF1.CEEdit1.Text=convertKeyComboToString(userDefinedHotkey)
UDF1.CEEdit1.setFocus()
end
UDF1.CEButton1.OnClick = clearHotkey
function redefineHotkeyKeys()
if myHotkey==nil then return end
myHotkey.setKeys(userDefinedHotkey[1],userDefinedHotkey[2],
userDefinedHotkey[3],userDefinedHotkey[4])
end
UDF1.CEButton2.OnClick = redefineHotkeyKeys
userDefinedHotkey={0,0,0,0} |
Example CT below
Description: |
|
Download |
Filename: |
hotkey manuallyset.CT |
Filesize: |
1.72 KB |
Downloaded: |
604 Time(s) |
_________________
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Tue May 24, 2016 5:46 am Post subject: |
|
|
Dark Byte wrote: | No, ce doesn't even include the unit that defines TShortCutDialog so it can't even register it at all.
But TShortCutGrabBox should be able to do. (part of the property editor) |
How can I go about creating TShortCutGrabBox?
Do I have to expose the class in LuaHandler.pas and compile my own CE?
Thanks
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Tue May 24, 2016 5:54 am Post subject: |
|
|
yes, you'll have to compile your own CE
TShortCutGrabBox doesn't publish the key and shiftcode variables, so lua can't see them. (so even if you spawn it, it'd be useless for your lua code)
To be able to see them you have to create your own class that publishes those fields
check out cegui.pas for some examples.
Also, once registered, you can use the new createComponentClass function (new in git) to create it from lua without having to write code in luahandler or a new unit
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Tue May 24, 2016 6:01 am Post subject: |
|
|
Guess i'll write my own functions then. Thinking of making a hotkey configurator to set hotkey for any menu item in CE. Thanks @ mgr.inz & DB
|
|
Back to top |
|
|
|