Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --MHS by mh
- --Advanced Print
- _stat = 0
- function advPrint(x)
- spacer = string.rep(" ",_stat * 2)
- if type(x) == "table" then
- print(spacer .. "{")
- _stat = _stat + 1
- spacer = string.rep(" ",_stat * 2)
- for k, v in pairs(x) do
- if type(v) == "table" then
- print(spacer .. k..": ")
- advPrint(v)
- else
- print(spacer .. k..": "..tostring(v))
- end
- end
- _stat = _stat - 1
- spacer = string.rep(" ",_stat * 2)
- print(spacer .. "}")
- else
- spacer = string.rep(" ",_stat * 2)
- print(spacer .. tostring(x))
- end
- end
- --STR
- sc = {}
- sc["a'"] = á
- sc["o'"] = ó
- sc["o''"] = ő
- sc["e'"] = é
- sc["u'"] = ú
- sc["o.."] = ö
- sc["u.."] = ü
- sc["u''"] = ű
- sc["i'"] = í
- function str(x)
- x = tostring(x)
- for k, v in pairs(sc) do
- string.gsub(x, k, v)
- end
- return(x)
- end
- --Print Colorlist
- function colorList(x)
- print([[white - 1
- orange - 2
- magenta - 4
- lightBlue - 8
- yellow - 16
- lime - 32
- pink - 64
- gray - 128
- lightGray - 256
- cyan - 512
- purple - 1024
- blue - 2048
- brown - 4096
- green - 8192
- red - 16384
- black - 32768]])
- end
- --Color To Number
- function colToNum(x)
- y = 0
- if x.white then y = y + 2 ^ 0 end
- if x.orange then y = y + 2 ^ 1 end
- if x.magenta then y = y + 2 ^ 2 end
- if x.lightBlue then y = y + 2 ^ 3 end
- if x.yellow then y = y + 2 ^ 4 end
- if x.lime then y = y + 2 ^ 5 end
- if x.pink then y = y + 2 ^ 6 end
- if x.gray then y = y + 2 ^ 7 end
- if x.lightGray then y = y + 2 ^ 8 end
- if x.cyan then y = y + 2 ^ 9 end
- if x.purple then y = y + 2 ^ 10 end
- if x.blue then y = y + 2 ^ 11 end
- if x.brown then y = y + 2 ^ 12 end
- if x.green then y = y + 2 ^ 13 end
- if x.red then y = y + 2 ^ 14 end
- if x.black then y = y + 2 ^ 15 end
- return y
- end
- -- Number To Color
- function numToCol(x)
- y = {}
- y.white = false
- y.orange = false
- y.magenta = false
- y.lightBlue = false
- y.yellow = false
- y.lime = false
- y.pink = false
- y.gray = false
- y.lightGray = false
- y.cyan = false
- y.purple = false
- y.blue = false
- y.brown = false
- y.green = false
- y.red = false
- y.black = false
- while true do
- if x >= 2 ^ 15 then
- x = x - 2 ^ 15
- y.black = true
- elseif x >= 2 ^ 14 then
- x = x - 2 ^ 14
- y.red = true
- elseif x >= 2 ^ 13 then
- x = x - 2 ^ 13
- y.green = true
- elseif x >= 2 ^ 12 then
- x = x - 2 ^ 12
- y.brown = true
- elseif x >= 2 ^ 11 then
- x = x - 2 ^ 11
- y.blue = true
- elseif x >= 2 ^ 10 then
- x = x - 2 ^ 10
- y.purple = true
- elseif x >= 2 ^ 9 then
- x = x - 2 ^ 9
- y.cyan = true
- elseif x >= 2 ^ 8 then
- x = x - 2 ^ 8
- y.lightGray = true
- elseif x >= 2 ^ 7 then
- x = x - 2 ^ 7
- y.gray = true
- elseif x >= 2 ^ 6 then
- x = x - 2 ^ 6
- y.pink = true
- elseif x >= 2 ^ 5 then
- x = x - 2 ^ 5
- y.lime = true
- elseif x >= 2 ^ 4 then
- x = x - 2 ^ 4
- y.yellow = true
- elseif x >= 2 ^ 3 then
- x = x - 2 ^ 3
- y.lightBlue = true
- elseif x >= 2 ^ 2 then
- x = x - 2 ^ 2
- y.magenta = true
- elseif x >= 2 ^ 1 then
- x = x - 2 ^ 1
- y.orange = true
- elseif x >= 2 ^ 0 then
- x = x - 2 ^ 0
- y.white = true
- elseif x == 0 then
- break
- end
- end
- return y
- end
- --Set Single Color
- function setBundledColor(side, color, status)
- tableOfColors = numToCol(rs.getBundledOutput(side))
- tableOfColors[color] = status
- rs.setBundledOutput(side,colToNum(tableOfColors))
- end
- --Get Single Color
- function getBundledColor(side, color)
- tableOfColors = numToCol(rs.getBundledInput(side))
- return tableOfColors[color]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement