Sign in to follow this  
Followers 0
TK_Incorperate

EndFunc without ending script?

7 posts in this topic

#1 ·  Posted (edited)

Ok well i'm trying to create a spam bot for D2... and it was going good all up until one part.... well see this bot enters games, so in order to do so i want people to have a choice, to either do normal, nightmare, or hell games... and to do so they'd have to chose a character witch can join either nightmare or hell if they want it... so what i've done is added a char selection function, thats tied to .ini...

Now for the problem, i tried putting other things AFTER the functions, and it wont work... i guess the endfunc ends the script completely, cuz once its done chosing the character, the script closes... and i was just wondering if i could do these functions without the "EndFunc" ending the script completely...

Now in my script (witch i will show you soon) after the funcs i have put the enter game sequence, and i've even tried putting it before the funcs right after it reads the char from the .ini and it still wont do anything else after it choses the character.

Here's the script so far. (yes there's going to be more then 2 characters selectable, that's just for testing)

Send("{ALT}+{TAB}")
WinMove("Diablo II", "", 0, 0)
    Sleep(2000)
    MouseClick("left", 300, 375)
        Sleep(4000)

Send("{TAB}")
    $Acct = IniRead("TKPB.ini", "Spam Bot Main", "Acct", "acct")
        Send($Acct)
        Send("{TAB}")
    $Pass = IniRead("TKPB.ini", "Spam Bot Main", "Pass", "pass")
        Send($Pass)
        Send("{ENTER}")
    
$Char = IniRead("TKPB.ini", "Spam Bot Main", "Pos", "1")
    If $Char = 1 Then Char1()
    If $Char = 2 Then Char2()

Func Char1()
    Sleep(3000)
        MouseClick("left", 182, 157)
        Send("{ENTER}")
EndFunc

Func Char2()
    Sleep(3000)
        MouseClick("left", 453, 154)
        Send("{ENTER}")
EndFunc

MouseClick("left", 182, 157)
    $Game = IniRead("TKPB.ini", "Entering Game", "Game", "GamerzVault.com")
        Send($Game)
        Send("{TAB}")
    $Gp = IniRead("TKPB.ini", "Entering Game", "Pass", "TK_Incorperate")
        Send($Gp)
        Send("{ENTER}")
Edited by TK_Incorperate

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

No, EndFunc will not end the script.

Since I do not now this game-dialog, I'd suggest that you add a debug MsgBox to see what's going on. Maybe there should be another sleep (X*1000 ) ?

Edited by dabus

Share this post


Link to post
Share on other sites

1) I dont know how to add a debug msgbox and dont know the purpose of that anyways

2) I tried adding another sleep inside the func's and outside of them, and it doesnt help any

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok i tried deleting the first thing that comes after the functions, witch is the mouseclick, and put in a delay so i could make the click myself... and it seems it works fine, it was the mouseclick that was causing the script to exit... but i looked at it and it dont appear to have anything wrong with it... any ideas?

Edit: i even tried putting the mouseclick in the func... still didnt work

Edited by TK_Incorperate

Share this post


Link to post
Share on other sites

Well, I doubt seriously it was the mouseclick. When you call a function, are you returning to a loop? If you do not have a loop in your script, it will exit after all the commands have been done.

And if you are going to say "Yes" there is a loop... Before doing that and someone else replying... 'Well show us the loop', go ahead and post the rest of the script.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

lol nevermind, i found out what my problem was :P lol and it was the mouseclick, thanks anyways :lmao:

~TK

Share this post


Link to post
Share on other sites

Well since you asked for help, do you mind posting exactly what the solution was, in case someone does a search, comes across your thread as something they think might be their problem.... See's there was a solution, but there is none there. Could frustrate some new/old members.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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