Jump to content

Can a loop create variables?


Recommended Posts

I've been doing a little experiment lately.

Basically I'm too lazy to manually create sixty variables

I have a script that does this test for me http://mindbluff.com/reaction.htm , it stores all the the x,y coords of everything it clicks and can output it wherever. This great ;however, what I really want to do is gather the reoccourance of each dot and then out put how many times it click on each one.

How I plan on doing it is creating sixty variables with the x,y coords of every dot in it and then just compare the gathered int to each variable in yet another loop

code:

$count = ""
$paste = ""
$counter = 0

hotkeyset ("{F1}", "Terminate") 
Func Terminate() 
    WinActivate("Untitled - Notepad")
    Send ($count)
    Exit 1
EndFunc



MsgBox(1,"1","http://mindbluff.com/reaction.htm")
Sleep (3000)
    Opt("PixelCoordMode", 2)
    Opt("MouseCoordMode", 2)
MouseClick("left",530,314,1,5)
MouseWheel ("down",5)
sleep (10)
MouseClick("left")

While 1
If $counter = 250 Then
    Send ("{F1}")
EndIf

    
For $h = 515 to 749 Step 26
    For $v = 408 to 513 Step 21
        $color = PixelGetColor ($h,$v)
        if $color = 3717429 Then
            MouseClick ("left",$h,$v,1,0)
            $count &= $h &","& $v &"{Enter}"
        EndIf
    Next
Next
WEnd
Link to comment
Share on other sites

I got 2024 with this code:

#include <IE.au3> 
#include <Array.au3>

$oIe = _IECreate("http://mindbluff.com/reaction.htm")
_IELoadWait($oIe)

$oForm = _IEFormGetObjByName( $oIe, "cpanel")
$oStartButton = _IEFormElementGetObjByName($oForm, "startstop")
_IEAction($oStartButton, "click")

$time = TimerInit()
$diff = 0

$oDMZForm = _IEFormGetObjByName( $oIe, "dmz")
$oObjects = _IEFormElementGetCollection ( $oDMZForm )

while $diff < 30000
    for $oObject in $oObjects
        if $oObject.type = "radio" Then
            if $oObject.checked Then
                _IEAction($oObject, "click")
            EndIf
        EndIf
    Next
    $diff = TimerDiff($time)
WEnd
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

as for your question, the answer is arrays, see:

#include <Array.au3>

MsgBox(1,"1","http://mindbluff.com/reaction.htm")
Sleep (3000)
Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)
MouseClick("left",530,314,1,5)
MouseWheel ("down",5)
sleep (10)
MouseClick("left")

$numDots = 60
Dim $aTimesClicked [61]
$aTimesClicked[0] = 60

for $x = 1 to 60
    $aTimesClicked[$x] = 0
Next

While 1
    
    $count = 0
    For $h = 515 to 749 Step 26
        For $v = 408 to 513 Step 21
            $count += 1
            $color = PixelGetColor ($h,$v)
            if $color = 3717429 Then
                MouseClick ("left",$h,$v,1,0)
                $aTimesClicked[$count] += 1
            EndIf
        Next
    Next
    
WEnd

_ArrayDisplay($aTimesClicked)

untested cause u used your coords, it should work tho

Edited by ame1011
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

whim - you need something more productive to do with your time if you are just hacking this silly, silly game.

But two dimensional arrays are good to learn about.

What people do with their time is their business. The same could be said for people criticizing other people for using their time to do as they wish ...

I actually reccomend finding small projects such as simple games to automate in order to learn auto-it; it's how I got started.

Additionally Squirrely, don't feel like you need to respond to all the threads on this board, 90% of your comments are comprised of verbal diarrhea. If you have nothing to add to a thread, "you need something more productive to do with your time"

Edited by ame1011
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

What people do with their time is their business. The same could be said for people criticizing other people for using their time to do as they wish ...

I actually reccomend finding small projects such as simple games to automate in order to learn auto-it; it's how I got started.

Additionally Squirrely, don't feel like you need to respond to all the threads on this board, 90% of your comments are comprised of verbal diarrhea. If you have nothing to add to a thread, "you need something more productive to do with your time"

HAHAHHA Yes you are correct, I don't want to bet money but he will most likely refer to #9 in his signature.

Link to comment
Share on other sites

@Squirrely1

Don't worry - I never play computer games. But, although I find the idea of writing game

bots rather strange (working, to be able to play without working ???) that does not mean

that I'm not willing to contribute to anybody who is trying to figure out some scripting

problem, as long as they're not just whining for drop-in, plug & play solutions.

@ame1011

Actually, for me it is about learning posting in forums. For learning AutoIt I prefer reading

the forum and experimenting. Just an old hobby programmer, I guess (Sinclair Spectrum,

Z80 assembly, anyone ?)

wim

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...