Give me a shout if either of those don't work and I'll see if I can fix them up for you.
[1.31] Small Monitor API v1.2
Started by ihaveamac, Mar 13 2012 05:32 AM
28 replies to this topic
#21
Posted 15 June 2012 - 05:24 PM
#22
Posted 23 June 2012 - 09:29 AM
For the marquee, try
It failed when I tested it, but maybe you can build something off of it.
x,y = term.getSize()
function marqueeRight(text,ypos)
val = 1
while true do
term.clear()
term.setCursorPos(val,ypos)
write(text)
if val == x then
val = 1
else
val = val + 1
end
sleep(0.5)
end
end
It failed when I tested it, but maybe you can build something off of it.
#24
Posted 26 June 2012 - 12:57 AM
function marqueeLeft(side, text, ypos, sleep)
if peripheral.isPresent(side) then
term.redirect(peripheral.wrap(side))
local sx, sy = term.getSize()
text = string.rep(" ", sx - 1)..text
for i=1,string.len(text) do
term.clearLine()
displayString = string.sub(text, i, math.min(string.len(text), (i + sx - 2)))
term.setCursorPos(1, ypos)
write(displayString)
os.sleep(sleep)
end
term.clearLine()
term.restore()
end
end
function marqueeRight(side, text, ypos, sleep)
if peripheral.isPresent(side) then
term.redirect(peripheral.wrap(side))
local sx, sy = term.getSize()
text = string.rep(" ", sx - 1)..text..string.rep(" ", sx - 1)
for i = 1,string.len(text) - (sx - 1) do
term.clearLine()
displayString = string.sub(text, -math.min(string.len(text), i + sx - 2), -i)
term.setCursorPos(1, ypos)
write(displayString)
os.sleep(sleep)
end
term.clearLine()
term.restore()
end
end
Fixed versions. Tested them and they seem to work fine here on a variety of monitor sizes. Give these guys a whirl.
#25
Posted 30 June 2012 - 10:03 PM
Lyqyd, on 26 June 2012 - 12:57 AM, said:
function marqueeLeft(side, text, ypos, sleep)
if peripheral.isPresent(side) then
term.redirect(peripheral.wrap(side))
local sx, sy = term.getSize()
text = string.rep(" ", sx - 1)..text
for i=1,string.len(text) do
term.clearLine()
displayString = string.sub(text, i, math.min(string.len(text), (i + sx - 2)))
term.setCursorPos(1, ypos)
write(displayString)
os.sleep(sleep)
end
term.clearLine()
term.restore()
end
end
function marqueeRight(side, text, ypos, sleep)
if peripheral.isPresent(side) then
term.redirect(peripheral.wrap(side))
local sx, sy = term.getSize()
text = string.rep(" ", sx - 1)..text..string.rep(" ", sx - 1)
for i = 1,string.len(text) - (sx - 1) do
term.clearLine()
displayString = string.sub(text, -math.min(string.len(text), i + sx - 2), -i)
term.setCursorPos(1, ypos)
write(displayString)
os.sleep(sleep)
end
term.clearLine()
term.restore()
end
end
Fixed versions. Tested them and they seem to work fine here on a variety of monitor sizes. Give these guys a whirl.
#26
Posted 15 July 2012 - 11:22 PM
Updated to v1.2, fixed marquee functions and added monitorapi.run(side, func).
#27
Posted 11 August 2012 - 10:55 AM
Changed title for you, next time just edit your topic, then choose Full Editor.
#28
Posted 01 May 2013 - 02:33 PM
Could you please create a function for:
m.setTextScale(size) -- size can be any number from 1 to 5 --example: monitorapi.setTextScale(side, size) -- make it return an error when you use a size not within 1-5Thanks
#29
Posted 01 May 2013 - 04:08 PM
That function is a pretty trivial addition.
Might as well just use the peripheral call. Either way, this is pretty old. Locked.
function setTextScale(side, size) return peripheral.call(side, "setTextScale", size) end
Might as well just use the peripheral call. Either way, this is pretty old. Locked.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


This topic is locked









