Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
311 views3 pages

PTHT

This document provides code for an automated farming script in Magium. It includes functions to count existing trees and harvest-ready trees, paths to move platforms and plant/harvest, and a main loop to harvest then plant continuously. Key elements include plant and tree IDs, platform count, world type, and coordinates for scanning and acting on tiles. The script runs initialization, prints credits, then enters an infinite loop to harvest and replant every 200ms.

Uploaded by

preloggt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
311 views3 pages

PTHT

This document provides code for an automated farming script in Magium. It includes functions to count existing trees and harvest-ready trees, paths to move platforms and plant/harvest, and a main loop to harvest then plant continuously. Key elements include plant and tree IDs, platform count, world type, and coordinates for scanning and acting on tiles. The script runs initialization, prints credits, then enters an infinite loop to harvest and replant every 200ms.

Uploaded by

preloggt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

plantid = 5640 -- This is itemid to plant with using magplant.

platformid = 6984 -- slime platform


treeid = 13903 -- Treeid is required to what to harvest, check trees (13945 is pog
seed id do not change)
world = "island" -- Type normal if you're planting in normal world (recommended
island)

EditToggle("ModFly", true)

if world == "island" then


ex = 199
ey = 193
elseif world == "normal" then
ex = 99
ey = 53
end

function path(x, y, platformid)


SendPacketRaw(false, {platformid = platformid,
px = x,
py = y,
x = x*32,
y = y*32})
end

function h2(x, y, id)


SendPacketRaw(false,{type = 3,
value = id,
px = x,
py = y,
x = x*32,
y= y*32})
end

function getTree()
local count = 0
for y = ey, 0, -1 do
for x = 0, ex, 1 do
if GetTile(x, y).fg == 0 and (GetTile(x, y + 1).fg ~= 0 and GetTile(x, y + 1).fg %
2 == 0) then
count = count + 1
end
end
end
return count
end

function getReady()
local ready = 0
for y = ey, 0, -1 do
for x = 0, ex, 1 do
if GetTile(x, y).fg == 13903 and GetTile(x, y).readyharvest then
ready = ready + 1
end
end
end
return ready
end
function harvest()
if getReady() > 0 then
for y = ey, 0, -1 do
for x = 0, ex, 1 do
if (GetTile(x, y).fg == 13903 and GetTile(x, y).readyharvest) then
path(x, y, platformid)
Sleep(500)
h2(x, y, 18)
Sleep(100)
end
end
end
end
end

function uws()
if getTree() == 0 then
Sleep(500)
SendPacket(2, "action|dialog_return\ndialog_name|ultraworldspray")
Sleep(2000)
harvest()
elseif getTree() ~= 0 then
plant()
Sleep(1000)
end
end

function plant()
if getReady() < platformid then
for y = ey, 0, -1 do
for x = 0, ex, 10 do
if GetTile(x,y).fg == 0 and (GetTile(x,y+1).fg ~= 0 and GetTile(x,y+1).fg %2 == 0)
then
path(x, y, 32)
Sleep(50)
h2(x, y, plantid)
Sleep(100)
end
end
for x = ex, 0, -1 do
if GetTile(x,y).fg == 0 and (GetTile(x,y+1).fg ~= 0 and GetTile(x,y+1).fg %2 == 0)
then
path(x, y, 48)
Sleep(50)
h2(x, y, plantid)
Sleep(100)
end
end
end
end
uws()
end

for i = 5, 1, -1 do
LogToConsole([[`0Script Running In : ]]..i)
Sleep(1000)
end

for i = 1, 20 do
LogToConsole([[`2Made by `#@PelerYin]])
end

for i = 1, 4 do
SendPacket(2, [[action|input
|text|`2Made by `#@PelerYin]])
Sleep(1000)
end

while true do
Sleep(200)
harvest()
Sleep(200)
plant()
end

You might also like