print ("Hello, World!")-- SETTING BELLOW -- THANKYOU FOR BUYING
World = "MUHAMMAD" -- name world
dbg = 0 -- change 1 if you want dont drop gems, change 0 if you want drop gems
-- DONT CHANGE OR ELSE IT WILL ERROR
Sleep(200)
xawal = math.floor(GetLocal().posX/32)
yawal = math.floor(GetLocal().posY/32)
bg = 12840
nono = true
function main()
-- FUNCTION
-- FUNCTION FOR COUNTDOWN
function log(str)
LogToConsole("`7[`8Script starting"..str)
end
-- ONTEXT
function ontext(str)
on = {}
on.v0 = "OnTextOverlay"
on.v1 = str
SendVariant(on)
end
-- WRENCH
function wrench()
pkt = {}
pkt.type = 3
pkt.value = 32
pkt.state = 8
pkt.px = Mag[count].x
pkt.py = Mag[count].y
pkt.x = GetLocal().posX
pkt.y = GetLocal().posY
SendPacketRaw(false, pkt)
end
-- GETMAG Normal
function GetMagN()
Mag = {}
count = 0
for _, tile in pairs(GetTiles()) do
if (tile.fg == 5638) and (tile.bg == bg) then
count = count + 1
Mag[count] = {x = tile.x, y = tile.y}
end
end
end
-- GETMAG Island
function GetMag()
Mag = {}
count = 0
for x = 0, 199 do
for y = 0, 199 do
tile = GetTile(x, y)
if (tile.fg == 5638) and (tile.bg == bg) then
count = count + 1
Mag[count] = {x = tile.x, y = tile.y}
end
end
end
end
-- AUTO CHECK ISLAND OR NOT
local status , err = pcall(GetMag)
if not status then
iorn = "Normal"
Sleep(1000)
GetMagN()
else
iorn = "Island"
end
-- CHEATS
function scheat()
if (cheats == true) and (math.floor(GetLocal().posX/32) == xawal) and (math.floor(GetLocal().posY/32) == yawal) then
Sleep(700)
SendPacket(2,"action|dialog_return\ndialog_name|cheats\ncheck_autofarm|1\ncheck_bfg|1\ncheck_lonely|1\ncheck_gems|"..dbg.."\n")
Sleep(300)
cheats = false
end
end
function fmag()
if FindPath(Mag[count].x , Mag[count].y - 1) == false then
Sleep(200)
FindPath(Mag[count].x , Mag[count].y - 1)
ontext("`4Taking Magplant...")
Sleep(300)
findmag = false
takeremote = true
else
LogToConsole("`8[ `bEror 404 `8]")
SendVariant({v0 = "OnTalkBubble", v1 = GetLocal().netID, v2 = "`4Dont Repeat !!!"})
findmag = false
end
end
-- TAKE REMOTE
function tremote()
Sleep(500)
if (takeremote == true) then
if math.floor(GetLocal().posX/32) == Mag[count].x and math.floor(GetLocal().posY/32) == Mag[count].y - 1 then
Sleep(300)
wrench()
Sleep(100)
if nono == false then
ontext("`8[ `cSuccess Take Remote `8]")
SendPacket(2,"action|dialog_return\ndialog_name|magplant_edit\nx|"..Mag[count].x.."|\ny|"..Mag[count].y.."|\nbuttonClicked|getRemote\n\n")
takeremote = false
elseif nono == true then
ontext("`cLoading...")
nono = false
takeremote = false
findmag = true
end
else
ontext("`4Dont Move !!!")
SendVariant({v0 = "OnTalkBubble", v1 = GetLocal().netID, v2 = "Please Re run the script"})
takeremote = false
end
end
end
-- ADDHOOK
function var(var)
if var.v1 == "OnConsoleMessage" and var.v2:find("World Locked") then
findmag = true
return true
end
if var.v1 == "OnDialogRequest" and var.v2:find("end_dialog|magplant_edit|") then
return true
end
if var.v1 == "OnConsoleMessage" and var.v2:find("Where would you like to go?") then
getworld = true
return true
end
if var.v1 == "OnTalkBubble" and var.v3:find("You received a MAGPLANT 5000 Remote.") then
FindPath(xawal,yawal)
cheats = true
return true
end
if var.v1 == "OnTalkBubble" and var.v3:find("The MAGPLANT 5000 is empty.") then
empty = true
return true
end
if var.v1 == "OnDialogRequest" and var.v2:find("The machine is currently empty!") then
nothing = true
nono = true
return true
end
if var.v1 == "OnDialogRequest" and var.v2:find("The machine contains") then
return true
end
return false
end
AddHook(var,"OnVariant")
-- START SCRIPT
log("`2 in : `43`7]")
Sleep(1000)
log("`2 in : `42`7]")
Sleep(1000)
log("`2 in : `41`7]")
Sleep(1000)
-- SEND DIALOG
opening = [[
add_label_with_icon|big|`2PNB ADVANCE |left|]] .. 9740 ..[[|
add_spacer|small|
add_textbox|`0By `cGano`#EL|
add_textbox|`0Hello `2]]..GetLocal().name..[[ `0Thanks For Buying This Script |left|
add_spacer|small|
add_textbox|`9Script Info & Rules:|left|
add_label_with_icon|small|`0Do not `4Resell `0or `4Share `0My Script|left|7190|
add_label_with_icon|small|`0World Types : `2]]..iorn..[[|left|3802|
add_label_with_icon|small|`0World Name : `2]]..World..[[|left|10078|
add_label_with_icon|small|`0Mags Counted : `2]]..count..[[|left|5638|
add_spacer|small|
add_label_with_icon|small|`wDon't make any moves after run the script!|left|1432|
add_spacer|small|
add_label_with_icon|small|`wDon't forget for used /ghost|left|1432|
add_label_with_icon|small|`wDon't forget put Superstar Background for your magplant|left|1432|
add_spacer|small|
add_label_with_icon|small|`2Thanks To`` : ``|left|12158|
add_textbox|- `b@Piers `4[`6Helped`4]|left|
add_spacer|small|
end_dialog|itro|Close| OKE |
]]
s = {}
s.v0 = "OnDialogRequest"
s.v1 = opening
SendVariant(s)
Sleep(3000)
SendPacket(2,"action|input\n|text|`8[ `4SCRIPT PNB ADVANCE by `cGano`#EL `8]")
Sleep(3000)
-- WHILE LOOP
fmag()
while true do
Sleep(2000)
if count > 0 then
if (getworld == true) then
ontext("`8[ `cEntering In `8"..World.." `c]")
SendPacket(3, "action|join_request\nname|"..World.."\ninvitedWorld|0")
Sleep(2300)
getworld = false
end
if (findmag == true) then
Sleep(200)
fmag()
end
if (cheats == true) then
Sleep(200)
scheat()
end
if (takeremote == true) then
tremote()
Sleep(500)
end
if (empty == true) then
SendPacket(2,"action|dialog_return\ndialog_name|cheats\ncheck_autofarm|0\ncheck_bfg|0")
Sleep(200)
count = count - 1
empty = false
findmag = true
end
if (nothing == true) then
Sleep(400)
count = count - 1
nothing = false
findmag = true
end
else
ontext("All magplant empty")
end
end
end
main() Write, Run & Share Lua code online using OneCompiler's Lua online compiler for free. It's one of the robust, feature-rich online compilers for Lua language, running the latest Lua version 5.4. Getting started with the OneCompiler's Lua editor is easy and fast. The editor shows sample boilerplate code when you choose language as Lua and start coding.
OneCompiler's Lua online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Lua program which takes name as input and prints hello message with your name.
name = io.read("*a")
print ("Hello ", name)
Lua is a light weight embeddable scripting language which is built on top of C. It is used in almost all kind of applications like games, web applications, mobile applications, image processing etc. It's a very powerful, fast, easy to learn, open-source scripting language.
-- global variables
a = 10
-- local variables
local x = 30
| Value Type | Description |
|---|---|
| number | Represents numbers |
| string | Represents text |
| nil | Differentiates values whether it has data or not |
| boolean | Value can be either true or false |
| function | Represents a sub-routine |
| userdata | Represents arbitary C data |
| thread | Represents independent threads of execution. |
| table | Can hold any value except nil |
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition)
do
--code
end
Repeat-Until is also used to iterate a set of statements based on a condition. It is very similar to Do-While, it is mostly used when you need to execute the statements atleast once.
repeat
--code
until( condition )
For loop is used to iterate a set of statements based on a condition.
for init,max/min value, increment
do
--code
end
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increase re-usuability and modularity.
optional_function_scope function function_name( argument1, argument2, argument3........, argumentn)
--code
return params with comma seperated
end