ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Cuemif on October 06, 2010, 05:48:47 AM
-
I was trying to add a hot key to this here script was wondering if I could get a quick help out with it as my attempts are fail
set %bag_to_keep_open_1 VACTRMD
set %bag_to_keep_open_2 BOPVKMD
set #lobjectID %bag_to_keep_open_1
event macro 17
wait 10
set #lobjectID %bag_to_keep_open_2
event macro 17
wait 10
Thank you so much and sorry about my lame newbness
-
What are you trying to accomplish by hitting the hotkey?
-
; near the beginning of the script in the setup
set %bag_to_keep_open_1 VACTRMD
set %hotkey_to_open_bag_1 F1
set %bag_to_keep_open_2 BOPVKMD
set %hotkey_to_open_bag_2 F2
; then in the mainloop of the script
onhotkey %bag_to_keep_open_1
gosub open_bag %bag_to_keep_open_1
onhotkey %bag_to_keep_open_2
gosub open_bag %bag_to_keep_open_2
; then somewhere out of the way (end) of the script
sub open_bag
set #lobjectID %1
event macro 17
wait 10
return
Please note that onhotkey isn't an instant key press and action. You often have to hold down the key for like half a second to get it to "take".
-
Ok what I added there is my script. I do not think that there is a loop . GOD I am a newb I should just stop trying lol sorry . Please help if you can later
-
The script must have a main loop. Your still trying to use this with CEO's medic, right?
Look for a line with this
Mainloop:
and put this in under it...
; then in the mainloop of the script
onhotkey %bag_to_keep_open_1
gosub open_bag %bag_to_keep_open_1
onhotkey %bag_to_keep_open_2
gosub open_bag %bag_to_keep_open_2
Make sure you have the setup stuff at the beginning and the sub at the end.
-
Ok I added
set %hotkey_bag_to_keep_open_1 M
at top of script
And then right below Mainloop: I added
onhotkey %bag_to_keep_open_1
gosub open_bag %bag_to_keep_open_1
Then at bottom of script I added this
sub open_bag
set #lobjectID %1
event macro 17
wait 10
return
It still does not work I even held the M key down for about 5 secs what might I be doing wrong ?
-
You have your hotkey set to the variable
%hotkey_bag_to_keep_open_1
but when you call that hotkey you are calling a different variable
%bag_to_keep_open_1 <- notice it's different, missing "hotkey_"
You can shorten or rename this stuff to whatever makes it easier for you....
set %hotkey_1 M
set %bag_1 VACTRMD
onhotkey %hotkey_1
gosub open_bag %bag_1
-
Something for everyone to consider when using hotkeys. Since onhotkey isn't latched, it's easy to miss the key. People originally reported in the CLAw that it would take quite a bit of time for the script to react to keyboard selections. My solution was to build a function that would just set flags and allow the script to handle a successful keypress later. So I had a function:
;-------------------------------------------------------------------------------
sub CheckHotKey
menu get EUOEditKey1
onhotkey #MENURES ALT
set %targetkey #TRUE
menu get EUOEditKey2
onhotkey #MENURES ALT
set %lootarea #TRUE
return
And then I could pepper the code with "gosub CheckHotKey" to scan and capture at a higher rate. Then you just look at the variables %targetkey and %lootarea to make the call that a key has been pressed.
To get onhotkey to be response, I'd just do this:
gosub HandleItemLoggingToHistory
gosub CheckHotKey
gosub VerifyLootCheckmarks
gosub CheckHotKey
gosub ManageIgnoreList
gosub CheckHotKey
gosub HandleExternalInterface
gosub CheckHotKey
No more hotkey lag complaints.... ;)
-
Something for everyone to consider when using hotkeys. Since onhotkey isn't latched, it's easy to miss the key. People originally reported in the CLAw that it would take quite a bit of time for the script to react to keyboard selections. My solution was to build a function that would just set flags and allow the script to handle a successful keypress later. So I had a function:
;-------------------------------------------------------------------------------
sub CheckHotKey
menu get EUOEditKey1
onhotkey #MENURES ALT
set %targetkey #TRUE
menu get EUOEditKey2
onhotkey #MENURES ALT
set %lootarea #TRUE
return
And then I could pepper the code with "gosub CheckHotKey" to scan and capture at a higher rate. Then you just look at the variables %targetkey and %lootarea to make the call that a key has been pressed.
To get onhotkey to be response, I'd just do this:
gosub HandleItemLoggingToHistory
gosub CheckHotKey
gosub VerifyLootCheckmarks
gosub CheckHotKey
gosub ManageIgnoreList
gosub CheckHotKey
gosub HandleExternalInterface
gosub CheckHotKey
No more hotkey lag complaints.... ;)
Yes the lag is crazy BUT the above confuses me lol
-
I am gonna have to figure this out
-
Really what I'm doing is just calling onhotkey lots more times and registering the occurrences instead of missing them.
-
So... all I need to do is add
onhotkey %bag_to_keep_open_2
gosub open_bag %bag_to_keep_open_2
Here there and everywhere?
-
Sorry, may have confused you with a more advanced thought. You should look at EasyUO the exact syntax of onhotkey. It's looking for the arguments of the key. In my case I had F1 in the menures variable so I'm looking for:
onhotkey F1 ALT
This returns true.
Other than that, pay no attention to my post; it's probably more than you need and hard to explain.
-
I do want it to open faster right now it takes like 4 to 5 secs to open my bags and that is just well TO slow I am a semi fast learner so I am gonna look more into this