## Help me understand this code a little bit better and make a variation of it.

kilpsz
Posts: 12
Joined: 10 Jul 2017, 23:02

### Help me understand this code a little bit better and make a variation of it.

Code: Select all

``````

#IfWinActive Path of Exile
#SingleInstance force
#NoEnv
#Warn
#Persistent

SetTitleMatchMode 3
SendMode Input
CoordMode, Mouse, Client
SetWorkingDir %A_ScriptDir%

global Speed=1
global CellWith=53
global InventoryX=1297
global InventoryY=616

\$!V::CtrlClick(InventoryX,InventoryY)

RandomSleep(min,max){
Random, r, %min%, %max%
r:=floor(r/Speed)
Sleep %r%
return
}

CtrlClick(iX,iY){
BlockInput On
RandomSleep(25,80)
; iX, iY -> Get Pos of top left inventory cell
if iX = -1
MouseGetPos iX,iY

delta := CellWith			;
x := ix
y := iy

Loop 12 { ;			;
Loop 5 { 			;
Mousemove ,%x%, %y%
RandomSleep(5,40)
send ^{Click}
RandomSleep(5,40)

y += delta			;
}
y := iy
x += delta				;
}

BlockInput Off
}``````

I'm trying to figure out how this works so i can make some of my own which basically does what this does but for different variations( i took this out of a multi-functional code which is why it might look too complicated for what it does ?).

Code: Select all

``	if iX = -1``
Im not sure what this is for

Code: Select all

``	r:=floor(r/Speed)``
what does floor(/Speed) mean?

Code: Select all

``````
\$!V::CtrlClick(InventoryX,InventoryY)

CtrlClick(iX,iY)

``````
I understand where the first line calls(?) from, but i don't understand the 2nd one, i assume that it just correlates because of "CtrlClick"?

-

Anyway, im wondering how to add x3(and more) CellWith to the original X Position. /// Oh this one was simple enough

Code: Select all

``````x := ix
y := iy
x += delta * x
``````