1
14 replies to this topic
#1
Posted 30 June 2013 - 11:00 AM
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
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
#2
Posted 30 June 2013 - 12:50 PM
Moved to Ask a Pro.
#3
Posted 30 June 2013 - 02:04 PM
Remember people are rarely happy to write code for you.
"Scrollig a cross and text scale 5"?
"Scrollig a cross and text scale 5"?
#4
Posted 30 June 2013 - 02:08 PM
Edited and I Know but I would really be grateful if someone could help.
#5
Posted 30 June 2013 - 03: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
#6
Posted 30 June 2013 - 04:39 PM
THANK YOU!!!!!!!!! But could You make the text scale to fit a monitor 2 high by 5 wide.
#7
Posted 30 June 2013 - 04: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
#8
Posted 30 June 2013 - 04: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.
#9
Posted 30 June 2013 - 04: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
he means make it span both monitors man, just add more spaces. No need to make things bigger
Apemanzilla, on 30 June 2013 - 04:58 PM, said:
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 by KaoS, 30 June 2013 - 04:59 PM.
#10
Posted 01 July 2013 - 10: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
#11
Posted 03 July 2013 - 03: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)
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)
#12
Posted 03 July 2013 - 12:22 PM
You cannot use two different scales on one monitor.
#13
Posted 05 July 2013 - 11:32 AM
you can just change the number on first line "Local tin"
#14
Posted 11 July 2013 - 02:00 AM
So using this, thanks, saved me a post!!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users