Sign in to follow this  
Followers 0
verto

Extended If Functions

4 posts in this topic

Ok, sorry, I cant figure out how to edit a post here lol, but heres the scenario broken down nice and simple. I have an If that calls for a value in an ini. Got that part down. Now, the DO function has it do things based on what that variable is (long and extensive amounts of things). So the format I'm using is

IniRead("lockbot" & $ver & ".ini", "zone", "zone", "bg")
#region BGEnter
If $zone = "bg" Then
    Do

And that goes on for a few pages with alot of IF statements. Now, I'm not able to properly test this yet, but when I tried to end the If $zone = "bg" Then part of it WAAAAY down there, it gave me an error or two. So how Can I get a bunch of IF statements (among other things) inside of an IF or the equivalent.

There will be 2 parts to the If $zone = "bg" Then thing, as one will be If $zone <> "bg" Then and will contain a similar array of operations. Select is also used within both of these.

Share this post


Link to post
Share on other sites



Read the help file....

“If” statements must end with “EndIf” statement, and the loop Do...Until canot be ended outside of “If” statement

So this will be wrong:

If 1 = 1 The
  ;do somthing
   Do
     ;Somthing
EndIf
   Unrtil 1 > 0

But this correct:

If 1 = 1 The
  ;do somthing
   Do
     ;Somthing
   Unrtil 1 > 0
EndIf

If you get an error somewhere in your script, we can't gues where the problem, so better post some code where the error is shown.


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Kinda confused at what exactly you want, but you can put as many If's after if after if statements as long as you end them all with endifs, or you can use ElseIf, or Else and son on, maybe if you supplied a complete example instead of 4 lines of code that could help a lil

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Kinda confused at what exactly you want, but you can put as many If's after if after if statements as long as you end them all with endifs, or you can use ElseIf, or Else and son on, maybe if you supplied a complete example instead of 4 lines of code that could help a lil

ok, well i posted this in the other topic, but it was off topic so thats why I made another one here. The source is a lil big, but here it goes. Lemme know if it looks wrong, and im really new to this so it might be a bit sloppy, sorry. Any tips are really appreciated. oh, and it says that the last line has an Until statement with no matching Do statement

IniRead("lockbot" & $ver & ".ini", "zone", "zone", "bg")
#region BGEnter
If $zone = "bg" Then
    Do
    TrayTip("Lock Bot " & $ver & "", "Drawing previous Configurationurations from LockBot" & $ver & ".ini, please wait...", 5) 
Sleep(1000) 

WinActivate("World of Warcraft")
TrayTip("LockBot" & $ver & "", "Maximizing World of Warcraft.", 5)
Sleep(2500)
Do
MouseMove(0, 0)
TrayTip("LockBot" & $ver & "", "Scanning for the Battlemaster.", 5)
Sleep(1500)
$bmfind = PixelSearch(0, 0, 1500, 1500, $battlemasterpix, 1, 1)
if @Error Then
TrayTip("LockBot" & $ver & "", "Adjusting our position, then trying again...", 5)
Send("{D down}")
Sleep(Random(400, 800))
Send("{D up}")
Sleep(Random(400, 800))
Else
TrayTip("LockBot" & $ver & "", "Joining the queue for the battleground.", 5)
Sleep(Random(1000, 2000))
Do
MouseClick("right", $bmfind[0], $bmfind[1], 2)
$queuemaybe = PixelGetColor($gotobgcoordsx, $gotobgcoordsy)
Until $queuemaybe = $gotobgpix
MouseClick("left", $gotobgcoordsy, $gotobgcoordsy, 2)
Sleep(Random(1000, 2000))
MouseClick("left", $joinbattlebuttonx, $joinbattlebuttony, 2)
Sleep(Random(1000, 2000))
MouseClick("left", $joinbattlebuttonx, $joinbattlebuttony, 2)
TrayTip("LockBot " & $ver & "", "Waiting to join the battleground.", 5)
Sleep(Random(1000, 2000))
Do
$inbg = PixelGetColor($joinedbgcoordsx, $joinedbgcoordsy)
Sleep(Random(400, 800))
Until $joinedbgpix <> $inbg
if $travelpath = "ON" Then
If $bgname = "AB" Then
TrayTip("LockBot " & $ver & "", "Running to our faction's primary node.", 5)
Sleep(Random(12000, 13000))
Send("{W down}")
Sleep(Random(3500, 4500))
Send("{W up}")
Sleep(Random(75000, 100000))
Send("{W down}")
Sleep(Random(10000, 12000))
Send("{W up}")
Send("{A down}")
Sleep(Random(200, 500))
Send("{A up}")
Send("{W down}")
Sleep(Random(10000, 11000))
Send("{W up}")
Send("{D down}")
Sleep(Random(200, 500))
Send("{D up}")
Sleep(Random(200, 500))
Send("{W down}")
Sleep(Random(5000, 6500))
Send("{W up}")
EndIf
If $bgname = "AV" Then
TrayTip("LockBot " & $ver & "", "Moving up then dancing.", 5)
Sleep(Random(10000, 20000))
Send("{W down}")
Sleep(Random(15500, 24500))
Send("{W up}")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("/dance")
Sleep(500)
Send("{ENTER}")
Sleep(500)
EndIf
if $bgname = "WSG" Then
Sleep("350000")
Send("e down")
Sleep("4000")
Send("e up")
Send("w down")
Sleep("20000")
Send("w up")
Send("d down")
Sleep("2000")
Send("d up")
Send("w down")
Sleep("45000")
Send("e down")
Sleep("13000")
Send("e up")
Send("w up")
Send("a down")
Sleep("2000")
Send("a up")
Send("w down")
Sleep("30000")
Send("w up")
Send("e down")
Send("{space} 40")
Sleep("35000")
Send("e up")
Send("w down")
Sleep("35000")
Send("a down")
Sleep("3000")
Send("a up")
Sleep("45000")
EndIf
if $excuseon = "NO" Then
Else
Send("{ENTER}")
Sleep(500)
Send($excusemsg)
Sleep(500)
Send("{ENTER}")
Sleep(500)
EndIf
TrayTip("LockBot " & $ver & "", "Anti-AFK mode enabled until the end of the battle.", 5)
Do
MouseMove(0, 0)
$exityet = PixelGetColor($leavebgposx, $leavebgposy)
if $exityet <> $leavebgpix Then
Sleep(Random(30000, 50000))
$direction = Random(1, 4)
if $direction = 1 Then Send("D")
if $direction = 2 Then Send("S")
if $direction = 3 Then Send("A")
if $direction = 4 Then Send("W")
TrayTip("LockBot " & $ver & "", "Anti-AFK mode enabled until the end of the battle.", 5)
EndIf
Until $exityet = $leavebgpix
MouseClick("left", $leavebgposx, $leavebgposy, 2)
$matchesplayed = $matchesplayed + 1
IniWrite("LockBot" & $ver & "Config.ini", "Matches_Last_Session", "MATCHES_PLAYED", $matchesplayed)
Sleep(10000)
EndIf
if $nonstop = 0 Then
Exit
EndIf
#endregion BGEnter
#region _HPWatch()
MemGetStats($health)=ContinueLoop
If($health=<$healthcrit1, $health>=$healthcrit2) Then
    ControlSend($hpstone down)
    Sleep(100)
    ControlSend($hpstone up)
ElseIf($health<=$healthcrit2, $health>=$healthcrit1) Then
    ControlSend($sac down)
    Sleep(100)
    ControlSend($sac up)
EndIf
#endregion _HPWatch
Until $zone <> "bg"
Edited by verto

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0