Jump to content

Recommended Posts

Guest Steve
Posted

Okay I think I got it. Tell me if this is right and in the right place.

Sleep(100000);give time to open FFXI 
$fisha = 2; 
$event = 0; 
$bite = 0; 
$failsafe=0; 
$nobait = 0; 
WinWaitActive("FFXiApp"); 

While $fisha > 1 
AutoItSetOption("SendKeyDelay", 40); 
Send ("!1"); fishing macro 
$event = 0; 
$failsafe = 0; 
$nobait = 0; 

Do 
Sleep(250); 

If PixelGetColor(22,994) = 16777215 AND PixelGetColor(108,996) = 16777215 AND PixelGetColor(228,997) = 16777215 Then 
AutoItSetOption("SendKeyDelay", 40); 
Sleep(Random(3000,3200)); 
Send("{ENTER}"); 
Sleep(5400); 
EndIf 

If PixelGetColor(43,997) = 16777215 AND PixelGetColor(83,998) = 16777215 AND PixelGetColor(175,999) = 16777215 Then 
Sleep(Random(5100,5400));You lost your catch. Finish and speed things up a little. 
$event = 1; 
EndIf 

If PixelGetColor(37,1000) = 16777215 AND PixelGetColor(77,1000) = 16777215 AND PixelGetColor(180,998) = 16777215 Then 
Sleep(Random(5100,5400));You didn't catch anything. Finish and speed things up a little. 
$event = 1; 
EndIf 

If PixelGetColor(47,1000) = 16777215 AND PixelGetColor(142,999) = 16777215 AND PixelGetColor(330,997) = 16777215 Then 
$nobait = 1;You ran out of bait so let's get ready to change it. 
EndIf 

If PixelGetColor(43,995) = 16777215 AND PixelGetColor(71,997) = 16777215 AND PixelGetColor(84,995) = 16777215 Then 
autosort() 
Sleep(Random(2100,2200)); 
$event = 1;You caught something so now autosort, sleep a bit, and finish the event. 
EndIf 


$failsafe = $failsafe+1; 
If $failsafe = 175 Then 
$event = 1; 
EndIf 

Until $event = 1 

sleep(2000); 

If $nobait = 1 Then 
Send("!2");change bait 
EndIf 

WEnd 

Func autosort() 
Sleep(9000); 
AutoItSetOption("SendKeyDelay", 0235); 
AutoItSetOption("SendKeyDownDelay", 0100); 
Send ("!i"); 
Sleep(0250); 
Send ("{NUMPADADD}"); 
Sleep (0250); 
Send ("{ENTER}"); 
sleep(0350); 
Send ("{UP}"); 
sleep(0350); 
Send ("{ENTER}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
Sleep (0250);
HotKeySet("{F10}", "Escape");put this before your while loop
While 1;infinate loop
Send("/logout")
Sleep(30000);wait 30 seconds before continuing
Send("{RIGHT}");
Send("{ENTER}");
Send("{LEFT}");
Send("{ENTER}");
Sleep(3000 * 1000);sleep 50 minutes: 50 * 60 * 1000 for the ms required)
WEnd
Func Escape()
 MsgBox(0, "you hit the F10 Key", "now exiting...")
 Exit
EndFunc

I have one more question to. The F10 key would stop the looping right?

  • Replies 80
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

That will run the script once, then sleep for 50 minutes, which is obviously not what you want. See TimerStart()/TimerStop() in the help file.

Posted

I don't understand that part. "put your code that you wish to do here". Would that be this part..

That's whatever you want to loop every 50 minutes. I haven't read every post, but you wanted some code (that you designed and know better than I do) to loop itself every 50 minutes. That comment block can be as many or as few commands as you need. For example, let's say you have 3 functions called Logout(), DoStuff() and EndStuff(). These could either be hard coded (without functions) or written out (like you have it in your script currently.) I'm just using functions to illustrate mypoint. To run those 3 functions, wait 50 minutes, and do them again, you would write:

;DON't forget to code a hotkey or some escape method before this loop!!!
While 1 ;infinate loop
  Logout()
  DoStuff()
  EndStuff()
  Sleep(3000 * 1000) ;pause for 50 minutes
WEnd

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Guest Steve
Posted

Alright thanks Valik. I'll check that out, but is that the right place for the code?

Posted

is that the right place for the code?

