pekster Posted June 8, 2004 Posted June 8, 2004 (edited) What do I do to make it work?Remove any AdLib calls from within the timers function. I don't know excatally what you're trying to do with them, but if you ever want to stop that function from testing for the 50 minute code, call it outside that function. Also, what are you trying to do with the 50 minute sleep in the timers function? If you don't want it to stop for 50 minutes every 50 minutes, then it doesn't belong there. If your goal is to re-enable the timer, you already did that with the $Timer50Minutes = TimerStart() call. Remember, that will in effect "reset" your timer so that it will only run the conditional statement in your timers function in another 50 minutes.Edited to remove an extra bracket in the quote Edited June 8, 2004 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.
HelloIDistance Posted June 8, 2004 Posted June 8, 2004 Alright so is this what you are talking about? expandcollapse popup$Timer50Minutes = TimerStart() AdLibEnable("timers", 500);call the timers function to check for various times Sleep(60000);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 timers() If TimerStop($Timer50Minutes)> 110000 Then Sleep(30000);wait 30 seconds for rod to reel in Send("/logout") Send("{ENTER}") Sleep(35000);wait 35 seconds before continuing Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(20000);wait 20 seconds and then start script again $Timer50Minutes = TimerStart() EndIf EndFunc I have a question though, I thought that Adlibdisable () disabled the main script? Will it still do that without it? If not where do I put the adlibdisable? I want the rest of the script to be disabled temporarily while it runs: Func timers() If TimerStop($Timer50Minutes)> 110000 Then Sleep(30000);wait 30 seconds for rod to reel in Send("/logout") Send("{ENTER}") Sleep(35000);wait 35 seconds before continuing Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(20000);wait 20 seconds and then start script again $Timer50Minutes = TimerStart() EndIf Thanks
pekster Posted June 8, 2004 Posted June 8, 2004 I have a question though, I thought that Adlibdisable () disabled the main script? Will it still do that without it? If not where do I put the adlibdisable?I want the rest of the script to be disabled temporarily while it runs:That's how AdLib does work. Your main script is "paused" while the AdLib code is run. Only after the AdLib has compleatly finished running will the main code resume where it left off. [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.
HelloIDistance Posted June 8, 2004 Posted June 8, 2004 Okay, So where should I put Adlibdisable ()? At the very end of the script?
pekster Posted June 8, 2004 Posted June 8, 2004 I don't think you need it at all. Do you really want to turn off the testing of the 50 minute code at some point in your main part? Keep in mind that simply running AdLibDisable() will not pause the 50 minutes. That function is testing if 50 minutes or more has transpired since you called the last TimerStart() call (to the variable you referance, of course.) [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.
HelloIDistance Posted June 8, 2004 Posted June 8, 2004 I want to turn off every part of the script, and only leave this part until it is done. Then I want to run it like normal again, and make it do that every 50 minutes. Func timers() If TimerStop($Timer50Minutes)> 110000 Then Sleep(30000);wait 30 seconds for rod to reel in Send("/logout") Send("{ENTER}") Sleep(35000);wait 35 seconds before continuing Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(20000);wait 20 seconds and then start script again $Timer50Minutes = TimerStart() EndIf
Valik Posted June 8, 2004 Posted June 8, 2004 (edited) Has anybody realized how truly simple this should of been? Something to logout and re-login after 50 minutes?Global $hTimer = TimerStart() While 1 If TimerStop($hTimer) >= (50*60*1000) Then Reconnect() ; Do other crap, which in this case would be that whole freaking ; huge batch of poorly written code that makes up this 'script' Wend Func Reconnect() ; Logout ; Login $hTimer = TimerStart() ; Reset timer EndFuncEdit: AdLib, although not true concurrency, does afford the same pitfalls that "real" concurrency does, one of which being event synchronization. I don't see where using AdLib at all is in any way beneficial in this particular case. In fact, it would actually be a hindrance because it introduces a race condition. If it fires right in the middle of something else, then everything will be out of sync.The same timer idea can be applied to anything else that needs done. I recommend writing a small test script to get the hang of using the timers instead of posting that whole huge script again and again which I refuse to read. You can use small values to test with, then once you have a framework that works, increase the times to what you wish and incorporate the rest of the garbage into it. Edited June 8, 2004 by Valik
HelloIDistance Posted June 8, 2004 Posted June 8, 2004 Has anybody realized how truly simple this should of been? Something to logout and re-login after 50 minutes?CODE Global $hTimer = TimerStart()While 1 If TimerStop($hTimer) >= (50*60*1000) Then Reconnect() ; Do other crap, which in this case would be that whole freaking ; huge batch of poorly written code that makes up this 'script'WendFunc Reconnect() ; Logout ; Login $hTimer = TimerStart() ; Reset timerEndFuncSeriously man..Why do you post in here if your just gonna be all bitchy about it?"Do other crap, which in this case would be that whole freaking huge batch of poorly written code that makes up this 'script'"I am just trying to learn something new. I am asking for help. If your annoyed by my questions you don't have to post in here. Your saying when you were new you knew everything? I read the help file, and the examples in there., but didn't understand..I mean this forum is for helping? I'm sorry I asked for help and that I am new?
Valik Posted June 8, 2004 Posted June 8, 2004 I didn't learn C++ by jumping right in the middle of somebody else's code and trying to learn my way through. I tried that a couple times. I failed pretty bad at it. I didn't make the same mistake with AutoIt. If you'd stop trying to make that damned fishing script work and just figure out how to make the timer's work in a small test script, you might actually pick up on how to use AutoIt in 1/4 the time. If you're here for a one-off script to automate a game, then piss off for all I care. However, if you're serious about learning AutoIt, then you would do well to take the advice of people who know, even if you think it's bitchy or that the person is a prick, et cetera. You can't call me anything I haven't been called before and if you do, you will get a cookie. It's really your choice on what you are here for. If it's the former, then I think my above statement says it all. If it's the latter, then take the advice that I and another have already given you and attempt to learn the language before attempting to modify somebody else's script.
HelloIDistance Posted June 8, 2004 Posted June 8, 2004 Damn! I finnaly did it! I tested it and it worked! I wanna give a thanks to Pek and Slug for helping me through this. I hope to get better at this and be helping someone new one day . Here is the final script: Oh yea, and in response to Val's post. We all have our different ways of learning something. If you don't wanna help out you don't gotta. expandcollapse popup$Timer50Minutes = TimerStart() AdLibEnable("timers", 500);call the timers function to check for various times Sleep(60000);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 timers() If TimerStop($Timer50Minutes)> 1000 * 3000 Then Adlibdisable () Sleep(30000);wait 30 seconds for rod to reel in Send("/logout") Send("{ENTER}") Sleep(35000);wait 35 seconds before continuing Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(7000);wait 7 seconds Send("{ENTER}"); Sleep(20000);wait 20 seconds and then start script again $Timer50Minutes = TimerStart() EndIf EndFunc
pekster Posted June 8, 2004 Posted June 8, 2004 (edited) Oh yea, and in response to Val's post. We all have our different ways of learning something. If you don't wanna help out you don't gotta.Although it may have worked for you this time, i hope you do see that the 69 posts were way overkill for this problem. Designing a gaming script is really something that requires more knowledge of the language. I hope that you find AutoIt a powerful and useful langauge. However, please do take the time to read about the functions in the helpfile. Many times your questions about "what does this do" could have just as eaisily as been answered by looking in the manual and seeing what paramaters a function takes.You may not understand it all, but at least having read about a function makes finding it again eaisier. The first thing I did with AutoIt (back in the days of version 2 when I came on-board) was literally read the function referance from start to finish. Even if I didn't understand the use a function at the time, I was able to understand when I might want it later on when I was codding something.Also, when posting about a problem in these forums, I would encourage you to not post your entire script that you are working on, particurally a gaming script. Most people are not as nice as I have been (and I'm not always ) about programming what appears to be someone else's script. Instead, try creating as small of an example as you can to illustrate your problem. If you can't do that, then you probably haven't read the manual well enough to be asking the question to begin with.Edit:A side note: I don't mean you need an example of a problem if your question is along the lines of "I've read about XYZ function in the helpfile, but am not sure about how ABC works in it. Can I get some more information to help better understand what it does". However, I do mean that posting large and bulky code is usually a bad idea unless it is requested in a particular case. The best thing to do is ask for advice on a particular method, and then write the excact code yourself. You learn so much more by writing something youself and so little by using a pre-designed template written by a more expierenced programmer. Edited June 8, 2004 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 Matt Posted June 16, 2004 Posted June 16, 2004 Wow. You guys are some of the most patient people I've ever seen, lol!
Guest sbducker Posted June 17, 2004 Posted June 17, 2004 perhaps it would have been easier to just script it for him huh?
pekster Posted June 17, 2004 Posted June 17, 2004 (edited) perhaps it would have been easier to just script it for him huh?Not at all, because are they going to look it up in the helpfile next time they have a problem? Or just come to the "experts" knowing that we'll just do it for them. It's best if the people asking the questions use simple examples of their problems, and then the people who respond can show how they would solve the example. This prevents the posting of code that doesn't have anything to do with the issue. Theoretical examples work best because it shows how to do something, while still giving the person asking the question the chance to do it him/herself.Experts like a challange. Most don't like having to sift through someone else's long code to get to it.Minor edit Edited June 17, 2004 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 June 17, 2004 Posted June 17, 2004 i know this is a newb question but i need help with it , i also play ffxi and have a macro ( i have to press ALT +1) . how can i make that this autoit repeats ALT+1 531653246^355 times when i log on ? i would really appreciate the help , because im new with this tool
pekster Posted June 17, 2004 Posted June 17, 2004 how can i make that this autoit repeats ALT+1 531653246^355 times when i log on ?Did you read the helpfile? Sending keystrokes is one of the most basic things AutoIt can do, so chances are good you'll find it in there somewhere... You might find something to do with giving keystrokes in the AutoIt: Function Reference: Keyboard Control section. You need to repeat something? Sounds like a good time to read the AutoIt: Language Referencce for something about repeating blocks of code. Maybe you want to repeat for a specific number of times?It's also a good idea to read the introduction, and the first two sections (called Using AutoIt and Language Reference since it will help you learn what AutoIt is, and some basic things you can do with it.Also, please don't keep using this thread to add on new topics. I'm starting to hate scrolling past all the above code, plus I'd imagine the extra bandwidth isn't great for the server either. New topics like this really belong in a seperate thread. [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 joster123 Posted June 25, 2004 Posted June 25, 2004 But hey steve the scirpt u listed doesn't throw away rusty equipment and thats my main problem. if u can give a soulotin i would greatly appriciate it
tutor2000 Posted June 25, 2004 Posted June 25, 2004 But hey steve the scirpt u listed doesn't throw away rusty equipment and thats my main problem. if u can give a soulotin i would greatly appriciate itQuite possibly edit the MakeMyCoffee function I've been looking forRick
emmanuel Posted June 25, 2004 Posted June 25, 2004 Did you read the helpfile? Sending keystrokes is one of the most basic things AutoIt can do, so chances are good you'll find it in there somewhere... You might find something to do with giving keystrokes in the AutoIt: Function Reference: Keyboard Control section. You need to repeat something? Sounds like a good time to read the AutoIt: Language Referencce for something about repeating blocks of code. Maybe you want to repeat for a specific number of times?It's also a good idea to read the introduction, and the first two sections (called Using AutoIt and Language Reference since it will help you learn what AutoIt is, and some basic things you can do with it.Also, please don't keep using this thread to add on new topics. I'm starting to hate scrolling past all the above code, plus I'd imagine the extra bandwidth isn't great for the server either. New topics like this really belong in a seperate thread. ya know, pekster, I don't know how you have the patience to reply so nicely to all these fishing people...@rick: Where's that MakeMyCoffee func? I seem to have misplaced mine. "I'm not even supposed to be here today!" -Dante (Hicks)
tutor2000 Posted June 25, 2004 Posted June 25, 2004 @rick: Where's that MakeMyCoffee func? I seem to have misplaced mine.Gotta wait for autoit 4Rick
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now