Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Custom monitor program 0-0-2
- -- Works with: Advanced Computer & Monitor
- -- Environment Tested: Minecraft 1.6.4 Computer Craft version 1.5
- -- By RCMilkshakebunny @ www.rcftb.eu
- -- Download this file here >> http://pastebin.com/XL59sEqU
- -- ##########################
- -- DEFINE VARIABLES -- BEGIN
- -- Define peripheral monitor side
- m = peripheral.wrap("top")
- -- DEFINE VARIABLES -- END
- -- ##########################
- -- ##########################
- -- FUNCTIONS - BEGIN
- -- set the cursor position on the monitor ready to write
- -- in this case 1,1 means the first line at the first character. so for western based code that would be TOP,LEFT
- -- if we were to put (5,10) then the cursor would begin at the 5th line down and the 10th character position in from the left
- -- in this case the function requires the value to be given in the call
- function cursor(p1,p2)
- m.setCursorPos(p1,p2)
- end
- -- clear any content on the monitor function
- function clearMon()
- m.clear()
- end
- -- set text color function
- function textColor(setTo)
- -- set the color the text will be
- -- in this case blue
- -- the choices: white | orange | magenta | lightBlue | yellow | lime | pink | gray
- -- contd.. | lightGray | cyan | purple | blue | brown | green | red | black
- -- you can also reference colors by a 'decimal value' without the requirement of the use of 'colors'
- -- an example of referencing a color for text by decimal is
- -- m.setTextColor(512) and this would produce the same result as m.setTextColor(colors.cyan)
- -- m.setTextColor(colors.blue) -- << basic usage
- m.setTextColor(setTo)-- << dynamic usage
- end
- -- write to monitor function
- function monitorWrite(txt)
- m.write(txt)
- end
- -- monitor set new line
- function nl()
- local _,cY= m.getCursorPos()
- m.setCursorPos(1,cY+1)
- end
- --initialise monitor function
- function mInit()
- clearMon()
- cursor(1,1)
- textColor(512)
- end
- -- ##########################
- -- TERMINAL FUNCTIONS -- BEGIN
- -- clears terminal
- function clearTerm()
- term.clear()
- end
- -- writes to the terminal
- function writeTerm(termtext)
- term.write(termtext)
- end
- -- set terminal cursor position -- Dynamic
- function termCursor(p1,p2)
- term.setCursorPos(p1,p2)
- end
- -- terminal set new line
- function term_nl()
- local _,cY= term.getCursorPos()
- term.setCursorPos(1,cY+1)
- end
- -- TERMINAL FUNCTIONS -- END
- -- ##########################
- -- the program function
- function program()
- -- ##########################
- -- PROGRAM OUTPUT - BEGIN
- clearTerm()
- termCursor(1,1)
- writeTerm("Program Running")
- term_nl()
- -- Test Output to Monitor
- monitorWrite("Monitor write completed")
- -- Test output to Terminal
- writeTerm("Terminal write completed")
- -- PROGRAM OUTPUT - END
- -- ##########################
- end
- -- FUNCTIONS -- END
- -- ##########################
- -- ############################################################
- -- ############################################################
- -- ##########################
- -- SEQUENCE -- BEGIN
- mInit()
- program()
- -- SEQUENCE -- END
- -- ##########################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement