Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

function tileShit()

local res = {}
for _, a in pairs(getTile()) do
if (res[a.fg] == nil) then
res[a.fg] = { id = a.fg, count = 1 }
else
res[a.fg].count = res[a.fg].count + 1
end
if (res[a.bg] == nil) then
res[a.bg] = { id = a.bg, count = 1 }
else
res[a.bg].count = res[a.bg].count + 1
end
end
table.remove(res, 0)
local dwi = ""
for _, b in pairs(res) do
dwi = dwi .. b.id .. "," .. b.count .. ","
end
return dwi
end

function objectShit()
local res = {}
for _, a in pairs(getWorldObject()) do
if (res[a.id] == nil) then
res[a.id] = { id = a.id, count = a.amount }
else
res[a.id].count = res[a.id].count + a.amount
end
end
local dwi = ""
for _, b in pairs(res) do
dwi = dwi .. b.id .. "," .. b.count .. ","
end
return dwi
end

local dialog = {
menu = [[set_default_color|`o
add_label_with_icon|big|`wWorld Stats``|left|6016|
add_spacer|small|
add_textbox|`wGrowScan Script by @dwiputra |left
add_button|tileDwi|World Blocks|noflags|0|0|
add_button|objectDwi|Floating items|noflags|0|0|
add_spacer|small|
end_dialog|statsblock|Cancel||]],
list = function(itm)
return [[set_default_color|`o
add_label_with_icon|big|`w@dwiputra``|left|6016|
add_spacer|small|
add_label_with_icon_button_list|small|`w%s : %s|left|findTile_|
itemIDseed2tree_itemAmount|]] .. itm .. [[
add_spacer|small|
add_spacer|small|
add_button|BackToMenu|Back|noflags|0|0|
embed_data|DialogDwi|0
end_dialog|statsblock|Cancel||
]]
end,
}

function growscan(types,str)
if str:find("/gscan") or str:find("BackToMenu") then
sendVariant({[0] = "OnDialogRequest", [1]= dialog.menu}, -1, 100)
elseif str:find("tileDwi") then
sendVariant({[0] = "OnDialogRequest", [1]= dialog.list(tileShit())}, -1,
100)
elseif str:find("objectDwi") then
sendVariant({[0] = "OnDialogRequest", [1]= dialog.list(objectShit())}, -1,
100)
elseif str:find("findObject") or str:find("findTile") then
logToConsole("sadly you cannot that")
else
return false
end
return true
end

AddHook("OnTextPacket","gs",growscan)

You might also like