Thread: onHotKeyActivated problem
-
November 23rd, 2010, 22:05 #1
onHotKeyActivated problem
I have two problems with this function.
Problem 1. It seems the documentation mentions it twice by mistake here.
onHotKeyActivated
handler function onHotKeyActivated( dragdata )
The functions registered on this handler will be called whenever a hot key is pressed.
Parameters
dragdata (dragdata)
A dragdata object containing the state of values connected to the depressed hot key.
onHotKeyDrop
handler function onHotKeyDrop( dragdata )
The functions registered on this handler will be called whenever an object is dropped on the hot key bar.
Parameters
dragdata (dragdata)
A dragdata object containing the state of values connected to the mouse cursor as part of a drag and drop operation.
onHotkeyActivated
handler function onHotkeyActivated( draginfo )
The functions registered on this handler will be called whenever a hot key bar slot is activated. This allows the processing of custom drag types and context specific special operation.
Parameters
draginfo (dragdata)
The dragdata object representing the contents of the activated hot key bar slot
Problem 2. I have a sample ext that I wrote using the above functions:
Code:function onInit() if ChatManager then --ChatManager.registerSlashHandler("/KeyDmp", KeyDmp); print ("ETUtility Loaded") end end function onHotKeyActivated( myData ) print("ETUtility Hotkey Pressed") print(myData) ChatManager.addMessage(myData) return true; end function onHotKeyDrop( myData ) print("ETUtility Hotkey Dropped") print(myData) ChatManager.addMessage(myData) return true; end function onHotkeyActivated( myData ) print("ETUtility Hotkey Activated") print(myData) ChatManager.addMessage(myData) return true; end
Is there something I am missing?'Build it and they will come'
Universal Table Rolling Get it HERE
FG2 Help Files Get it HERE
Getting the Most Out of Notepad++ (FG2 & Lua spellcheck & Auto-Completion) Get it HERE
Printing the contents of a table Get it HERE
-
November 23rd, 2010, 23:53 #2
I think the mistake is in the duplicate naming, the first function should really be named as onHotKeyPressed() or similar.
Anyhow, these I believe are Event handlers meaning to utilise you need to 'register' functions to handle the events or putting it another way, override the default event handlers with your own functions in onInit() e.g. something like:
Code:function onInit() if ChatManager then ChatManager.registerSlashHandler("/KeyDmp", KeyDmp); print ("ETUtility Loaded") end Interface.onHotKeyActivated = myonHotKeyActivated; Interface.onHotKeyDrop = myonHotKeyDrop; Interface.onHotkeyActivated = myonHotkeyActivated; end function myonHotKeyActivated( myData ) print("ETUtility Hotkey Pressed") print(myData) ChatManager.addMessage(myData) return true; end function myonHotKeyDrop(myData) print("ETUtility Hotkey Dropped") print(myData) ChatManager.addMessage(myData) return true; end function myonHotkeyActivated(myData) print("ETUtility Hotkey Activated") print(myData) ChatManager.addMessage(myData) return true; end
Last edited by Zeus; November 23rd, 2010 at 23:56.
FG Project Development
Next Project(s)*: Starfinder v1.2 Starship Combat
Current Project: Starfinder v1.1 - Character Starships
Completed Projects: Starfinder Ruleset v1.0, Starfinder Core Rulebook, Alien Archive, Paizo Pathfinder Official Theme, D&D 5E data updates
* All fluid by nature and therefore subject to change.
-
November 24th, 2010, 02:17 #3
It did not like the use of:
Interface.onHotKeyActivated = myonHotKeyActivated;
Interface.onHotKeyDrop = myonHotKeyDrop;
Interface.onHotkeyActivated = myonHotkeyActivated;Script Error: [string "scripts/ETUtility.lua"]:7: attempt to set a value for an invalid handler 'onHotKeyActivated''Build it and they will come'
Universal Table Rolling Get it HERE
FG2 Help Files Get it HERE
Getting the Most Out of Notepad++ (FG2 & Lua spellcheck & Auto-Completion) Get it HERE
Printing the contents of a table Get it HERE
-
November 24th, 2010, 06:05 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
The handler options are: onHotkeyDrop and onHotkeyActivated.
Make sure you have the right capitalization.
Cheers,
JPG
-
December 17th, 2010, 04:14 #5
That worked... I will make sure the capitalization is corrected in the helpfiles I am creating.
'Build it and they will come'
Universal Table Rolling Get it HERE
FG2 Help Files Get it HERE
Getting the Most Out of Notepad++ (FG2 & Lua spellcheck & Auto-Completion) Get it HERE
Printing the contents of a table Get it HERE
-
December 28th, 2010, 22:28 #6
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Can we get the documentation fixed for the duplicate functions?
-
December 29th, 2010, 22:28 #7
I let them know about it already. In the meantime, I have fixed it in my Unified Help Files.
I actually found about 5 errors so far.
https://www.fantasygrounds.com/forum...ad.php?t=13849'Build it and they will come'
Universal Table Rolling Get it HERE
FG2 Help Files Get it HERE
Getting the Most Out of Notepad++ (FG2 & Lua spellcheck & Auto-Completion) Get it HERE
Printing the contents of a table Get it HERE
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks