0% found this document useful (0 votes)
46 views4 pages

Message

The document contains a Lua script for a bot that interacts with a game, specifically for warping to different worlds and handling events such as console messages. It includes functionality for logging, reconnecting, and sending notifications via Discord webhooks when certain events occur, like world nukes or player warnings. The script also manages bot status and pathfinding within the game environment.

Uploaded by

0802kvn
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)
46 views4 pages

Message

The document contains a Lua script for a bot that interacts with a game, specifically for warping to different worlds and handling events such as console messages. It includes functionality for logging, reconnecting, and sending notifications via Discord webhooks when certain events occur, like world nukes or player warnings. The script also manages bot status and pathfinding within the game environment.

Uploaded by

0802kvn
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/ 4

local world_vending = "FOLUU:KUCING"

local webhook_vending =
"https://discord.com/api/webhooks/1324681800882065540/WHL8yKwH6LYZVT8ZmFJ-
cfUaiqzaBTIEdL0PnNH7ccSMGFmXRJVpQkqFFgOfnNzrSmYM"
local webhook_sb =
"https://discord.com/api/webhooks/1324355369400799263/1wQQp18MUbkpYLwT1OKznJf9rOAJl
0TaI8sqpFGtOUnjztrfoxG7wUTN8-mrojDoIkQ0"
local webhook_nuke =
"https://discord.com/api/webhooks/1324681720410144770/_kPskxhu4_x6MvBHMt2PguVmN5Si1
1e16CzTr5P-sSQQ5jTQwCl1_j_qY10SPZPH3Rdg"

--bodys do not touch below


local bot = getBot()
local nuked
local stuck

local function logToConsole(level, text)


if type(level) == "string" then
text = level
level = 1
end

local logTypes = {
[1] = "[`2INFO``] ",
[2] = "[`6WARNING``] ",
[3] = "[`4FATAL``] ",
[4] = "[`2START``]"
}
local logType = logTypes[level] or "[`2INFO``]"
local logMessage = string.format("%s %s", logType, text)

bot:getConsole():append(logMessage)
end

--//

local function warpEvents(var)


if var:get(0):getString() == "OnConsoleMessage" then
if var:get(1):getString() == "That world is inaccessible." or
var:get(1):getString():find("Players lower than level") then
nuked = true
unlistenEvents()
end
end
end

local function warp(world, id)


world = world:upper()
id = id or ''
nuked = false
stuck = false
if not bot:isInWorld(world:upper()) then
logToConsole(1,
"Function Warp [ `2Adding Events :`` `6addEvent(Event.variantlist,
function(var) warpEvents(var) end)`` ]")
addEvent(Event.variantlist, function(var) warpEvents(var) end)
while not bot:isInWorld(world:upper()) and not nuked do
logToConsole(1, "Bot Warping to world :" .. world .. ", Door :" .. id)
bot:warp(id == '' and world or world .. ('|' .. id))
listenEvents(5)
sleep(2000)
end
end
if bot:isInWorld(world:upper()) and getTile(bot.x, bot.y).fg == 6 and id ~= ''
then
local count = 0
while getTile(bot.x, bot.y).fg == 6 and not stuck do
bot:warp(id == '' and world or world .. ('|' .. id))
sleep(4000)
count = count + 1
if count % 4 == 0 then
logToConsole(3, " `2Bot is stucked, World has wrong door id`` ")
stuck = true
end
end
end
end

local function isCanfindPath(x, y)


return (#bot:getPath(x, y) == 0 and bot:isInTile(x, y)) or
(#bot:getPath(x, y) ~= 0 and not bot:isInTile(x, y))
end

local function reconnect(world, id, x, y)


if bot.status ~= 1 then
logToConsole(2, 'Bot is not online, Reconnecting ..')
while bot.status ~= 1 or bot:getPing() == 0 do
sleep(5000)
if bot.status == 3 then
print(bot.name .. ' Bot is banned from the game')
end
end
sleep(5000)
end

if bot.status == 1 then
if world and not bot:isInWorld(world:upper()) or
bot:isInWorld(world:upper()) and id ~= "" and getTile(bot.x, bot.y).fg == 6 then
warp(world, id)
if x and y then
while isCanfindPath(x, y) and not bot:isInTile(x, y) do
bot:findPath(x, y)
sleep(100)
end
end
end
end
end

local function splitWorld(input)


if not input then
print("No storage found in list, all were removed due to some world
condition.")
return nil
end
if type(input) == "table" then
local result = {}

for _, world_str in ipairs(input) do


local separator = world_str:find("|") and "|" or (world_str:find(":")
and ":" or nil)
local world, door
if separator then
world, door = world_str:match("([^" .. separator .. "]+)" ..
separator .. "([^" .. separator .. "]+)")
else
world, door = world_str, ""
end
if not world then
print("World not found '" .. world_str .. "'")
end
table.insert(result, { world = world, door = door })
end

return result
else
local separator = input:find("|") and "|" or (input:find(":") and ":" or
nil)
local world, door
if separator then
world, door = input:match("([^" .. separator .. "]+)" .. separator ..
"([^" .. separator .. "]+)")
else
world, door = input, ""
end
return world, door
end
end

local function randomNumber(integer)


return math.random(integer)
end

local function getItemCount(id)


return bot:getInventory():getItemCount(id)
end

local function WebhookPlainText(url, string)


local webhook = Webhook.new(url)
webhook.content = string

webhook:send()
end

local function EventDetection(var)


local nukeEmoji = "<a:nuke:1324344336451637270> "
local megaEmoji = "<:megaph:1324683457791660113> "
local arrowEmoji = "<a:arrow:1324683396814733362> "

if var:get(0):getString() == "OnConsoleMessage" then


if var:get(1):getString():find("%[SB%]") then
local message = removeColor(var:get(1):getString())
message = message:gsub("^CP:%d+_PL:%d+_OID:_CT:%[.-%]_", "")
message = message:gsub("%*", "")
message = "**" .. message .. "**"
message = megaEmoji .. "" .. message

WebhookPlainText(webhook_sb,message)
end
end

if var:get(0):getString() == "OnConsoleMessage" then


if var:get(1):getString():find("World Locks.") then
local message = removeColor(var:get(1):getString())
message = message:gsub("[%[%]]", "")
message = arrowEmoji .. " **" .. message .. "**"

WebhookPlainText(webhook_vending,message)
end
end

if var:get(0):getString() == "OnConsoleMessage" then


if var:get(1):getString():find("was nuked from orbit") then
local message = removeColor(var:get(1):getString())

local world = message:match("(%w+) was nuked from orbit")


if world then
WebhookPlainText(webhook_nuke, nukeEmoji.. " **World Nuked from the
game :** " .. world:upper())
end
end
end
end

warp(world_vending, '')
if bot:isInWorld(world_vending:upper()) then
addEvent(Event.variantlist, function(var) EventDetection(var) end)
listenEvents(10000)
end

You might also like