Jump to content

Any way to shorten this?


Recommended Posts

Dim $dragA1[2] = "1114, 220"
$dragAc = 0xFFFFFF 
Dim $dragAA1[2]= "1176, 275"
$dragAAc = 0xFFFFFF
Dim $dragB1[2]="566, 194"
$dragBc = 0xFFFFFF 

Dim $dragA2[2] = "$dragA1[0]+1, $dragA1[1]+1"
Dim $dragAA2[2] = "$dragAA1[0]+1, $dragAA1[1]+1"
Dim $dragB2[2] = "$dragB1[0]+1, $dragB1[1]+1"

 

Is there any way I can shorten this or clean it up (ie. too many Dims)? I tried placing as code but the colors were all off.

Link to comment
Share on other sites

Code colors get fixed after finalized post :).

Basically just ignor the first appearance of the code colors and it will turn out fine.

I don't know the goal of the code maybe you could use a 2 dimensional array?  Doesn't really matter.

Link to comment
Share on other sites

As Xandy mentioned you could use 2D Array for example:

#include <Array.au3> ;~ Only required for _ArrayDisplay
Global $aDrag[3][3] = [[1114, 220, "0xFFFFFF"], [1176, 275, "0xFFFFFF"], [566, 194, "0xFFFFFF"]]
For $i = 0 To UBound($aDrag) - 1
    MsgBox(48, "Array Info", "Drag" & $i & " : " & $aDrag[$i][0] + 1 & " - " & $aDrag[$i][1] + 1)
Next
_ArrayDisplay($aDrag)

 

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