9 posts
Posted 30 June 2013 - 12:00 PM
I have a idea I want a Advanced monitor to the display "Speedys Farm" but I want it to be scrolling across the screen and the on the second line of my monitors I want a bit of coloured text saying " Farm Shop Open " in green and " Farm Shop Closed " and to beable to switch between open/closed with a Redstone input.
if some could help Me write a progam to do that I would be forever grateful. I know very limited code so I need some help.
Thanks
Speedy
8543 posts
Posted 30 June 2013 - 01:50 PM
Moved to Ask a Pro.
191 posts
Posted 30 June 2013 - 03:04 PM
Remember people are rarely happy to write code for you.
"Scrollig a cross and text scale 5"?
9 posts
Posted 30 June 2013 - 03:08 PM
Edited and I Know but I would really be grateful if someone could help.
11 posts
Location
I am in your room, disguised as an object :)
Posted 30 June 2013 - 04:31 PM
local tin = .1
local tim = os.startTimer(tin)
local i = 0
local rside = "left" -- Redstone Side
local mside = "right" -- Monitor Side
local mon = peripheral.wrap(mside)
local w,h = mon.getSize()
local st = "Speedy's Farm"
local ro = "Farm Shop Open"
local rc = "Farm Shop Closed"
mon.clear()
while true do
local e,p = os.pullEvent()
if e == "timer" and p == tim then
tim = os.startTimer(tin)
mon.setTextColor(colors.white)
mon.setCursorPos(1,1)
mon.clearLine()
for j=1, #st do
local x = i + j
if x > w then x = x - w end
mon.setCursorPos(x, 1)
mon.write(st:sub(j, j))
end
i = i + 1
if i > w then i = 0 end
local inp = redstone.getInput(rside)
mon.setCursorPos((w/2)-((inp and #ro or #rc)/2),2)
mon.setTextColor(inp and colors.lime or colors.red)
mon.clearLine()
mon.write(inp and ro or rc)
end
end
Tried my best
9 posts
Posted 30 June 2013 - 05:39 PM
THANK YOU!!!!!!!!! But could You make the text scale to fit a monitor 2 high by 5 wide. :)/>
1548 posts
Location
That dark shadow under your bed...
Posted 30 June 2013 - 05:54 PM
here is my take on it
local delay=0.1
local scrolled=1
local str="Speedy's Farm"
term.redirect(peripheral.wrap("right"))
local timer=os.startTimer(delay)
local tOpts={[true]="Open",[false]="Closed"}
local evt={}
while true do
if evt[1]=="timer" and evt[2]==timer then
scrolled=(scrolled+1)%term.getSize()
timer=os.startTimer(delay)
end
term.clear()
term.setCursorPos(1,1)
print((str..(term.getSize()-#str>0 and string.rep(" ",term.getSize()-#str) or "")):sub(scrolled+1,#str>term.getSize() and term.getSize()+scrolled or nil)..(#str<term.getSize() and str:sub(1,scrolled) or term.getSize()+scrolled>#str and str:sub(1,term.getSize()+scrolled-#str) or ""))
print("Farm Shop "..tOpts[rs.getInput("left")])
evt={os.pullEvent()}
end
1610 posts
Posted 30 June 2013 - 05:58 PM
After the line
local mon = peripheral.wrap(mside)
add a line
mon.setTextScale(1.0)
Play around with the 1.0 until it fits, increasing and decreasing it.
1548 posts
Location
That dark shadow under your bed...
Posted 30 June 2013 - 05:58 PM
PS my version auto scales, I then modified it again to re-scale every render so if you change the monitors while it is running it auto-fits and always works
After the line
local mon = peripheral.wrap(mside)
add a line
mon.setTextScale(1.0)
Play around with the 1.0 until it fits, increasing and decreasing it.
he means make it span both monitors man, just add more spaces. No need to make things bigger
Edited on 30 June 2013 - 03:59 PM
9 posts
Posted 01 July 2013 - 11:08 AM
Robert00001 version works the best. thanks for your input Kaos. thanks for the telling me how to change the size but could the top line be like size 4 and the bottom line like size 2. and is it possible to make the scrolling slower. thanks
159 posts
Location
A Chair
Posted 03 July 2013 - 04:19 AM
to make the scrolling slower just add a sleep(0.5) in the script…
Just after the mon.write line should be a good place to put the sleep command in . (increase the 0.5 to 1 if the speed is too fast and decrease it by 0.1 if it's too slow)
8543 posts
Posted 03 July 2013 - 01:22 PM
You cannot use two different scales on one monitor.
9 posts
Posted 05 July 2013 - 12:32 PM
you can just change the number on first line "Local tin"
44 posts
Location
Australia
Posted 11 July 2013 - 03:00 AM
So using this, thanks, saved me a post!!
9 posts
Posted 12 July 2013 - 05:53 PM
So using this, thanks, saved me a post!!
Glad you like it works really well just put pastebin z2fe6BEy Startup into the computer.
thanks to all the people that helped :)/>