Post by X-Drop on Dec 11, 2005 21:08:50 GMT -5
Ok, so I've only been messing with these scripts for a little over a week now. And now I'm kinda wondering if there is an easier way of having a hot key perform a funciton.
I call functions in my script for just about everything. They seem to be the bread and butter of my scripting.
As for hot keys, they are so damn useful for allowing instant user input.
Now for the moment, I use the hot key to send a command to Lunar. I suppose thats all you can get a hot key to do? So now to perform a function based on that command, I have to do a few things:
This method of calling a function with a hot key is sufficent. However, the draw back is I need to insert a function to check for the hot key many times throughout the main loop of the script. So then my main loop has the function, HotKeyCheck(), as every other function just to be sure the user hasn't pressed [F1] or whatever.
My question then is this, is there any way to directly perform a function through the use of hotkeys?
ie. > Control.control_BindKey("F2",true,false,false,".Lunar command Leviathan.lua MenuMode()")
And if this is currently not possible, can it be worked into Lunar somehow?
I call functions in my script for just about everything. They seem to be the bread and butter of my scripting.
As for hot keys, they are so damn useful for allowing instant user input.
Now for the moment, I use the hot key to send a command to Lunar. I suppose thats all you can get a hot key to do? So now to perform a function based on that command, I have to do a few things:
- First, I have to check if a hotkey has been pressed. >CommandCount=Windower.script_GetCommandCount()
- Second, I wil pull that command waiting to be used. >Command=Windower.script_GetCommand()
- Then finally I can take that command and perform a function with it. (I scripted a very efficient method of taking the Command and directly turning it into a function without having to ask >if Command="blah" then block elseif block elseif .... etc. I'll post that later on.)
This method of calling a function with a hot key is sufficent. However, the draw back is I need to insert a function to check for the hot key many times throughout the main loop of the script. So then my main loop has the function, HotKeyCheck(), as every other function just to be sure the user hasn't pressed [F1] or whatever.
My question then is this, is there any way to directly perform a function through the use of hotkeys?
ie. > Control.control_BindKey("F2",true,false,false,".Lunar command Leviathan.lua MenuMode()")
And if this is currently not possible, can it be worked into Lunar somehow?