Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Loads up item database
- local handle = fs.open(".itemdb", "r")
- local items = textutils.unserialize(handle.readAll())
- handle.close()
- while true do
- e, msg, d, b, c = os.pullEvent("chat_command")
- bridge.clear()
- words = {}
- found = false
- for word in msg:gmatch('%S+') do
- table.insert(words, word)
- end
- print(msg)
- if msg == "clear" then
- print("clear")
- bridge.clear()
- elseif msg == "update" then
- print("update")
- shell.run("update")
- end
- if words[1] == "check" then
- if string.find(words[2], ":") then
- print("got to if")
- item = {}
- for word in words[2]:gmatch('[^%:]+') do
- table.insert(item, word)
- end
- check(item[1], item[2])
- else
- if tonumber(words[2]) == nil then
- for k,v in pairs(items) do
- print(v.name)
- if v.name == words[2] then
- check(v.id,v.dmg)
- found = true
- end
- end
- if found == false then termerr("Couldn't find "..words[2]) end
- elseif tonumber(words[2]) ~= nil then
- check(words[2], 0)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement