Jump to content
Sign in to follow this  
ecstatic

How do i setup a repeating number /w a variable

Recommended Posts

ecstatic

REPOST sory

Edited by ecstatic

Share this post


Link to post
Share on other sites
ecstatic

Hey guys, im kind of new to scripting, and im trying to work around most of my obstacles.

Im wondering, how can i repeat a number for each "game" i make.

Im making a script for diablo II which will increase the game number.

For example.

My script makes game "DiabloMf-1"

How do i get it to then make the next game "DiabloMf-2" and so on and so forth

This is as far as i could get.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

$gamename = IniRead( "configuration.ini", "Game", "gamename", "Gamename-")
$ganepass = IniRead( "configuration.ini", "game", "password", "123")
$difficulty = IniRead( "configuration.ini", "game", "difficulty", "Normal")

#region --- ScriptWriter generated code Start --- 
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("Diablo II","")
If Not WinActive("Diablo II","") Then WinActivate("Diablo II","")
WinWaitActive("Diablo II","")
MouseMove(32359,33038)
MouseDown("left")
MouseUp("left")
MouseMove(568,455)
MouseDown("left")
MouseUp("left")
MouseMove(451,156)
MouseDown("left")
MouseMove(451,155)
MouseUp("left")
Sleep(600)
Send($gamename)
MouseMove(455,204)
MouseDown("left")
MouseUp("left")
Sleep(500)
Send($gamepass)
If $difficulty = 'Normal' Then MouseMove(438,378) MouseDown("left") MouseUp("left") 
If $difficulty = 'Nightmare' Then  MouseMove(563,376) MouseDown("left") MouseUp("left") 
If $difficulty = 'Hell' Then MouseMove(709,375) MouseDown("left") MouseUp("left") 
sleep(500)
MouseMove(707,417)
MouseDown("left")
MouseUp("left")
IniWrite( "Log.ini", "Log", "Last Game Made=" "1")
#endregion --- ScriptWriter generated code End ---

Share this post


Link to post
Share on other sites
Valuater

Maybe...

; at top
Global $count


; Later
$count +=1
IniWrite(( "Log.ini", "Log", "Last Game Made=", $count)

; Or...
$count +=1
IniWrite(( "Log.ini", "Log", "Last Game Made=" & $count, $Game_Info_or_Whatever)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Authenticity

Since the game name is stored in an ini file, you can use a simple counter and increase it each iteration:

Dim $iCounter = 1
Dim $sGameName = IniRead( "configuration.ini", "Game", "gamename", "Gamename-")

While 1
    .
    .

    Send($sGameName & $iCounter, 1) ; 1, so the interpreter won't consider ^ or + as a special meaning key
    $iCounter+=1
WEnd
Edited by Authenticity

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  

×