Sign in to follow this  
Followers 0
XxxKills

Question regarding looping

4 posts in this topic

First off this is my first post here and ive only been working with autoit for about 4 days so please be patient with me.

Ill try to explain in the best way i can.

I'm trying to loop a create game, while makeing the game name with increments of + 1 (mybaal-1, next game would be mybaal-2)

Ive gotten the loop game to work, but not the game name part. It continuosly puts the 1 at the end of the game name.

While 1

Global $count

MouseClick("left", 640, 485)

Dim $iCounter = 1

$GameName = IniRead("Log.ini", "Log","Last Game Made", $iCounter)

Dim $GameName = IniRead("Settings.ini", "GameName", "GameName", "Default")

MouseClick("left", 712, 461,1)

Sleep (500)

Send($GameName & $iCounter, 1) ; 1, so the interpreter won't consider ^ or + as a special meaning key

$iCounter+=1

IniWrite("Log.ini", "Log","Last Game Made=",$iCounter)

Sleep (500)

Send("{TAB}")

Sleep (500)

$GamePass = IniRead("Settings.ini", "GamePass", "GamePass", "Default")

Sleep (500)

Send($GamePass)

Sleep (500)

Send("{enter}") ;enters game

Sleep (5000)

Send("{TAB}") ; turns on mimi map

;Do actions, else

Sleep (30000)

Send ( "{ESC}" )

Sleep (200)

Send ( "{UP}" )

Sleep (200)

Send ( "{ENTER}" )

Sleep (10000)

WEnd

EndFunc

like I said it loops the game make but not the name change, and in the log file it lists : Last Game Made==1 each time

so what the heck am i doing wrong lol? if any one can help I would greatly apprieciate it. thank u in advance for any one who has the patience to help.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Dim $iCounter = 0
Global $count 

While 1 
$iCounter+=1
MouseClick("left", 640, 485)
$GameName = IniRead("Log.ini", "Log","Last Game Made", $iCounter)
Dim $GameName = IniRead("Settings.ini", "GameName", "GameName", "Default")
MouseClick("left", 712, 461,1)
Sleep (500) 
Send($GameName & $iCounter, 1); 1, so the interpreter won't consider ^ or + as a special meaning key
IniWrite("Log.ini", "Log","Last Game Made=",$iCounter)
Sleep (500)
Send("{TAB}")
Sleep (500)
$GamePass = IniRead("Settings.ini", "GamePass", "GamePass", "Default")
Sleep (500)
Send($GamePass)
Sleep (500)
Send("{enter}");enters game
Sleep (5000)
Send("{TAB}"); turns on mimi map

;Do actions, else 
Sleep (30000)
Send ( "{ESC}" )
Sleep (200)
Send ( "{UP}" )
Sleep (200)
Send ( "{ENTER}" )
Sleep (10000)
WEnd
EndFunc

Edited by Zedna

Share this post


Link to post
Share on other sites

First off this is my first post here and ive only been working with autoit for about 4 days so please be patient with me.

Ill try to explain in the best way i can.

I'm trying to loop a create game, while makeing the game name with increments of + 1 (mybaal-1, next game would be mybaal-2)

Ive gotten the loop game to work, but not the game name part. It continuosly puts the 1 at the end of the game name.

While 1

Global $count

MouseClick("left", 640, 485)

Dim $iCounter = 1

$GameName = IniRead("Log.ini", "Log","Last Game Made", $iCounter)

Dim $GameName = IniRead("Settings.ini", "GameName", "GameName", "Default")

MouseClick("left", 712, 461,1)

Sleep (500)

Send($GameName & $iCounter, 1) ; 1, so the interpreter won't consider ^ or + as a special meaning key

$iCounter+=1

IniWrite("Log.ini", "Log","Last Game Made=",$iCounter)

Sleep (500)

Send("{TAB}")

Sleep (500)

$GamePass = IniRead("Settings.ini", "GamePass", "GamePass", "Default")

Sleep (500)

Send($GamePass)

Sleep (500)

Send("{enter}") ;enters game

Sleep (5000)

Send("{TAB}") ; turns on mimi map

;Do actions, else

Sleep (30000)

Send ( "{ESC}" )

Sleep (200)

Send ( "{UP}" )

Sleep (200)

Send ( "{ENTER}" )

Sleep (10000)

WEnd

EndFunc

like I said it loops the game make but not the name change, and in the log file it lists : Last Game Made==1 each time

so what the heck am i doing wrong lol? if any one can help I would greatly apprieciate it. thank u in advance for any one who has the patience to help.

Welcome to th eAutoIt forums Xxxkills :D

There are a couple of things you need to change. The line

Dim $iCounter = 1

sets the value of $iCounter to 1 each time the loop is run, so it needs to be outside of the loop before the While.

You have a line which has no effect

$GameName = IniRead("Log.ini", "Log","Last Game Made", $iCounter);<----------has no effect because $Ga=meName is immediately replaced on next line
Dim $GameName = IniRead("Settings.ini", "GameName", "GameName", "Default")

You can make your code in posts easier for people to read if you

use the Tidy feature in SciTE if you use that editor. (Tools|Tidy AutoIt Source or Ctrl T.)

use [ co d e ] before and [ / c o d e ] after your code but without th espaces I added to ensure they aren't used as tags.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

ahhhh tytytyty, Ive had a migrain trying to fiqure that out.I appricieate the tips and whyfors also, that helps me understand why I needed to change those, man ty.

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