Jump to content

Looping help plz


Recommended Posts

Hey guys I'm writing a script for an IdleBot that is meant for Diablo II. I use the loader so i have that in the script but, anyway i need to get it to repeat a certain part of the script over and over untill the user clicks the close button.

; AutoIt Version: 3.1.0

; Author: Zmaster)atF( <Clan.atf@gmail.com>

;----------------------------------------------------------

; Script Start

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$mainwindow = GUICreate("IdleBot By: Zmaster)atF

(", 300, 100)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUICtrlCreateLabel("Thank You for downloading

IdleBot By: Zmaster)atF(", 30, 10)

$okbutton = GUICtrlCreateButton("START", 115, 50,

70)

GUICtrlSetOnEvent($okbutton, "OKButton")

GUISetState(@SW_SHOW)

While 1

Sleep(1000) ; Idle around

WEnd

Func OKButton()

;Note: at this point @GUI_CTRLID would equal

$okbutton,

;and @GUI_WINHANDLE would equal $mainwindow

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send ("----DO NOT CLOSE THIS WINDOW----{ENTER}")

Send ("This file will be closed when you end the

bot.{ENTER 2}")

WinActivate ("D2Loader v1.11b - Build On Nov 11

2005", "")

;---loop begin---;

MouseClick ("left", 567, 351)

Sleep (500)

MouseClick ("left", 567, 351)

Sleep (500)

MouseClick ("left", 567, 351)

Sleep (500)

WinActivate ("Untitled - Notepad")

Send ("Loop finished starting over {ENTER}")

;---loop end---;

EndFunc

Func CLOSEClicked()

;Note: at this point @GUI_CTRLID would equal

$GUI_EVENT_CLOSE,

;and @GUI_WINHANDLE would equal $mainwindow

WinClose("Untitled - Notepad")

WinWaitActive("Notepad", "The text in the Untitled file has changed")

Send("!y")

Exit

EndFunc

i need the parts between the loop begin and loop end comments to loop

A great place to start Autoit 1-2-3

Link to comment
Share on other sites

Since you are using GUIOnEventMode, the events should register wherever you are in the script. Therefore, all you would have to do is surround your looping code with While 1 (at the top) and WEnd (at the bottom).

However, if I recall correctly, there might be an issue with GUI events while inside functions... so just try that change and let me know if it doesn't work.

Link to comment
Share on other sites

I don't like the way this is going...

Can you explain what you want your script to do, so one of us will be able to help revise it? Using MouseClicks and Send() for text to notepad is a very primitive and ineffective way of scripting - with more information we could easily rewrite it.

Link to comment
Share on other sites

kk. the purpose of this script is to give blizzard the impretion that someone is at the computer controling the character thus preventing them from getting dropped out of their game or room. All that the script needs to do is move the character or say something in the game every 5-7 min. The notepad thing is just there to make sure that the looping is working.

A great place to start Autoit 1-2-3

Link to comment
Share on other sites

I understand what an anti-idle bot is supposed to do. What I meant was.. what exactly are you doing with your script? Are you.. starting DII? Logging in? Joining a game? Simply waiting for the user to have started the game, joined/created a game, and then just click every once in a while?

Look in the helpfile under HotKeySet. That's most likely what you want.

Oh, and is anyone else going to be in the game at the same time as you? Or are you the only character in the game at any one time? In other words, public or private game? It makes a difference for my future suggestions.

Edited by greenmachine
Link to comment
Share on other sites

I originally wanted it to start DII but i couldnt figure out how so i went with having it open and already in a game but i really would like it to start DII log in to bnet join a private game and keep the char in that game. my friends might use the game to xfer while the bot is idling

A great place to start Autoit 1-2-3

Link to comment
Share on other sites

What about looking at the helpfile for hotkeyset(). You can use it to turn things on and off using hotkeys.

Example-

HotKeySet("{PAUSE}", "start")
HotKeySet("{ESC}", "stop")
dim $gonopping

func start()
$gonopping=1
while $gonopping==1
;Started
wend
Endfunc

func stop()
$gonopping=0
Endfunc

while 1
wend

Hotkeys are always a good thing to use for ingame interference.

Edited by =sinister=
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...