Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Script by Savage_Me55iah of CraftAU.com.au--
- --Other Savage_Me55iah scripts @ http://pastebin.com/u/Savage_Me55iah
- --INSTRUCTIONS ON USE--
- --Instruction video on http://youtube.com/savagemessiah5
- --Contact Savage_Me55iah @ CraftAU.com.au or http://www.computercraft.info/forums2/ with suggestions/fixes/bugs
- local scriptName = "generalinfo"
- fileDetail = fileDetail or {}
- fileDetail[scriptName] = {["version"] = 0.1, ["pastebin"] = "4a8jhYMe"}
- local tArgs = {...}
- if tArgs[1] == "update" then
- print("UPDATING") shell.run("pastebin get "..fileDetail[scriptName].pastebin.." "..scriptName.."_update")
- if fs.exists(scriptName.."_update") then fs.remove(shell.getRunningProgram()) fs.copy(scriptName.."_update", shell.getRunningProgram()) fs.remove(scriptName.."_update") print("UPDATE SUCCESS") else print("UPDATE FAILED") end
- end
- -----------------------------------------------------------------------------------------------------------
- -- Variables --
- -----------------------------------------------------------------------------------------------------------
- generalInfo = {}
- generalInfo["colors"] = {
- ["white"] = {["color"] = colors.white, ["decimal"] = 1, ["hexadecimal"] = "0x1", ["binary"] = 0000000000000001, ["paint"] = 0, ["display"] = "#F0F0F0"},
- ["orange"] = {["color"] = colors.orange, ["decimal"] = 2, ["hexadecimal"] = "0x2", ["binary"] = 0000000000000010, ["paint"] = 0, ["display"] = "#F2B233"},
- ["magenta"] = {["color"] = colors.magenta, ["decimal"] = 4, ["hexadecimal"] = "0x4", ["binary"] = 0000000000000100, ["paint"] = 0, ["display"] = "#E57FD8"},
- ["lightBlue"] = {["color"] = colors.lightBlue, ["decimal"] = 8, ["hexadecimal"] = "0x8", ["binary"] = 0000000000001000, ["paint"] = 0, ["display"] = "#99B2F2"},
- ["yellow"] = {["color"] = colors.yellow, ["decimal"] = 16, ["hexadecimal"] = "0x10", ["binary"] = 0000000000010000, ["paint"] = 0, ["display"] = "#DEDE6C"},
- ["lime"] = {["color"] = colors.lime, ["decimal"] = 32, ["hexadecimal"] = "0x20", ["binary"] = 0000000000100000, ["paint"] = 0, ["display"] = "#7FCC19"},
- ["pink"] = {["color"] = colors.pink, ["decimal"] = 64, ["hexadecimal"] = "0x40", ["binary"] = 0000000001000000, ["paint"] = 0, ["display"] = "#F2B2CC"},
- ["gray"] = {["color"] = colors.gray, ["decimal"] = 128, ["hexadecimal"] = "0x80", ["binary"] = 0000000010000000, ["paint"] = 0, ["display"] = "#4C4C4C"},
- ["lightGray"] = {["color"] = colors.lightGray, ["decimal"] = 256, ["hexadecimal"] = "0x100", ["binary"] = 0000000100000000, ["paint"] = 0, ["display"] = "#999999"},
- ["cyan"] = {["color"] = colors.cyan, ["decimal"] = 512, ["hexadecimal"] = "0x200", ["binary"] = 0000001000000000, ["paint"] = 0, ["display"] = "#4C99B2"},
- ["purple"] = {["color"] = colors.purple, ["decimal"] = 1024, ["hexadecimal"] = "0x400", ["binary"] = 0000010000000000, ["paint"] = 0, ["display"] = "#B266E5"},
- ["blue"] = {["color"] = colors.blue, ["decimal"] = 2048, ["hexadecimal"] = "0x800", ["binary"] = 0000100000000000, ["paint"] = 0, ["display"] = "#3366CC"},
- ["brown"] = {["color"] = colors.brown, ["decimal"] = 4096, ["hexadecimal"] = "0x1000", ["binary"] = 0001000000000000, ["paint"] = 0, ["display"] = "#7F664C"},
- ["green"] = {["color"] = colors.green, ["decimal"] = 8192, ["hexadecimal"] = "0x2000", ["binary"] = 0010000000000000, ["paint"] = 0, ["display"] = "#57A64E"},
- ["red"] = {["color"] = colors.red, ["decimal"] = 16384, ["hexadecimal"] = "0x4000", ["binary"] = 0100000000000000, ["paint"] = 0, ["display"] = "#CC4C4C"},
- ["black"] = {["color"] = colors.black, ["decimal"] = 32768, ["hexadecimal"] = "0x8000", ["binary"] = 1000000000000000, ["paint"] = 0, ["display"] = "#191919"}
- }
- generalInfo["sides"] = {
- ["turtle"] = {"top", "bottom", "front", "right", "back", "left"},
- ["computer"] = {"up", "down", "front", "right", "back", "left"}
- }
- generalInfo["sidesReverse"] = {
- ["turtle"] = {["bottom"] = "top", ["top"] = "bottom", ["left"] = "right", ["right"] = "left", ["front"] = "back", ["back"] = "front"},
- ["computer"] = {["down"] = "up", ["up"] = "down", ["left"] = "right", ["right"] = "left", ["front"] = "back", ["back"] = "front"}
- }
- generalInfo["directions"] = {"up", "down", "north", "east", "south", "west"}
- generalInfo["directionsReverse"] = {["down"] = "up", ["up"] = "down", ["north"] = "south", ["south"] = "north", ["east"] = "west", ["west"] = "east"}
- generalInfo["cardinalDirections"] = {"north", "east", "south", "west"}
- -----------------------------------------------------------------------------------------------------------
- -- API Functions --
- -----------------------------------------------------------------------------------------------------------
- -- generalinfo.chestDirTranslator(functionNum) -- [1] returns true if function ran correctly OR if false variable was nil
- -- main function. assign, records and displays logged text, use separate program to overview the log table
- function chestDirTranslator(param_functionNum)
- local result, functionNum, sides, directions = {false}, param_functionNum.."/002", {"front", "right", "back", "left"}, {"north", "east", "south", "west"}
- generalInfo["chestDirTranslator"] = {["up"] = "up", ["down"] = "down", ["top"] = "up", ["bottom"] = "down"}
- if tostring(facing) ~= "nil" then
- for a,b in pairs(directions) do
- if b == facing then
- e = a
- for c,d in pairs(sides) do
- result[1], generalInfo["chestDirTranslator"][d] = true, directions[e]
- e = e + 1
- if e > 4 then e = 1 end
- end end end
- else
- logger.logger(functionNum, {"Missing >facing< variable error eg (facing = north)"}, 1, " ")
- end
- return result
- end
- -- generalinfo.stringAdjuster(functionNum) -- [1] returns true if function ran correctly OR if false variable was nil
- -- main function. assign, records and displays logged text, use separate program to overview the log table
- function stringAdjuster(param_functionNum, param_name)
- local result, functionNum = {false, false}, param_functionNum.."/002"
- if param_name == "east" or param_name == "west" or param_name == "down" then
- result = {true, param_name.." "}
- elseif param_name == "up" then
- result = {true, param_name.." "}
- elseif param_name == "left" or param_name == "back" then
- result = {true, param_name.." "}
- elseif param_name == "right" or param_name == "front" then
- result = {true, param_name.." "}
- elseif param_name == "top" then
- result = {true, param_name.." "}
- else
- result = {true, param_name}
- end
- return result
- end
Advertisement
Add Comment
Please, Sign In to add comment