Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Created and Developed by Lapito1297(jaypar)
- --Code starts on final line
- --Some Variable
- set = {}
- line = 220
- filte = {}
- time = {}
- if fs.exists("Chat/LapAPI") then
- fs.delete("Chat/LapAPI")
- end
- Lap = http.get("http://pastebin.com/raw/CmW6FDWj")
- API = fs.open("Chat/LapAPI", "w")
- API.write(Lap.readAll())
- API.close()
- os.loadAPI("Chat/LapAPI")
- --Run when the chat runs for the first time
- _G.glass, mon, ups = LapAPI.runChatFirstTime()
- --Function for finding commands
- function run(...)
- _G.msgArgs = {}
- v = 1
- for i in string.gmatch(msg, "%S+") do
- _G.msgArgs[v] = i
- v = v + 1
- end
- if string.match(arg[1], "/") ~= nil and string.match(arg[1], "./") == nil then
- return true
- else
- return false
- end
- end
- --function fade()
- --Will finish
- --end
- --Load Addons
- function addons()
- installedAddons = {}
- if fs.exists("Chat/InstalledAddons") == true then
- iAddons = fs.open("Chat/InstalledAddons", "r")
- installedAddons = textutils.unserialize(iAddons.readAll())
- for i,v in ipairs(installedAddons) do
- os.loadAPI("Chat/Addons/"..installedAddons[i])
- funct = loadstring(installedAddons[i]..".run()")
- funct()
- end
- iAddons.close()
- end
- end
- --function color()
- --Working on it
- --end
- --If mon present print messages to it
- function monitor()
- if mon ~= nil then
- mon.setCursorPos(1,1)
- mon.setTextScale(0.75)
- mon.clear()
- mon.write(realName.." > "..msg)
- end
- end
- --Main function
- function main()
- while true do
- --Reset variables
- _G.realName = ""
- _G.facs = ""
- _G.rank = ""
- --Update Chat
- if ups == true then
- LapAPI.update("QDGKgTAh")
- end
- _G.commandUser = nil
- --Pull events from the Terminal Glasses
- e, side, _G.user, _G.uuid, _G.msg = os.pullEvent("glasses_chat_command")
- --Check for Commands
- _G.isCommand = run(_G.msg)
- --If Command set user to command User
- if _G.isCommand then
- _G.set = {}
- _G.commandUser = _G.user
- _G.user = ""
- end
- --Initialize addons
- addons()
- --If Factions installed check for Faction commands
- if Factions then
- Factions.facCommands(_G.msgArgs, _G.user)
- end
- --Load Faction name of user
- if not isCommand then
- if Factions then
- _G.facs = Factions.checkFac(_G.user)
- end
- end
- LapAPI.clearChat(_G.msgArgs, _G.realName)
- monitor()
- LapAPI.chatSave(_G.facs, _G.rank, _G.hyph, _G.user, _G.msg, _G.isCommand)
- if _G.con then
- glass.addText(2, 230, "Console > ".._G.con, 0xFFFFFF)
- end
- -- fade()
- -- If a command not detected print multiple lines
- if not _G.isCommand then
- glass.clear()
- LapAPI.chatMultiline()
- end
- glass.sync()
- end
- end
- --Run Multiple functions at once
- parallel.waitForAll(main, LapAPI.chatConsole, LapAPI.chatSaveToFile, LapAPI.userJoined, LapAPI.userLeft)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement