View difference between Paste ID: QDGKgTAh and Ug5NyxEH
SHOW: | | - or go back to the newest paste.
1-
glass = peripheral.wrap("bottom")
1+
--Created and Developed by killzoms
2-
local set = {}
2+
--Some Variable
3-
function update()
3+
set = {}
4-
 
4+
line = 220
5-
end
5+
filte = {}
6-
function color()
6+
time = {}
7-
 if msg.match(msg, "&1") == true then
7+
nu = {}
8
9-
 end
9+
updat = http.get("https://pastebin.com/raw/LcprcigA")
10-
end
10+
upd = updat.readAll()
11-
function clear()
11+
cu = fs.open("LapChat", "w")
12-
 if msg == "clear" then
12+
cu.write(upd)
13-
  set["message1"] = nil
13+
cu.flush()
14-
  set["message2"] = nil
14+
cu.close()
15-
  set["message3"] = nil
15+
os.run("LapChat")
16-
  set["message4"] = nil
16+
17-
  set["message5"] = nil
17+
--Download LapAPI
18-
  user = ""
18+
--  updat = http.get("https://pastebin.com/raw/FM10T2EU")
19-
 end
19+
--  upd = updat.readAll()
20-
end
20+
--  cu = fs.open("LapAPI", "w")
21-
function save()
21+
--  cu.write(upd)
22-
 f = fs.open("chatlog", "w")
22+
--  cu.flush()
23-
 if set["message4"] ~= nil then
23+
--  cu.close()
24-
  set["message5"] = set["message4"]
24+
--  os.loadAPI("LapAPI")
25-
  set["line5"] = 70
25+
26-
 end
26+
--Run when the chat runs for the first time
27-
 if set["message3"] ~= nil then
27+
--glass, mon, ups = LapAPI.runChatFirstTime()
28-
  set["message4"] = set["message3"]
28+
29-
  set["line4"] = 60
29+
--Function for finding commands
30-
 end
30+
--function run(...)
31-
 if set["message2"] ~= nil then
31+
-- _G.msgArgs = {}
32-
  set["message3"] = set["message2"]
32+
-- v = 1
33-
  set["line3"] = 50
33+
 --Check messages for spaces and split when found
34-
 end
34+
-- for i in string.gmatch(msg, "%S+") do
35-
 if set["message1"] ~= nil then
35+
--  _G.msgArgs[v] = i
36-
  set["message2"] = set["message1"]
36+
--  v = v + 1
37-
  set["line2"] = 40
37+
-- end
38-
 end
38+
 --Classic Command Prefix
39-
 if set["message"] ~= nil then
39+
-- if string.match(arg[1], "/") ~= nil and string.match(arg[1], "./") == nil then
40-
  set["message1"] = set["message"]
40+
--  return true
41-
  set["line1"] = 30
41+
-- else
42-
 end
42+
--  return false
43-
 set["message"] = user.." > "..msg
43+
-- end
44-
 set["line"] = 20
44+
--end
45-
 f.write(textutils.serialize(set))
45+
46-
 f.flush()
46+
--function fade()
47-
end
47+
--Will finish
48-
function monitor()
48+
--end
49-
mon = peripheral.wrap("left")
49+
50-
 if mon ~= nil then
50+
--Load Addons
51-
  mon.setCursorPos(1,1)
51+
--function addons()
52-
  mon.setTextScale(0.75)
52+
-- installedAddons = {}
53-
  mon.clear()
53+
-- if fs.exists("Chat/InstalledAddons") == true then
54-
  mon.write(user.." > "..msg)
54+
--  iAddons = fs.open("Chat/InstalledAddons", "r")
55-
 end
55+
--  installedAddons = textutils.unserialize(iAddons.readAll())
56-
end
56+
--  for i,v in ipairs(installedAddons) do
57-
function multiline()
57+
--   os.loadAPI("Chat/Addons/"..installedAddons[i])
58-
 mult = fs.open("chatlog", "r")
58+
--   funct = loadstring(installedAddons[i]..".run()")
59-
 nu = textutils.unserialize(mult.readAll())
59+
--   funct()
60-
 if nu.message1 ~= nil then
60+
--  end
61-
  line1 = nu.line1
61+
--  iAddons.close()
62-
  msg1 = nu.message1
62+
-- end
63-
  y = line1 - 1
63+
--end
64-
  glass.addBox(2, y, 324, 10, 0x000000, 0.5)
64+
65-
  glass.addText(2, line1, msg1, 0xFFFFFF)
65+
--function color()
66-
 end
66+
--Working on it
67-
 if nu.message2 ~= nil then
67+
--end
68-
  line2 = nu.line2
68+
69-
  msg2 = nu.message2
69+
--If mon present print messages to it
70-
  y = line2 - 1