If you mean my While loop, be careful how you use it. How you have it now, the only way for it to exit that loop is the F10 key, and it appears that you test for catching something. Unless you want to be required to hit F10 to get out of the loop, a loop may not be what you're after. To just pause for 50 minutes, the single command Sleep(3000 * 1000) will do the trick.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Guest Steve
Posted

Okay pek, Is this right then?

Func autosort() 
Sleep(9000); 
AutoItSetOption("SendKeyDelay", 0235); 
AutoItSetOption("SendKeyDownDelay", 0100); 
Send ("!i"); 
Sleep(0250); 
Send ("{NUMPADADD}"); 
Sleep (0250); 
Send ("{ENTER}"); 
sleep(0350); 
Send ("{UP}"); 
sleep(0350); 
Send ("{ENTER}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
Sleep (0250);
HotKeySet("{F10}", "Escape");put this before your while loop
While 1;infinate loop
Send("/logout")
Sleep(30000);wait 30 seconds before continuing
Send("{ENTER}");
Send("{ENTER}");
Send("{ENTER}");
Func Escape()
 MsgBox(0, "you hit the F10 Key", "now exiting...")
 Exit
EndFunc

Would that logout every 50 minutes over and over?

Guest Guest
Posted

Okay I think I get what your saying so without the HotKeySet command it will just loop it every 50 minutes forever, but the HotKeySet command makes it so that the loop can end if you press F10?

All I need is for it to do this code every fifty minutes:

Send("/logout")
Sleep(30000);wait 30 seconds before continuing
Send("{ENTER}");
Send("{ENTER}");
Send("{ENTER}");
Guest Guest
Posted

Would that logout every 50 minutes over and over?

You've got a few problems with that code segment. First of all, you have a while loop, but no end while. 2nd, you don't appear to have that 50 minute sleep command, which will not put that pause in that you want. You also defined the Escape() function inside another function, which you cannot do. If you are not using that infinate loop, you also wouldn't need the hotkey to exit it. If you just want to type "/logout", that enter stuff, sleep for 50 minutes, and do it again (and nothing more) then put ALL that code inside my infinate while loop (with that hotkey defined outside the loop first.) That will do nothing but run the listed items over and over until you hit the escape hotkey.
Guest Guest
Posted

Okay I think I get what your saying so without the HotKeySet command it will just loop it every 50 minutes forever, but the HotKeySet command makes it so that the loop can end if you press F10?

All I need is for it to do this code every fifty minutes:

CODE 

Send("/logout")

Sleep(30000);wait 30 seconds before continuing

Send("{ENTER}");

Send("{ENTER}");

Send("{ENTER}");

So is the loop what I am looking for? I don't ever wanna stop the every 50 minutes logout command. I want it to run forever every fifty seconds. Would that be the command Vilak was talking about?

Posted

Grrr, failure to log in (a first for me :D )

Oh well

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Guest Guest
Posted

^^ Change "seconds" to minutes.

Posted

All I need is for it to do this code every fifty minutes:

Send("/logout")
Sleep(30000);wait 30 seconds before continuing
Send("{ENTER}");
Send("{ENTER}");
Send("{ENTER}");
Then use this:

HotKeySet("{F10}", "Escape")
While 1 ;loop forever, escapes only by the hotkey
  Send("/logout")
  Sleep(30000);wait 30 seconds before continuing
  Send("{ENTER}");
  Send("{ENTER}");
  Send("{ENTER}");
  Sleep(3000 * 1000) ;wait 50 minutes and then do it all again
WEnd

Func Escape()
  MsgBox(0, "F10 pressed", "now exiting the program")
  Exit
EndFunc

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Guest Steve
Posted

You've got a few problems with that code segment. First of all, you have a while loop, but no end while. 2nd, you don't appear to have that 50 minute sleep command, which will not put that pause in that you want. You also defined the Escape() function inside another function, which you cannot do. If you are not using that infinate loop, you also wouldn't need the hotkey to exit it. If you just want to type "/logout", that enter stuff, sleep for 50 minutes, and do it again (and nothing more) then put ALL that code inside my infinate while loop (with that hotkey defined outside the loop first.) That will do nothing but run the listed items over and over until you hit the escape hotkey.

Okay, If I use that while command you are talking about the rest of the script will run fine, correct?

I am looking to repeat this:

Send("/logout")
Sleep(30000);wait 30 seconds before continuing
Send("{ENTER}");
Send("{ENTER}");
Send("{ENTER}");

Every 50 minutes, but I still want the rest of the script to run and jsut every 50 minutes it reads the script above.

Guest Guest
Posted

Then use this:

CODE 

HotKeySet("{F10}", "Escape")

While 1 ;loop forever, escapes only by the hotkey

Send("/logout")

Sleep(30000);wait 30 seconds before continuing

Send("{ENTER}");

Send("{ENTER}");

Send("{ENTER}");

Sleep(3000 * 1000) ;wait 50 minutes and then do it all again

WEnd

Func Escape()

MsgBox(0, "F10 pressed", "now exiting the program")

Exit

EndFunc

Okay and that will do the command every fifty seconds, and still run the rest of the scirpt? And F10 will stop the command, but still run the rest of the script?

Posted

but I still want the rest of the script to run and jsut every 50 minutes it reads the script above.

Ah, the perfect example of a time to use AdLibEnable(). This function will run a user defined function every X amount of time while the script is running (until you use the AdLibDisable() function.) To use this, type the following line to enable the AdLib code:

; call My_AdLib_Function() every 50 minutes :
AdLibEnable("My_AdLib_Function", 3000 * 1000)

;rest of your script goes here

Func My_AdLib_Function()
 ;put all your code that you wish to repeat every 50 minutes here
 ;like your "logout" and enter stuff
EndFunc

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Posted (edited)

Also note: using that, don't use the while loop. Just put the send strokes and pauses you want to run each time. No need for a hotkey either, because (I assume) you have another way to exit your program. The AdLib stuff will always repeat itself due to the nature of it. I'd encourage you to read about that function in the manual for more info ( and the AdLibDisable one too.)

Edited to correct a spelling mistake

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Guest Guest
Posted

OKay, Thank you very much! So the finched script owuld look like this?

Sleep(100000);give time to open FFXI 
$fisha = 2; 
$event = 0; 
$bite = 0; 
$failsafe=0; 
$nobait = 0; 
WinWaitActive("FFXiApp");

; call My_AdLib_Function() every 50 minutes :
AdLibEnable("My_AdLib_Function", 3000 * 1000) 

While $fisha > 1 
AutoItSetOption("SendKeyDelay", 40); 
Send ("!1"); fishing macro 
$event = 0; 
$failsafe = 0; 
$nobait = 0; 

Do 
Sleep(250); 

If PixelGetColor(22,994) = 16777215 AND PixelGetColor(108,996) = 16777215 AND PixelGetColor(228,997) = 16777215 Then 
AutoItSetOption("SendKeyDelay", 40); 
Sleep(Random(3000,3200)); 
Send("{ENTER}"); 
Sleep(5400); 
EndIf 

If PixelGetColor(43,997) = 16777215 AND PixelGetColor(83,998) = 16777215 AND PixelGetColor(175,999) = 16777215 Then 
Sleep(Random(5100,5400));You lost your catch. Finish and speed things up a little. 
$event = 1; 
EndIf 

If PixelGetColor(37,1000) = 16777215 AND PixelGetColor(77,1000) = 16777215 AND PixelGetColor(180,998) = 16777215 Then 
Sleep(Random(5100,5400));You didn't catch anything. Finish and speed things up a little. 
$event = 1; 
EndIf 

If PixelGetColor(47,1000) = 16777215 AND PixelGetColor(142,999) = 16777215 AND PixelGetColor(330,997) = 16777215 Then 
$nobait = 1;You ran out of bait so let's get ready to change it. 
EndIf 

If PixelGetColor(43,995) = 16777215 AND PixelGetColor(71,997) = 16777215 AND PixelGetColor(84,995) = 16777215 Then 
autosort() 
Sleep(Random(2100,2200)); 
$event = 1;You caught something so now autosort, sleep a bit, and finish the event. 
EndIf 


$failsafe = $failsafe+1; 
If $failsafe = 175 Then 
$event = 1; 
EndIf 

Until $event = 1 

sleep(2000); 

If $nobait = 1 Then 
Send("!2");change bait 
EndIf 

WEnd 

Func autosort() 
Sleep(9000); 
AutoItSetOption("SendKeyDelay", 0235); 
AutoItSetOption("SendKeyDownDelay", 0100); 
Send ("!i"); 
Sleep(0250); 
Send ("{NUMPADADD}"); 
Sleep (0250); 
Send ("{ENTER}"); 
sleep(0350); 
Send ("{UP}"); 
sleep(0350); 
Send ("{ENTER}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
Sleep (0250);

EndFunc

Func My_AdLib_Function()
HotKeySet("{F10}", "Escape")
While 1;loop forever, escapes only by the hotkey
 Send("/logout")
 Sleep(30000);wait 30 seconds before continuing
 Send("{ENTER}");
 Send("{ENTER}");
 Send("{ENTER}");
 Sleep(3000 * 1000);wait 50 minutes and then do it all again
WEnd

Func Escape()
 MsgBox(0, "F10 pressed", "now exiting the program")
 Exit
EndFunc
Guest Guest
Posted

Also note: using that, don't use the while loop. Just put the send strokes and pauses you want to run each time. No need for a hotkey either, because (I assume) you have another way to exit your program. The AdLib stuff will always repeat itself due to the nature of it. I'd encourage you to read about that function in the manual for more info ( and the AdLibDisable one too.)

Okay so the finshed script is:?

; call My_AdLib_Function() every 50 minutes :
AdLibEnable("My_AdLib_Function", 3000 * 1000) 

Sleep(100000);give time to open FFXI 
$fisha = 2; 
$event = 0; 
$bite = 0; 
$failsafe=0; 
$nobait = 0; 
WinWaitActive("FFXiApp");

While $fisha > 1 
AutoItSetOption("SendKeyDelay", 40); 
Send ("!1"); fishing macro 
$event = 0; 
$failsafe = 0; 
$nobait = 0; 

Do 
Sleep(250); 

If PixelGetColor(22,994) = 16777215 AND PixelGetColor(108,996) = 16777215 AND PixelGetColor(228,997) = 16777215 Then 
AutoItSetOption("SendKeyDelay", 40); 
Sleep(Random(3000,3200)); 
Send("{ENTER}"); 
Sleep(5400); 
EndIf 

If PixelGetColor(43,997) = 16777215 AND PixelGetColor(83,998) = 16777215 AND PixelGetColor(175,999) = 16777215 Then 
Sleep(Random(5100,5400));You lost your catch. Finish and speed things up a little. 
$event = 1; 
EndIf 

If PixelGetColor(37,1000) = 16777215 AND PixelGetColor(77,1000) = 16777215 AND PixelGetColor(180,998) = 16777215 Then 
Sleep(Random(5100,5400));You didn't catch anything. Finish and speed things up a little. 
$event = 1; 
EndIf 

If PixelGetColor(47,1000) = 16777215 AND PixelGetColor(142,999) = 16777215 AND PixelGetColor(330,997) = 16777215 Then 
$nobait = 1;You ran out of bait so let's get ready to change it. 
EndIf 

If PixelGetColor(43,995) = 16777215 AND PixelGetColor(71,997) = 16777215 AND PixelGetColor(84,995) = 16777215 Then 
autosort() 
Sleep(Random(2100,2200)); 
$event = 1;You caught something so now autosort, sleep a bit, and finish the event. 
EndIf 


$failsafe = $failsafe+1; 
If $failsafe = 175 Then 
$event = 1; 
EndIf 

Until $event = 1 

sleep(2000); 

If $nobait = 1 Then 
Send("!2");change bait 
EndIf 

WEnd 

Func autosort() 
Sleep(9000); 
AutoItSetOption("SendKeyDelay", 0235); 
AutoItSetOption("SendKeyDownDelay", 0100); 
Send ("!i"); 
Sleep(0250); 
Send ("{NUMPADADD}"); 
Sleep (0250); 
Send ("{ENTER}"); 
sleep(0350); 
Send ("{UP}"); 
sleep(0350); 
Send ("{ENTER}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
sleep(0250); 
Send ("{ESCAPE}"); 
Sleep (0250);

EndFunc

Func My_AdLib_Function()
 Send("/logout")
 Sleep(30000);wait 30 seconds before continuing
 Send("{ENTER}");
 Send("{ENTER}");
 Send("{ENTER}");
 Sleep(3000 * 1000);wait 50 minutes and then do it all again
WEnd

EndFunc

Anything wrong with that?

Posted (edited)

Anything wrong with that?

Nothing the runtime debugger wouldn't have caught for you. Sigh. It appears you have a WEnd call without a matching While command in the AdLib function.

Edited to change would to wouldn't (HUGE differance :D )

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...