Setting Up Hotkey Activation And Deactivation
#1
Posted 25 January 2004 - 11:34 PM
#2
Posted 26 January 2004 - 12:53 AM
Here's an example from the soon-to-be updated help docs. Change the hotkeys to whatever you want; you may not even want the termination hotkey.
Edit: If you want the script to begin in a paused state, then change $paused = 0 to $paused = 1
; Press Esc to terminate script, Pause/Break to pause Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") $Paused = 0 While 1;infinite loop If $Paused then Sleep(1000);avoid maxing out cpu Else ; MAIN BODY OF SCRIPT GOES HERE EndIf Wend Func TogglePause() $Paused = NOT $Paused EndFunc Func Terminate() MsgBox(4096,"", "The End") Exit EndFunc
Edited by CyberSlug, 26 January 2004 - 12:57 AM.
#3
Posted 26 January 2004 - 04:21 AM
; Made by z33to ; Version 0.75 ; Press Esc to terminate script, Pause/Break to pause Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("^`", "Terminate") $Paused = 0 While 1;infinite loop If $Paused then Sleep(1000); avoid maxing out cpu Else Sleep(100000);give time to open FFXI $fisha = 2; $biteyes = 0; $bite = 0; $failsafe=0; $sortnow = 1; $logtime = 0; WinWaitActive("FFXiApp"); While $fisha > 1 AutoItSetOption("SendKeyDelay", 20); If $sortnow = 1 Then autosort() Send("/equip ammo ""Insect Ball""{ENTER}"); Else Sleep(Random(4000,6000)); EndIf Send("/fish{ENTER}"); fishing macro $biteyes = 0; $failsafe = 0; $sortnow = 0; Do Sleep(250); If PixelGetColor(228,735) = 16777215 AND PixelGetColor(200,735) = 16777215 _ AND PixelGetColor(175, 735) = 16777215 Then AutoItSetOption("SendKeyDelay", 20); Sleep(Random(2000,3000)); Send("{ENTER}"); Sleep(2500); If PixelGetColor(128,735) = 16777215 AND PixelGetColor(74,1168) = 16777215 _ Then $logtime = $logtime + 1; EndIf Sleep(9000); $biteyes = 1; $sortnow = 1; EndIf If PixelGetColor(194,735) = 16777215 Then _ AutoItSetOption("SendKeyDelay", 20); $biteyes = 1; Sleep(9000); EndIf $failsafe = $failsafe+1; If $failsafe = 175 Then $biteyes = 1; EndIf Until $biteyes = 1 Sleep(12000); If $logtime = 2 Then $logtime = 0; Send("/logout{ENTER}"); $fisha = 1 EndIf WEnd Func autosort() AutoItSetOption("SendKeyDelay", 85);slow key delay a bit Send("{NUMPADSUB}"); Sleep(1000); MouseMove(973,109,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{NUMPADADD}"); Sleep(1000); Send("{ENTER}"); Sleep(1000); MouseMove(964,121,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{ESC}"); Sleep(500); Send("{ESC}"); Sleep(500); EndFunc EndIf Wend Func TogglePause() $Paused = NOT $Paused EndFunc Func Terminate() Exit EndFunc ; Made by z33to
Edited by Onikage, 26 January 2004 - 04:43 AM.
#4
Posted 26 January 2004 - 07:53 AM
Hmm..
1) Try the most recent version of AutoIt. Some features have been changing recently. (In general, older scripts should work with newer AutoIt releases.)
2) Maybe try wrapping z33to's script in a function:
; Press Esc to terminate script, Pause/Break to pause Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("^`", "Terminate") $Paused = 0 While 1;infinite loop If $Paused then Sleep(1000);avoid maxing out cpu Else z33toScript() EndIf Wend Func TogglePause() $Paused = NOT $Paused EndFunc Func Terminate() MsgBox(4096,"", "The End") Exit EndFunc Func z33toScript() $fisha = 2; $biteyes = 0; $bite = 0; $failsafe=0; $sortnow = 1; $logtime = 0; WinWaitActive("FFXiApp"); ;... ; etc etc ; ... EndFunc Func autosort() AutoItSetOption("SendKeyDelay", 85);slow key delay a bit Send("{NUMPADSUB}"); Sleep(1000); MouseMove(973,109,3); Sleep(500); Send("{ENTER}"); ;... ; etc etc ; ... EndFunc
Edited by CyberSlug, 26 January 2004 - 07:57 AM.
#5
Posted 26 January 2004 - 08:00 AM
; Made by z33to ; Version 0.75 ; Press Esc to terminate script, Pause/Break to pause Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("^`", "Terminate") $Paused = 0 While 1;infinite loop If $Paused then Sleep(1000); avoid maxing out cpu Else z33toScript() EndIf Wend Func TogglePause() $Paused = NOT $Paused EndFunc Func Terminate() Exit EndFunc Func z33toScript() Sleep(100000);give time to open FFXI $fisha = 2; $biteyes = 0; $bite = 0; $failsafe=0; $sortnow = 1; $logtime = 0; WinWaitActive("FFXiApp"); While $fisha > 1 AutoItSetOption("SendKeyDelay", 20); If $sortnow = 1 Then autosort() Send("/equip ammo ""Insect Ball""{ENTER}"); Else Sleep(Random(4000,6000)); EndIf Send("/fish{ENTER}"); fishing macro $biteyes = 0; $failsafe = 0; $sortnow = 0; Do Sleep(250); If PixelGetColor(228,735) = 16777215 AND PixelGetColor(200,735) = 16777215 _ AND PixelGetColor(175, 735) = 16777215 Then AutoItSetOption("SendKeyDelay", 20); Sleep(Random(2000,3000)); Send("{ENTER}"); Sleep(2500); If PixelGetColor(128,735) = 16777215 AND PixelGetColor(74,1168) = 16777215 _ Then $logtime = $logtime + 1; EndIf Sleep(9000); $biteyes = 1; $sortnow = 1; EndIf If PixelGetColor(194,735) = 16777215 Then _ AutoItSetOption("SendKeyDelay", 20); $biteyes = 1; Sleep(9000); EndIf $failsafe = $failsafe+1; If $failsafe = 175 Then _ $biteyes = 1; EndIf Until $biteyes = 1 Sleep(12000); If $logtime = 2 Then $logtime = 0; Send("/logout{ENTER}"); $fisha = 1 EndIf WEnd Func autosort() AutoItSetOption("SendKeyDelay", 85);slow key delay a bit Send("{NUMPADSUB}"); Sleep(1000); MouseMove(973,109,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{NUMPADADD}"); Sleep(1000); Send("{ENTER}"); Sleep(1000); MouseMove(964,121,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{ESC}"); Sleep(500); Send("{ESC}"); Sleep(500); EndFunc EndFunc ; Made by z33to
Edited by Onikage, 26 January 2004 - 08:08 AM.
#6
Posted 26 January 2004 - 08:14 AM
#7
Posted 26 January 2004 - 08:22 AM
#8
Posted 26 January 2004 - 09:13 AM
IDEA ONE:
Change TogglePause to this:
Func TogglePause() MsgBox(0,"","Press OK") sleep(1000) EndFunc
This makes a message box pop up. The script will resume 1 second after you press OK.
IDEA TWO:
Try adding the following statements at places within the main game script:
If $Paused Then PauseLoop()
At the very end of the code (after the very last EndFunc) add this:
Func PauseLoop() While $Paused sleep(500) WEnd EndFunc
Note: These ideas are intended to be implemented separately!
Edited by CyberSlug, 26 January 2004 - 09:19 AM.
#9
Posted 26 January 2004 - 09:47 AM
Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") AutoItSetOption("SendKeyDelay", 20); While $fisha > 1 IF $Paused THEN;***** sleep(1000) ELSE;***** If $sortnow = 1 Then autosort() Send("/equip ammo ""Insect Ball""{ENTER}"); Else Sleep(Random(4000,6000)); EndIf Send("/fish{ENTER}"); fishing macro $biteyes = 0; $failsafe = 0; $sortnow = 0; Do Sleep(250); If PixelGetColor(228,735) = 16777215 AND PixelGetColor(200,735) = 16777215 _ AND PixelGetColor(175, 735) = 16777215 Then AutoItSetOption("SendKeyDelay", 20); Sleep(Random(2000,3000)); Send("{ENTER}"); Sleep(2500); If PixelGetColor(128,735) = 16777215 AND PixelGetColor(74,1168) = 16777215 _ Then $logtime = $logtime + 1; EndIf Sleep(9000); $biteyes = 1; $sortnow = 1; EndIf If PixelGetColor(194,735) = 16777215 Then _ AutoItSetOption("SendKeyDelay", 20); $biteyes = 1; Sleep(9000); EndIf $failsafe = $failsafe+1; If $failsafe = 175 Then $biteyes = 1; EndIf Until $biteyes = 1 Sleep(12000); If $logtime = 2 Then $logtime = 0; Send("/logout{ENTER}"); $fisha = 1 EndIf ENDIF;***** WEnd Func autosort() AutoItSetOption("SendKeyDelay", 85);slow key delay a bit Send("{NUMPADSUB}"); Sleep(1000); MouseMove(973,109,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{NUMPADADD}"); Sleep(1000); Send("{ENTER}"); Sleep(1000); MouseMove(964,121,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{ESC}"); Sleep(500); Send("{ESC}"); Sleep(500); EndFunc Func TogglePause() $Paused = NOT $Paused EndFunc Func Terminate() MsgBox(4096,"", "The End") Exit EndFunc
#10
Posted 27 January 2004 - 01:07 AM
; Original Script by z33to Global $Paused HotKeySet("^p", "TogglePause") Sleep(100000);give time to open FFXI $fisha = 2; $biteyes = 0; $bite = 0; $failsafe=0; $sortnow = 1; $logtime = 0; WinWaitActive("FFXiApp"); While $fisha > 1 AutoItSetOption("SendKeyDelay", 40); If $Paused Then PauseLoop() If $sortnow = 1 Then autosort() Send("/equip ammo ""Insect Ball""{ENTER}"); Else Sleep(Random(4000,6000)); EndIf If $Paused Then PauseLoop() Send("/fish{ENTER}"); fishing macro $biteyes = 0; $failsafe = 0; $sortnow = 0; Do Sleep(250); If PixelGetColor(228,735) = 16777215 AND PixelGetColor(200,735) = 16777215 AND PixelGetColor(175,735) = 16777215 Then AutoItSetOption("SendKeyDelay", 40); Sleep(Random(2000,3000)); Send("{ENTER}"); Sleep(2500); If PixelGetColor(128,735) = 16777215 AND PixelGetColor(74,1168) = 16777215 Then $logtime = $logtime + 1; EndIf Sleep(9000); $biteyes = 1; $sortnow = 1; EndIf If PixelGetColor(194,735) = 16777215 Then AutoItSetOption("SendKeyDelay", 40); $biteyes = 1; Sleep(9000); EndIf $failsafe = $failsafe+1; If $failsafe = 175 Then $biteyes = 1; EndIf If $Paused Then PauseLoop() Until $biteyes = 1 Sleep(12000); If $logtime = 2 Then $logtime = 0; Send("/logout{ENTER}"); $fisha = 1 EndIf WEnd Func autosort() AutoItSetOption("SendKeyDelay", 85);slow key delay a bit Send("{NUMPADSUB}"); Sleep(1000); MouseMove(973,109,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{NUMPADADD}"); Sleep(1000); Send("{ENTER}"); Sleep(1000); MouseMove(964,121,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{ESC}"); Sleep(500); Send("{ESC}"); Sleep(500); EndFunc Func TogglePause() $Paused = NOT $Paused EndFunc Func PauseLoop() While $Paused sleep(1000) WEnd EndFunc
#11
Posted 27 January 2004 - 02:10 AM
If $Paused Then PauseLoop() Send("/fish{ENTER}"); fishing macro $biteyes = 0; $failsafe = 0; $sortnow = 0; Do Sleep(250); If PixelGetColor(228,735) = 16777215 AND PixelGetColor(200,735) = 16777215 AND PixelGetColor(175,735) = 16777215 Then AutoItSetOption("SendKeyDelay", 40); Sleep(Random(2000,3000)); Send("{ENTER}"); Sleep(2500); If PixelGetColor(128,735) = 16777215 AND PixelGetColor(74,1168) = 16777215 Then $logtime = $logtime + 1; EndIf Sleep(9000); $biteyes = 1; $sortnow = 1; EndIf
This section has the mistake, where it shows AND having its own line, it shouldn't.
If PixelGetColor(228,735) = 16777215 AND PixelGetColor(200,735) = 16777215 AND PixelGetColor(175,735) = 16777215 Then
Put all this stuff into one line. Don't know how to explain it any easier. Notepad will let you do this, not a forum.
Edited by Deathgigas, 27 January 2004 - 02:12 AM.
#12
Posted 27 January 2004 - 02:36 AM
Not sure how this pausing thing works, when i do ctrl+p it does /party chatmode. I'm gonna have to figure out a key that isn't used in-game.
Good job and thanks to the both of you.
#13
Posted 28 January 2004 - 06:27 AM
#14
Posted 28 January 2004 - 08:23 PM
The macros themselves run flawlessly, very nice work.
Both Z33to's and Onikage's / Cybor Slug's rewrite. Both work perfectly, exept for the actual ability to pause.
I am using the newest Beta 3.0.90 and this is the first time i have ever tried to use Auto It. Is there sometihng i need to DL to enable using hotkeys? Or did that come in the install of Beta 3.0.90.
Any info is appreciated. Great work btw too.
#15
Posted 29 January 2004 - 11:34 AM
The only progress I made was, using the earlier methods I was able to start the game / script PAUSED and unpause it when i wanted, but after that I was not able to pause it. Copying the code exact I am still unable to get hotkeys to function properly. Using .90 / xp Pro / Hotkeys set as {F11} and {F12} - Also tried {RALT} and {RCTRL}. No dice.
#16
Posted 29 January 2004 - 06:05 PM
Say you just use the /echo and type ***
Have the script grab the third * and the color and that will do an if then to start, stop. It's not actaully a hot key, but it would start and stop the script, right?
#17
Posted 29 January 2004 - 06:30 PM
#18
Posted 29 January 2004 - 07:35 PM
#19
Posted 29 January 2004 - 11:53 PM
; Original Script by z33to Global $Paused Sleep(100000);give time to open FFXI $fisha = 2; $biteyes = 0; $bite = 0; $failsafe=0; $sortnow = 1; $logtime = 0; WinWaitActive("FFXiApp"); While $fisha > 1 AutoItSetOption("SendKeyDelay", 40); If PixelGetColor(24,740) = 11534335 AND PixelGetColor(33,740) = 11730943 AND PixelGetColor(42,740) = 11010047 Then TogglePause() EndIf If $Paused Then PauseLoop() If $sortnow = 1 Then autosort() Send("/equip ammo ""Insect Ball""{ENTER}"); Send("/equip range ""Carbon Fish. Rod""{ENTER}"); Else Sleep(Random(4000,6000)); EndIf If $Paused Then PauseLoop() Send("/fish{ENTER}"); fishing macro $biteyes = 0; $failsafe = 0; $sortnow = 0; Do Sleep(250); If PixelGetColor(228,735) = 16777215 AND PixelGetColor(200,735) = 16777215 AND PixelGetColor(175,735) = 16777215 Then AutoItSetOption("SendKeyDelay", 40); Sleep(Random(2000,3000)); Send("{ENTER}"); Sleep(2500); If PixelGetColor(128,735) = 16777215 AND PixelGetColor(74,1168) = 16777215 Then $logtime = $logtime + 1; EndIf Sleep(9000); $biteyes = 1; $sortnow = 1; EndIf If PixelGetColor(194,735) = 16777215 Then AutoItSetOption("SendKeyDelay", 40); $biteyes = 1; Sleep(9000); EndIf $failsafe = $failsafe+1; If $failsafe = 175 Then $biteyes = 1; EndIf If $Paused Then PauseLoop() Until $biteyes = 1 Sleep(12000); If $logtime = 2 Then $logtime = 0; Send("/logout{ENTER}"); $fisha = 1 EndIf WEnd Func autosort() AutoItSetOption("SendKeyDelay", 85);slow key delay a bit Send("{NUMPADSUB}"); Sleep(1000); MouseMove(973,109,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{NUMPADADD}"); Sleep(1000); Send("{ENTER}"); Sleep(1000); MouseMove(964,121,3); Sleep(500); Send("{ENTER}"); Sleep(500); Send("{ESC}"); Sleep(500); Send("{ESC}"); Sleep(500); EndFunc Func TogglePause() Send("/echo Pause"); $Paused = NOT $Paused EndFunc Func PauseLoop() While $Paused sleep(1000) WEnd EndFunc
But it still won't pause. Won't even do the /echo pause. Any ideas?
#20
Posted 30 January 2004 - 02:18 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users




