I'm really confused about how the syntax in AutoIT works sometimes.
Sometimes you have have spaces between different parts of functions or variable settings. All of the following are currently working fine with spaces.
And yet, when I was just trying to implement an AP spending delay, the following refused to work until I took out the spaces.Code:MouseClick("left", $XColumn1, $YRow1, 1) $Paused = NOT $Paused $PixelCheck = PixelGetColor($PixelCheckBoatX,$PixelCheckBoatY)
And made it look likeCode:ElseIf $APTimes > 0 Then $APTimes = $APTimes - 1
Any idea where the line of differentiation is between where to have spaces are where not to?Code:ElseIf $APTimes>0 Then $APTimes=$APTimes-1
Last edited by Zaiakunokami; 08-01-2011 at 08:52 PM.
Rules: #1 - #2 - #3
Search Button - By Dracconus ---------------------- Useful Commands - By darkwar4ever
Set-up Vindictus hacks - By crietenz ---------------- Tutorial for SinBotv2.3 - By badhomaks
What commands do in town! - By Zaiakunokami ------ How to put default binds in SinBot - By Zaiakunokami
Rules: #1 - #2 - #3
Search Button - By Dracconus ---------------------- Useful Commands - By darkwar4ever
Set-up Vindictus hacks - By crietenz ---------------- Tutorial for SinBotv2.3 - By badhomaks
What commands do in town! - By Zaiakunokami ------ How to put default binds in SinBot - By Zaiakunokami
I don't understand either, I put the same extract of code on a small context to try it and it's working as it should:
Could it be you made other changes at the same time?Code:$APTimes = 10 If False Then ElseIf $APTimes > 0 Then $APTimes = $APTimes - 1 EndIf msgbox(48, "Alert", $APTimes) ;=> 9
Anyway, I wanted to ask you something Zaiakunokami, how are you developing certain parts of your bots? I'm creating some helpers functions to make my life easier when creating new bots or modifying them, for example here is a lazy working bot for trampled plains:
BUT! Since I just started I'm laking several helpers like error detecting or spending AP which I see you're developing now, so I'm wondering if you are going to release them to see if I can get more ideas on how to work around it or improve what I already haveCode:#include "botlib.au3" Func Bot() $runs = get_runs(10) For $i = 1 To $runs hit_start() skip_map(3) sleep(1000*75) god() ohk() walk("w",8000) While NOT battle_cleared_screen_present() paladin1() tentacle(3) WEnd hit_replay() Next EndFunc
For example for battle_cleared_screen_present() I compare a fixed number of pixels that belong to the "badge" that's shown on the battle screen, is that how you do it or you have another way to tell when the battle has been cleared?
Thank you.
Honestly, your code as it is currently, is more advanced than most of mine. Mine is over-complicated and a jumbled mess.
I'm not an advanced coder, hell, I can't even make a For/Next command work properly. But what I can do is put hours of time into refining the If/ElseIf/Else and While and Do/Until commands that I do understand.
I have the battle cleared screen check for the buttons, as they are 0 black and not easy to replicate in all three spots in any dungeon. Plus, it doubly serves as an error checker, as if two of the buttons are there, but the third is not (which is a common connection time out from host error screen), it knows to move on the the error clearing procedure.
I'm not really a person to go to for coding tips and tricks, as my code isn't pretty. Just functional.
Rules: #1 - #2 - #3
Search Button - By Dracconus ---------------------- Useful Commands - By darkwar4ever
Set-up Vindictus hacks - By crietenz ---------------- Tutorial for SinBotv2.3 - By badhomaks
What commands do in town! - By Zaiakunokami ------ How to put default binds in SinBot - By Zaiakunokami
Paste this into a new script.. Study it and then run the script, it should help you understand how they work.
Code:msgbox("", "ExampleTitle", "We are about to enter the for loop") for $example = 1 to 10 msgbox("", "ExampleTitle", $example) Next msgbox("", "ExampleTitle", "Done")
PLAYING RIFT!
Now that's good info for me, I don't usually bot for more than an hour so I don't see errors to often.
Well, I really don't care if the code is messy or whatever, it's just to get some ideas not replicate it as it is. Anyway, if you finish this I guess that just by the instructions you'll give I'll have an idea of your approach.
Thank you.
btw, I'm not an "advanced coder" either, DanK is one IMO, saw his AutoVin, really neat idea.
Last edited by japmsn; 08-02-2011 at 01:45 PM.
So, for my error checking process, rather than my current:
It should look more like:Code:If $ErrorCountdown = 0 Then Call("Forfeit") Else ToolTip("SinBotv2.2 is now taking steps to remove errors. Waiting for all error messages to appear", 50, 50) Sleep(500) Send("{ALT DOWN}") MouseClick("left", $CloseBattleScreenX, $CloseBattleScreenY, 1) Sleep(500) Send("{ALT UP}") Sleep(500) Do $GameUIErrorPixel = PixelGetColor($GameUIErrorPixelX,$GameUIErrorPixelY) Until $GameUIErrorPixel = 0 Or $GameUIErrorPixel = 12957332 If $GameUIErrorPixel = 0 Then Sleep(1000) Send("{ALT DOWN}") Sleep(100) MouseClick("left",$GameUIErrorPixelX,$GameUIErrorPixelY,1) Sleep(1000) MouseClick("left",$GameUIErrorPixelX,$GameUIErrorPixelY,1) Sleep(100) Send("{ALT UP}") $ErrorCountdown = $ErrorCountdown - 1 Call("LeaveAndRunColhen") ElseIf $GameUIErrorPixel = 12957332 Then $ErrorCountdown = $ErrorCountdown - 1 Call("SelectMap") EndIf EndIf
Do I have this right?Code:For $ErrorCountdown = 1 to 5 ToolTip("SinBotv2.2 is now taking steps to remove errors. Waiting for all error messages to appear", 50, 50) Sleep(500) Send("{ALT DOWN}") MouseClick("left", $CloseBattleScreenX, $CloseBattleScreenY, 1) Sleep(500) Send("{ALT UP}") Sleep(500) Do $GameUIErrorPixel = PixelGetColor($GameUIErrorPixelX,$GameUIErrorPixelY) Until $GameUIErrorPixel = 0 Or $GameUIErrorPixel = 12957332 If $GameUIErrorPixel = 0 Then Sleep(1000) Send("{ALT DOWN}") Sleep(100) MouseClick("left",$GameUIErrorPixelX,$GameUIErrorPixelY,1) Sleep(1000) MouseClick("left",$GameUIErrorPixelX,$GameUIErrorPixelY,1) Sleep(100) Send("{ALT UP}") Call("LeaveAndRunColhen") ElseIf $GameUIErrorPixel = 12957332 Then Call("SelectMap") EndIf Next Call("Forfeit")
Rules: #1 - #2 - #3
Search Button - By Dracconus ---------------------- Useful Commands - By darkwar4ever
Set-up Vindictus hacks - By crietenz ---------------- Tutorial for SinBotv2.3 - By badhomaks
What commands do in town! - By Zaiakunokami ------ How to put default binds in SinBot - By Zaiakunokami
Yeah, five times is my intent. If the bot errors out in attempting to get to the boat 5 times in a row, it assumes that the character is in the wrong spot or is having issues with selecting the boat properly.
In this case it moves on to the function that I have to pull up the cc_shiplist_ui command, and manually select the boat through there and try to attempt to launch it.
One thing that I thought of after writing that block of code, would I need to have an "$ErrorCountdown = 1" somewhere else after a successful boat launch as to reset the counter at that point, or will it run it 5 times (or until successful) every time that it encounters that command?
Rules: #1 - #2 - #3
Search Button - By Dracconus ---------------------- Useful Commands - By darkwar4ever
Set-up Vindictus hacks - By crietenz ---------------- Tutorial for SinBotv2.3 - By badhomaks
What commands do in town! - By Zaiakunokami ------ How to put default binds in SinBot - By Zaiakunokami
Zaiakunokami (08-02-2011)
That's about what I assumed.
One more question on the For usage.
Is it possible to have a For command countdown a variable and do three different conditions instead of two? My newly implemented "Smart AP Spender" has a triple condition style of If/ElseIf/Else/EndIf, where each part is the same variable, but at differing numbers.
Rules: #1 - #2 - #3
Search Button - By Dracconus ---------------------- Useful Commands - By darkwar4ever
Set-up Vindictus hacks - By crietenz ---------------- Tutorial for SinBotv2.3 - By badhomaks
What commands do in town! - By Zaiakunokami ------ How to put default binds in SinBot - By Zaiakunokami
Is there any way to better optimize this code using For/Next or any other commands?Code:Func Skill() If $AP=1 Then If $APTimes>2 Then ToolTip("SinBotv2.2 will launch the skill spending program after " & $APTimes & " more runs.", 50, 50) ElseIf $APTimes=2 Then ToolTip("SinBotv2.2 will launch the skill spending program after " & $APTimes-1 & " more run.", 50, 50) ElseIf $APTimes=1 Then ToolTip("SinBotv2.2 will launch the skill spending program after the current run.", 50, 50) EndIf Sleep($SkillDelay) If $APTimes=0 OR $APTimes<0 Then If $SmartAP=0 Then ToolTip("SinBotv2.2 cannot be stopped during AP spending process. Please wait until finished.", 50, 60) Send("v") Send("{ALT DOWN}") MouseClick("left", $SkillBoxX, $SkillBoxY, 1) ; Selects All Call("SkillSelect") MouseClick("left", $XTab2, $SkillBoxY, 1) ; Combat Call("SkillSelect") MouseClick("left", $XTab3, $SkillBoxY, 1) ; Training Call("SkillSelect6") MouseClick("left", $XTab4, $SkillBoxY, 1) ; Restoration Call("SkillSelect8") MouseClick("left", $XTab5, $SkillBoxY, 1) ; Equipment Call("SkillSelect8") MouseClick("left", $XTab6, $SkillBoxY, 1) ; SP Call("SkillSelect6") Send("{ALT UP}") ElseIf $SmartAP=1 Then Send("v") Send("{ALT DOWN}") MouseClick("left", $SkillBoxX, $SkillBoxY, 1) ; Selects All Call("SkillSelect") EndIf Sleep(500) If FileExists ( $IniFile ) Then $APTimes=IniRead ( $IniFile, "skill", "APTimes", 40) Else $APTimes=40 EndIf Sleep($LaunchButtonDelay) Call("Launch") ElseIf $APTimes>0 Then $APTimes=$APTimes-1 Sleep($LaunchButtonDelay) Call("Launch") EndIf ElseIf $AP=0 Then Sleep($LaunchButtonDelay) Call ("Launch") Else MsgBox(0, "SinBotv2.2", "INI File Error. AP value must be 0 or 1.") Call("ExitBot") EndIf EndFunc
Rules: #1 - #2 - #3
Search Button - By Dracconus ---------------------- Useful Commands - By darkwar4ever
Set-up Vindictus hacks - By crietenz ---------------- Tutorial for SinBotv2.3 - By badhomaks
What commands do in town! - By Zaiakunokami ------ How to put default binds in SinBot - By Zaiakunokami