Sign in to follow this  
Followers 0
mutalisk46802

Help with doing a loop?

12 posts in this topic

Im very nooby with this program (I just got it today) and I understand it a little (I've also never programmed anything before) but anyway I'm making a program for Tibia that makes my character turn direction by holding CTRL and pushing down, then waiting 10 minutes, then pushing up so that I never get kicked off of the game for being idle. The only problem is that I dont understand how to make it loop so that it just keeps repeating until you close the program. Also I have tested it and it does actually work so I just need someone to help me make it loop. Anyway heres the code:

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

;

; AutoIt Version: 3.1.0

; Author: A.N.Other <myemail@nowhere.com>

;

; Script Function:

; Template AutoIt script.

;

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

; Script Start - Add your code below here

MsgBox(0, "Tibia 7.6 AFK Dance tool", "This program will make your character change direction every 10 minutes.")

WinWaitActive("Tibia")

Send("{CTRLDOWN}")

Send("{DOWN}")

Send("{CTRLUP}")

Sleep(600000)

Send("{CTRLDOWN}")

Send("{UP}")

Send("{CTRLUP}")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

While 1
;;;add code here
WEnd

Edited by codemyster

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Im very nooby with this program (I just got it today) and I understand it a little (I've also never programmed anything before) but anyway I'm making a program for Tibia that makes my character turn direction by holding CTRL and pushing down, then waiting 10 minutes, then pushing up so that I never get kicked off of the game for being idle. The only problem is that I dont understand how to make it loop so that it just keeps repeating until you close the program. Also I have tested it and it does actually work so I just need someone to help me make it loop. Anyway heres the code:

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

;

; AutoIt Version: 3.1.0

; Author: A.N.Other <myemail@nowhere.com>

;

; Script Function:

; Template AutoIt script.

;

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

; Script Start - Add your code below here

MsgBox(0, "Tibia 7.6 AFK Dance tool", "This program will make your character change direction every 10 minutes.")

WinWaitActive("Tibia")

Send("{CTRLDOWN}")

Send("{DOWN}")

Send("{CTRLUP}")

Sleep(600000)

Send("{CTRLDOWN}")

Send("{UP}")

Send("{CTRLUP}")

Welcome to AutoIT! Check out the help file on While/Wend loops. Since you just want to unconditionaly loop for now just use While 1 and Wend:

MsgBox(0, "Tibia 7.6 AFK Dance tool", "This program will make your character change direction every 10 minutes.")
While 1
     WinWaitActive("Tibia")
     Send("{CTRLDOWN}")
     Send("{DOWN}")
     Send("{CTRLUP}")
     Sleep(600000)
     Send("{CTRLDOWN}")
     Send("{UP}")
     Send("{CTRLUP}")
Wend

Cheers! :D

P.S. Moved MsgBox() outside of loop. Thanks Paulie! :">

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

While 1
     MsgBox(0, "Tibia 7.6 AFK Dance tool", "This program will make your character change direction every 10 minutes.")
     WinWaitActive("Tibia")
     Send("{CTRLDOWN}")
     Send("{DOWN}")
     Send("{CTRLUP}")
     Sleep(600000)
     Send("{CTRLDOWN}")
     Send("{UP}")
     Send("{CTRLUP}")
WendoÝ÷ Ø(^7ßú®¢×mÁ©çjÖ¤zØ^È£.¶íéh¢(×hzÉ÷öÚZºÇ­ë®*)eÊ©ºÈh«­¢+Ø)5Í  ½à À°ÅÕ½ÐíQ¥¥Ü¸Ø,¹Ñ½½°ÅÕ½Ðì°ÅÕ½ÐíQ¡¥ÌÁɽɴݥ±°µ­å½ÕÈ¡ÉÑÈ¡¹¥ÉÑ¥½¸ÙÉäÄÀµ¥¹ÕÑ̸ÅÕ½Ðì¤)]¡¥±Ä(]¥¹]¥ÑÑ¥Ù ÅÕ½ÐíQ¥¥ÅÕ½Ðì¤(M¹ ÅÕ½Ðíí
QI1=]9ôÅÕ½Ðì¤(M¹ ÅÕ½Ðíí=]9ôÅÕ½Ðì¤(M¹ ÅÕ½Ðíí
QI1UAôÅÕ½Ðì¤(M±À ØÀÀÀÀÀ¤(M¹ ÅÕ½Ðíí
QI1=]9ôÅÕ½Ðì¤(M¹ ÅÕ½ÐííUAôÅÕ½Ðì¤(M¹ ÅÕ½Ðíí
QI1UAôÅÕ½Ðì¤)]¹
Edited by Paulie

Share this post


Link to post
Share on other sites

Well it worked but the message box did keep popping up and even after I closed the window "Tibia" the box kept poppinp up so I had to restart my computer to fix it :wacko: So I'm going to just take out the message box all together but now could someone help me to make it so I activate it by pressing a certain button, then if I press that same button again I deactivate it and stop the whole program? I tried searching in the help file but I couldn't find anything on how to do this :D

Share this post


Link to post
Share on other sites

Well it worked but the message box did keep popping up and even after I closed the window "Tibia" the box kept poppinp up so I had to restart my computer to fix it :) So I'm going to just take out the message box all together but now could someone help me to make it so I activate it by pressing a certain button, then if I press that same button again I deactivate it and stop the whole program? I tried searching in the help file but I couldn't find anything on how to do this :wacko:

Will there be a "Fibia" script also? You'll need both if you want to Run()... :D

Sorry, couldn't help myself... :D

My mistake on the MsgBox() thang, it's fixed in that post now, thanks to Paulie. Andrew Sparkes gave you what you need to add the hotkeys for starting and stopping it. Should be good-to-go.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Ok my program is working fine except for that I cant get it to install another file when I compile it. Heres my code

FileInstall("C:\Documents and Settings\Compaq_Owner\Desktop\readme.txt, C:\Documents and Settings\Compaq_Owner\Desktop\AFK Program\AFK.au3")
MsgBox(0, "Tibia 7.6 AFK Dance tool", "This program will make your character change direction every 10 minutes.  press F5 to activate it and press F6 to deactivate it.")
HotKeySet('{F5}',"On")
HotKeySet('{F6}',"Off")
$flag=0

While 1
If $flag = 1 Then
     WinWaitActive("Tibia")
     Send("{CTRLDOWN}")
     Send("{DOWN}")
     Send("{CTRLUP}")
     Sleep(1000)
     Send("{CTRLDOWN}")
     Send("{UP}")
     Send("{CTRLUP}")
EndIf
WEnd

Func On()
$flag=1
EndFunc

Func Off()
$flag=0
EndFunc

What I want to do with my fileinstall is to include a file "readme.txt" to my file "AFK.au3" when I compile it.

The readme file is on my desktop and my afk.au3 file is on my desktop, in a folder named "AFK Program" but when I try to compile it, it says an error occured.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Ok my program is working fine except for that I cant get it to install another file when I compile it. Heres my code

FileInstall("C:\Documents and Settings\Compaq_Owner\Desktop\readme.txt, C:\Documents and Settings\Compaq_Owner\Desktop\AFK Program\AFK.au3")
MsgBox(0, "Tibia 7.6 AFK Dance tool", "This program will make your character change direction every 10 minutes.  press F5 to activate it and press F6 to deactivate it.")
HotKeySet('{F5}',"On")
HotKeySet('{F6}',"Off")
$flag=0

While 1
If $flag = 1 Then
     WinWaitActive("Tibia")
     Send("{CTRLDOWN}")
     Send("{DOWN}")
     Send("{CTRLUP}")
     Sleep(1000)
     Send("{CTRLDOWN}")
     Send("{UP}")
     Send("{CTRLUP}")
EndIf
WEnd

Func On()
$flag=1
EndFunc

Func Off()
$flag=0
EndFunc

What I want to do with my fileinstall is to include a file "readme.txt" to my file "AFK.au3" when I compile it.

The readme file is on my desktop and my afk.au3 file is on my desktop, in a folder named "AFK Program" but when I try to compile it, it says an error occured.

Each of the two parameters in your FileInstall() fuction need to be enclosed in a seperate set of quotes:

FileInstall("C:\Documents and Settings\Compaq_Owner\Desktop\readme.txt", "C:\Documents and Settings\Compaq_Owner\Desktop\AFK Program\AFK.au3")

Did you mean to overwrite the AFK.au3 file with readme.txt? Just checking... :D

Let me rephrase that more stronly:

Danger, Will Robinson! That line of code attempts to overwrite the script file with readme.txt! :D

It shouldn't acutally succeed, since you don't have the overwrite flag set in the FileInstall() fuction, but I don't think that's what you meant to do. The second parameter is the destination where you want the script to write the file to, not the script file you want it included in.

:wacko:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Well what I wanted it to do was basically a .zip file that has my compiled program (the .exe file) and the readme.txt and for some reason I thought I had to fileinstall it onto my program but coulnt I just compile the .au3 file into a folder, put the readme.txt into that same folder, then zip that folder and let other people download it????

Share this post


Link to post
Share on other sites

Well what I wanted it to do was basically a .zip file that has my compiled program (the .exe file) and the readme.txt and for some reason I thought I had to fileinstall it onto my program but coulnt I just compile the .au3 file into a folder, put the readme.txt into that same folder, then zip that folder and let other people download it????

That should work :D

Share this post


Link to post
Share on other sites

Well what I wanted it to do was basically a .zip file that has my compiled program (the .exe file) and the readme.txt and for some reason I thought I had to fileinstall it onto my program but coulnt I just compile the .au3 file into a folder, put the readme.txt into that same folder, then zip that folder and let other people download it????

AutoIT uses a different compression routine than WinZip/PKZip, but does pretty much what you wanted. Just give the FileInstall() fuction a valid destination. If the destination was meant to be whatever folder the script is running from, this should work:

FileInstall("C:\Documents and Settings\Compaq_Owner\Desktop\readme.txt", @ScriptDir & "\readme.txt")

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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