Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function loop1 ()
- while true do
- local _, direction = os.pullEvent("mouse_scroll") --# listening for mouse_scroll events
- if direction == -1 then --# direction 1 is when you scroll the wheel one way
- if y < #scrollBuffer-maxY then --# don't want to be able to scroll outside of the range of the table
- y=y+1
- end
- term.clear() --# clearing screen so we can print the new scrolled version
- drawHeader()
- drawButton(4, "Post Message")
- drawButton(8, "Return")
- term.setCursorPos(1,5) --# setting to 1,1
- for i = 1, maxY-1 do --# looping through the screen coords
- if not scrollBuffer[i+y] then break end --# making sure the table location isnt nil
- print(scrollBuffer[i+y]) --# printing the table entry, i+y is the table entry
- end
- elseif direction == 1 then --# -1 is the only direction
- if y~=0 then --# not going to explain anymore, as it all repeats from here
- y=y-1
- end
- term.clear()
- drawHeader()
- drawButton(4, "Post Message")
- drawButton(8, "Return")
- term.setCursorPos(1,5)
- for i = 1, maxY-1 do
- if not scrollBuffer[i+y] then break end
- print(scrollBuffer[i+y])
- end
- end
- end
- end
- local function loop2 ()
- local button = waitForButton()
- if button == 4 then
- post(acc, pin)
- elseif button == 8 then
- bank(acc, ping)
- end
- end
- -- MessageBoard
- function message(acc, pin)
- while true do
- term.clear()
- drawHeader()
- drawButton(4, "Post Message")
- drawButton(8, "Return")
- local methods = {}
- for i = 1, 10 do
- table.insert(methods,i)
- end
- local a = http.get("http://infaknox.space/messages")
- for line in a.readLine do
- local location = (line:find(":", 1))
- if location then
- usr = line:sub(1, location - 1)
- msg = line:sub(location + 1)
- table.insert(scrollBuffer," Message: "..usr.." \n ".."By: "..msg) --# storing all of the things printed to the screen into a table.concat(
- end
- end
- term.setCursorPos(1, 5)
- for i = 1, 5 do
- print(scrollBuffer[i])
- end
- parallel.waitForAny(loop1, loop2)
- end
- end
Add Comment
Please, Sign In to add comment