Jump to content

I am so lost trying to use arrays.


ratacat
 Share

Recommended Posts

Here is my problem.

I know absolutely nothing about how arrays work and what syntax to use them. I am pretty sure that using an array is what I need to learn to do to solve this particular issue w/o writing a bazillion lines of code, but the last 4.5 hours of guess and check/going through the manual didn't help much. If someone could write a very simple and understandable program that shows an array and a loop of some sort. Data being assigned to the array, and Data being pulled from the array. I'd really really really appreciate it. Thankyou in Advance.

Here is sort of my code and my problem...advice here would be nice too, but I'd really learn best from something like I described above.

;msgbox (262144, "loopreach4", $jumpto)
If $jumpto = "5" then
    WinActivate ("no all-in")
    WinWaitActive ("no all-in")
;msgbox (262144, "funcreach1", $jumpto)
    findseat ( 0, 205, 375)
;msgbox (262144, "funcdone1", $jumpto)
    if $taken = "0" then
    MouseClick("left", 205, 375)
    endif
    if $taken = "1" then
    
    
Endif





func findseat ( $taken, $xs, $ys)
    $checkx = $xs - 8
    $checky = $ys - 8
    MouseMOve ( $xs, $ys)
    sleep (2500)
    $colorcheck = PixelGetColor ( $checkx, $Checky)
;msgbox (262144, "color", $colorcheck)
    if $colorcheck = 16774863 then
    $taken = "1"
    return $taken
    
    
endfunc

What all that is...Lets say I have 9 virtual 'seats'. And I want a script to check them all to see if they are occupied. And then take the first open seat it finds. I have the cords of all 9 seats written down. An occupied seat gets a message pop over it when you leave your mouse their for several seconds...these messages are all the same color. So in my function, I've had the mouse move over the seat, and then grabbed the color of where the message is so see whether it popped up or not. If it happens to be that color, the seat is taken and I want a loop that feeds the next set of cords(out of an array) to the function. If it is free, I simply want it to end where it is at and sit down.

Now again my problem is simply that I can't figure out for the life of me how to get an array to work. Anyone that could shed some light on the matter would be most appreciated.

The script I am trying to write is to automate a bot that plays poker at www.pokerstars.com

So far I've come castly farther then I'd ever expect, given my very limited programming knowledge. I'll keep everyone posted how it turns out.

Link to comment
Share on other sites

Here are some examples.

Is this helpful?

;WITHOUT an array
Dim $var0, $var1, $var2, $var3
$var0 = "value0"
$var1 = "value1"
$var2 = "value3"
$var3 = "value4"

;WITH an array (version 1)
Dim $var[4]
$var[0] = "value0"
$var[1] = "value1"
$var[2] = "value2"
$var[3] = "value3"

;WITH an array (version 2)
Dim $var[4]
For $i = 0 To 3
   $var[$i] = "value" & $i
Next
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...