I give up looking for it, I cannot find out how to draw the new smaller characters added in 1.76.
New Characters
Started by hbomb79, Jan 07 2016 04:09 AM
3 replies to this topic
#1
Posted 07 January 2016 - 04:09 AM
#2
Posted 07 January 2016 - 04:28 AM
There are two ways of drawing them.
Either by using string.char, with s = string.char(169), or using escape characters, like s = "\169"
Both option will have the © character in the s variable.
Either by using string.char, with s = string.char(169), or using escape characters, like s = "\169"
Both option will have the © character in the s variable.
Edited by Anavrins, 07 January 2016 - 04:30 AM.
#3
Posted 07 January 2016 - 05:21 AM
If you're wondering how to draw images with them, then the code here gives a pretty good illustration of the mechanics involved.
#4
Posted 07 January 2016 - 01:36 PM
local function box(bc) -- Box drawing api by 3d6
if #bc ~= 8 then return false end
local a = {}
for i=1,8 do
a[i] = bc:sub(i,i)
end
for i=1,6 do
if not string.gmatch("01",a[i]) then return false end
a[i] = tonumber(a[i])
end
for i=7,8 do
if not string.gmatch("0123456789abcdef",a[i]) then return false end
a[i] = 2^tonumber(a[i],16)
end
if a[6] == 1 then
term.setBackgroundColor(a[7])
term.setTextColor(a[8])
else
term.setBackgroundColor(a[8])
term.setTextColor(a[7])
end
local c = 128
for i=1,5 do
if a[i] ~= a[6] then
c = c + 2^(i-1)
end
end
term.write(string.char(c))
return true
end
This function takes an 8 character string as instructions to draw a box drawing character. The first six are either 0 or 1, and control which color each "pixel" takes on, from left to right, top to bottom. The last two are the color codes in paint format, one for the background (0s) and one for the foreground (1s). I use this for most box-drawing situations.Example: "box(10101078)"
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users











