Jump to content

an If and End if situation


Recommended Posts

$D2path = IniRead(@scriptdir & "\Config.ini","D2","Path","")
$D2params = IniRead(@scriptdir & "\Config.ini","D2","Params","")
$D2win = iniread(@Scriptdir & "\Config.ini","D2","D2window name","")
$Account = iniread(@Scriptdir & "\Config.ini","Bnet","Account","")
$Password = iniread(@Scriptdir & "\Config.ini","Bnet","Password","")
$Char = IniRead(@Scriptdir & "\Config.ini","Bnet", "Char","")
while 1
ProcessClose("Dwwin.exe")
$Process="Vex.exe"

    If ProcessExists($Process) Then
        Do
            Sleep(100)
        Until Not ProcessExists($Process)
        ProcessClose("D2Loader-1.11b.exe")
        ShellExecute($D2path,$D2Params)
        Sleep(200)
        Winmove($d2win,"",0,0)
        sleep(600)
        Mouseclick("Left",101,127)
        Sleep(500)
        MouseClick("Left",384,409)
        Sleep(500)
        Mouseclick("left",324,378)
        Sleep(200)
        Send("{Enter}")
        SLeep(100)
        Mouseclick("Left",416,378)
        sleep(1000)
        Mouseclick("Left",392,364)
        Sleep(200)
        Send("^a")
        Sleep(200)
        Send($Account)
        sleep(200)
        Send("{TAB}")
        Sleep(200)
        Send($Password)
        sleep(200)
        Send("{ENTER}")
        sleep(200)
        If $char = "1" Then
            Send("{Enter}")
        ElseIf $Char = "2" Then
            Send("{Right}")
            Send("{Enter}")
        EndIf
WEnd

How do i fix this? the if at process exist & the char select If but i put end if at the end of the process exist part and it continues the code How ever could i throw the char select in a function and call the function im not really good with functions so if it is possiable then i would appreciate an example

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...