Sign in to follow this  
Followers 0
iHonda

Looping help plz

13 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

ok i put in the While1 and WEnd. but the script went crazy and i couldnt stop it. the looping worked wonderfully but it just wouldnt stop can you help me??


A great place to start Autoit 1-2-3

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

When you start DII, do you start it from a shortcut (maybe on your desktop)? If so, what are the parameters of the launch?

Share this post


Link to post
Share on other sites

ya i start if off my desktop i use the -skiptobnet and the -w parameters. however i use d2loader cuz i run multiple copies sometimes but not always


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites

Ok, well I have stuff to do today, so I can't help you personally right now. What I can do is suggest you read the helpfile, especially Run, HotKeySet, Win* functions, and search the forum for Diablo II. I know there have been other posts about the game.

Share this post


Link to post
Share on other sites

kk will do thanx


A great place to start Autoit 1-2-3

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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=

Share this post


Link to post
Share on other sites

guys im like super noob i have no clue what im doing i need really detailed help that makes sence to someone that has never done this before


A great place to start Autoit 1-2-3

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