70+
--function monitor()
71-
  glass.addBox(2, y, 324, 10, 0x000000, 0.5)
71+
-- if mon then
72-
  glass.addText(2, line2, msg2, 0xFFFFFF)
72+
--  mon.setCursorPos(1,1)
73-
 end
73+
--  mon.setTextScale(0.75)
74-
 if nu.message3 ~= nil then
74+
--  mon.clear()
75-
  line3 = nu.line3
75+
--  mon.write(realName.." > "..msg)
76-
  msg3 = nu.message3
76+
-- end
77-
  y = line3 - 1
77+
--end
78-
  glass.addBox(2, y, 324, 10, 0x000000, 0.5)
78+
79-
  glass.addText(2, line3, msg3, 0xFFFFFF)
79+
--Main function
80-
 end
80+
--function main()
81-
 if nu.message4 ~= nil then
81+
-- while true do
82-
  line4 = nu.line4
82+
--Reset variables
83-
  msg4 = nu.message4
83+
--  _G.realName = ""
84-
  y = line4 - 1
84+
--  _G.facs = ""
85-
  glass.addBox(2, y, 324, 10, 0x000000, 0.5)
85+
--  _G.rank = ""
86-
  glass.addText(2, line4, msg4, 0xFFFFFF)
86+
--  _G.commandUser = nil
87-
 end
87+
88-
 if nu.message5 ~= nil then
88+
--Update Chat
89-
  line5 = nu.line5
89+
--  if ups == true then
90-
  msg5 = nu.message5
90+
--   LapAPI.update("QDGKgTAh", "startup")
91-
  y = line5 -1
91+
--  end
92-
  glass.addBox(2, y, 324, 10, 0x000000, 0.5)
92+
93-
  glass.addText(2, line5, msg5, 0xFFFFFF)
93+
94-
 end
94+
--Pull events from the Terminal Glasses
95-
end
95+
--  e, side, _G.user, _G.uuid, _G.msg = os.pullEvent("glasses_chat_command")
96
97-
function nicknames()
97+
--Check for Commands
98-
 if msg.match(msg, "nick ") ~= nil then
98+
--  _G.isCommand = run(_G.msg)
99-
  nick = msg.gsub(msg, "nick ", "")
99+
100-
  name = fs.open("nicknames/"..user, "w")
100+
--If Command set user to command User
101-
  nik["_"] = user
101+
--  if _G.isCommand then
102-
  nik["new"] = nick
102+
--	_G.set = {}
103-
  name.write(textutils.serialize(nik))
103+
--    _G.commandUser = _G.user
104-
  name.flush()
104+
--    _G.user = ""
105-
 else
105+
--  end
106-
  if fs.exists("nicknames/"..user) == true then
106+
107-
   nicks = fs.open("nicknames/"..user, "r")
107+
--Initialize addons
108-
   nik = textutils.unserialize(nicks.readAll())
108+
--  addons()
109-
   user = nik.new
109+
110-
  end
110+
  --If Factions installed check for Faction commands
111-
 end
111+
--  if Factions then
112-
end
112+
--   Factions.facCommands(_G.msgArgs, _G.user)
113
--  end
114-
while true do
114+
115-
 e, side, user, uuid, msg = os.pullEvent("glasses_chat_command")
115+
116-
 nicknames()
116+
--Load Faction name of user
117-
 clear()
117+
--  if not isCommand then
118-
 if msg.match(msg, "nick ") == nil then
118+
--   if Factions then
119-
 if msg ~= "clear" then
119+
--    _G.facs = Factions.checkFac(_G.user)
120-
  monitor()
120+
--   end
121-
  glass.clear()
121+
--  end
122-
  save()
122+
123-
  glass.addBox(2, 19, 324, 10, 0x000000, 0.5)
123+
--  LapAPI.clearChat(_G.msgArgs)
124-
  glass.addText(2, 20, user.." > "..msg, 0xFFFFFF)
124+
125-
  multiline()
125+
--    monitor()
126-
  glass.sync()
126+
--    LapAPI.chatSave(_G.facs, _G.rank, _G.hyph, _G.user, _G.msg, _G.isCommand)
127-
 end
127+
--    if _G.con then
128-
 end
128+
--     glass.addText(2, 230, "Console > ".._G.con, 0xFFFFFF)
129-
end
129+
--    end
130
131
--    fade()
132
--    If a command not detected print multiple lines
133
--    if not _G.isCommand then
134
--     glass.clear()
135
--     LapAPI.chatMultiline()
136
--    end
137
--  glass.sync()
138
-- end
139
--end
140
141
--Run Multiple functions at once
142
--parallel.waitForAll(main, LapAPI.chatConsole, LapAPI.chatSaveToFile, LapAPI.userJoined, LapAPI.userLeft)