Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- if tArgs[1] == "set" then
- if tArgs[2] then
- if not fs.exists(tArgs[2]) then
- printError("File does not exist!")
- return
- end
- fs.delete("/haxtype.txt")
- local open = fs.open(tArgs[2], "r")
- local all = open.readAll()
- open.close()
- local open = fs.open("/haxtype.txt", "w")
- open.write(all)
- open.close()
- print("Set HAXType text to file " .. tArgs[2] .. "!")
- return
- else
- print("Usage: haxtype set <path>")
- return
- end
- elseif tArgs[1] == "reset" then
- fs.delete("/haxtype.txt")
- print("Reset HAXType!")
- return
- end
- if term.isColor() then
- term.setTextColor(colors.lime)
- end
- print("Initalizing HAXType..")
- if not fs.exists("/haxtype.txt") then
- print("haxtype.txt does not exist, creating..")
- if not http then
- printError("Cannot create haxtype.txt! Reason: HTTP API disabled")
- printError("Please enable the HTTP API for first setup, or create haxtype.txt.")
- error()
- end
- local open = fs.open("/haxtype.txt", "w")
- open.write(http.get("http://pastebin.com/raw/A7wGH3ty").readAll())
- open.close()
- end
- local open = fs.open("/haxtype.txt", "r")
- local code = open.readAll()
- open.close()
- local dex = 0
- local c = 0
- local len = string.len(code)
- term.clear()
- term.setCursorPos(1,1)
- print("HAXType by Atenefyr. Press ENTER to exit or F1 to auto-complete and exit.")
- print("")
- while true do
- local event, v = os.pullEvent()
- if event == "key" then
- if v == keys.enter then
- write("\n")
- if term.isColor() then
- term.setTextColor(colors.white)
- end
- return
- elseif v == keys.f1 then
- if dex < len then
- write(string.sub(code,dex+1,len))
- end
- write("\n")
- if term.isColor() then
- term.setTextColor(colors.white)
- end
- return
- end
- elseif event == "char" then
- local speed = math.random(3,5)
- for i = 1, speed do
- dex = dex + 1
- if dex <= len then
- write(string.sub(code,dex,dex))
- end
- end
- if dex > len then
- write("\n")
- if term.isColor() then
- term.setTextColor(colors.white)
- end
- return
- end
- end
- end
- --if somehow you reach this part of of the code we'll leave safely
- write("\n")
- if term.isColor() then
- term.setTextColor(colors.white)
- end
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement