The Wiki for Tale 4 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

Difference between revisions of "User:Selune/Macros/FlaxMacro 2"

From A Tale in the Desert
Jump to navigationJump to search
(New page: '''For AutoHotKey Version 1.0.47.06 or later''' <pre> #SingleInstance force Flax() return !q:: ExitApp return Flax() { ; Number of weedings required (including harvest) weedings := 3...)
 
(Removing all content from page)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''For AutoHotKey Version 1.0.47.06 or later'''
 
<pre>
 
#SingleInstance force
 
  
Flax()
 
return
 
 
!q::
 
ExitApp
 
return
 
 
 
Flax()
 
{
 
; Number of weedings required (including harvest)
 
weedings := 3
 
 
; Set number of plants to grow ONLY USE ODD DIMENSIONS (for now)
 
; grows ((dimension^2) * cycles) beds, losing one seed (for now)
 
cycles := 1
 
 
; Dimensions work reliably at 3 and 5, at 7 it's a close thing, only use with no lag and max "items on screen"
 
dimension:= 5
 
 
global Xcenter
 
global Ycenter
 
global width
 
 
if ((Mod(dimension, 2) == 0) || (dimension > 7)) {
 
MsgBox Your choice of dimension is not supported! Attempt at your own risk!
 
}
 
 
message := "Please close your friends list and minimize chat and stat tabs in order to ensure proper macroage.`n"
 
message .= "Ensure that ATITD is maximized and that Hotkeys on Flax is disabled`n"
 
message .= "Also disable camera moves very fast and camera moves unreasonably fast.`n`n"
 
message .= "Pin the plant menu at the very top left corner of the screen`n"
 
message .= "Move your mouse to the bottom right corner of your ATITD window and press F1`n`n"
 
message .= "IN CASE OF EMERGENCY: HIT ALT-Q"
 
MsgBox %message%
 
KeyWait, F1, D
 
KeyWait, F1
 
MouseGetPos, Xmax, Ymax
 
 
Send {F5}{F8}{F8}
 
MouseMove, 0,0
 
Sleep 7000
 
Xcenter := Xmax//2
 
Ycenter := Ymax//2 + 19
 
width := 55
 
;Flax beds are ~55 coords wide at this zoom level
 
MouseMove, Xcenter, Ycenter, 0
 
 
Loop 9 {
 
MouseClick, WheelDown
 
Sleep 400
 
}
 
Loop %cycles%
 
{
 
Sleep 500
 
i = 0
 
Loop {
 
i += 1
 
Plant_Row("right", dimension)
 
Move("down")
 
if (i >= dimension)
 
break
 
 
i += 1
 
Plant_Row("left", dimension)
 
Move("down")
 
if (i >= dimension)
 
break
 
}
 
 
half_dim := dimension//2
 
; Rip up middle bed so we can stand there
 
Rip(half_dim)
 
 
Move("left", half_dim)
 
Move("up", half_dim + 1)
 
 
Loop %weedings%
 
{
 
Loop %dimension%
 
{
 
j := A_Index - half_dim - 1
 
Loop %dimension%
 
{
 
i := A_Index - half_dim - 1
 
; Alternate directions
 
if (Mod(Abs(j), 2) == 0) {
 
i *= -1
 
}
 
; Don't try to weed ripped out bed
 
if ((i == 0) && (j == 0))
 
continue
 
 
Weed(i, j)
 
Sleep 400
 
}
 
}
 
}
 
Sleep 1000
 
Move("left", half_dim)
 
Move("up", half_dim)
 
; end of cycle loop
 
}
 
; end of function
 
ExitApp
 
}
 
 
Weed(x, y)
 
{
 
global width
 
global Xcenter
 
global Ycenter
 
 
x *= (width + 2)
 
x += Xcenter + 10
 
y *= width
 
y += Ycenter
 
 
; Display the menu
 
MouseMove, x, y, 0
 
Sleep 10
 
MouseClick, Right
 
 
; Redisplay until "weed" appears
 
Loop {
 
Sleep 100
 
PixelGetColor, color, (x + 20), y
 
R := color & 0xFF0000
 
R >>= 16
 
G := color & 0x00FF00
 
G >>= 8
 
B := color & 0x0000FF
 
 
if ((R > 0) && (R < 120) && (B < 120) && (G < 120)) {
 
Sleep 50
 
MouseMove, x, y, 0
 
Sleep 10
 
MouseClick, Right
 
continue
 
} else {
 
break
 
}
 
}
 
 
; Click "weed"
 
MouseClick, Right, (x + 30), (y - 5),,0
 
}
 
 
Rip(mult)
 
{
 
global width
 
global Xcenter
 
global Ycenter
 
 
x := -(width * mult)
 
y := -((width * mult) + (width - 10))
 
MouseMove, Xcenter, Ycenter, 0
 
Sleep 100
 
MouseMove,x, y, 0, R
 
Sleep 100
 
MouseClick
 
Sleep 100
 
MouseClick,, 20, 10,, 0,, R
 
Sleep 100
 
MouseClick,, 20, -10,, 0,, R
 
Sleep 200
 
MouseClick,, Xcenter, Ycenter,, 0
 
Sleep 200
 
MouseClick,Right , 0, 100,, 0,, R
 
Sleep 100
 
}
 
 
Move(direction, count = 1) {
 
global width
 
global Xcenter
 
global Ycenter
 
 
distance := width * count
 
time := 650 * count
 
MouseMove, Xcenter, Ycenter, 0
 
 
if (direction == "right") {
 
MouseClick,, distance, 0,, 0,, R
 
} else if (direction == "left") {
 
MouseClick,, -(distance), 0,, 0,, R
 
} else if (direction == "down") {
 
MouseClick,, 0, distance,, 0,, R
 
} else if (direction == "up") {
 
MouseClick,, 0, -(distance),, 0,, R
 
}
 
Sleep %time%
 
}
 
 
 
Plant_Row(direction, num)
 
{
 
MouseClick,, 40, 40,, 0
 
if (num <= 0) {
 
return
 
}
 
num -= 1
 
Loop %num% {
 
Move(direction)
 
MouseClick,, 40, 40,, 0
 
}
 
return
 
}
 
</pre>
 

Latest revision as of 01:01, 1 January 2009