Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm converting autohotkey to QM and
#1
I really don't understand reference variables

in AHK, something like this...

Loop, 5
{
N:=N+1
A%N%:=N
}
Return

And I don't know what to do in QM especially %N%... Help me bros...
#2
I guess A%N% is N-th element of array A. Then in QM would be:

Macro Macro2522
Code:
Copy      Help
int N
ARRAY(int) A.create(5) ;;create 0-based array of 5 elements
rep 5
,N+1
,A[N-1]=N ;;set element
ret
or
Macro Macro2522
Code:
Copy      Help
int N
ARRAY(int) A.createlb(5 1) ;;create 1-based array of 5 elements
rep 5
,N+1
,A[N]=N ;;set element
ret
or
Macro Macro2522
Code:
Copy      Help
int N
ARRAY(int) A
rep 5
,N+1
,A[]=N ;;add and set element
ret
#3
OH THANK YOU VERY MUCH SIR...

BTW is variable A1, A2, A3, A4, A5 same?

is the result A[1] A[2].... or something?
#4
I Tried

out A[]

is 0

but

out A[5]

is

"Error (RT) in <open ":1: /4795">Macro2: invalid index. <help #IDP_ERR>?"
#5
int A1, A2, A3, A4, A5
five variables

ARRAY(int) A
A[1], A[2] etc are elements of variable A
#6
A[] adds one element, ie resizes the array

A[5] is sixth element of 0-based array. The array must have 6 or more elements, else error.
ARRAY(int) A.create(5)
out a[0]
out a[1]
out a[2]
out a[3]
out a[4]
out a[5] ;;error, the array does not have a[5]
#7
Thank you very very much... I learned it...

I decided use creatlb method Not to confuse... it seems...

Have a good day~~
#8
I saw your PixelSearch function, then the topic disappeared. It would be correct, but function pixel() is slow... This is faster version:
Function PixelSearch
Code:
Copy      Help
function# SX SY EX EY color [VAR] [POINT&p]

;Searches a region of the screen for a pixel of the specified color.
;Returns: 1 found, 0 not.

;SX, SY - top-left coord of the search region relative to the active window.
;EX, EY - bottom-right coord. The point is inside the search region.
;color - search for this pixel color, in 0xBBGGRR format.
;VAR - allowed color component difference, 0-255.
;p - optional POINT variable that receives found pixel coordinates in screen.

;EXAMPLE
;POINT p
;if PixelSearch(552 21 592 51 0x2f59fd 0 p)
;,mou p.x p.y


opt noerrorshere 1
RECT r; SetRect &r SX SY EX+1 EY+1
if(!scan(F"color:{color}" win r 0 VAR)) ret
if(&p) p.x=r.left; p.y=r.top
ret 1
#9
WOW (-.-);; Thank you I'll try this .... wow wow...

I'm trying to fly on earth and you're exploring space..;
#10
"Error (RT) in Macro2: object not found. "

repeats..

I called your Function like this

DX = PixelSearch(123 123 123 123 0xFFFFFF 3)
#11
Sorry, must be scan(F"color:{color}" win r 0 VAR), not scan(F"color:{color}" win r VAR). Now fixed.


Forum Jump:


Users browsing this thread: 2 Guest(s)