Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- MINEX
- --[[
- SYSTEM:
- sys.version() - var=sys.version(). Returns the version of MineX.
- AUDIO:
- audio.note(note) - audio.note(A#) OR audio.note(A) OR audio.note(Cb). doesn't matter about the letter being capitalized, but the flat and sharp must be correct (flat must be a lower-case b). Note listing below.
- audio.side(side) - audio.side(back). For if the bundled cable is on the back of the computer.
- UTIL:
- util.sprint(text to slow print) - This just slow prints the text.
- util.openAll() - Opens all ports.
- util.ejectAll() - Ejects all disks from surrounding disk drives.
- util.bytecode("infile","outfile") - util.bytecode("path/to/input_file","path/to/output_file"). Turns a file into bytecode.
- DRAW:
- draw.clear() - Clears the screen and sets the cursor to 1,1.
- draw.square(char,topleftx,toplefty,bottomrightx,bottomrighty) - draw.square("x",1,1,6,6). draws a square with the 1 and 1 being the x and y of the top left corner, and the 6 and 6 being the x and y of the bottom right corner.
- draw.dchar(char,x,y) - draw.dChar("X",1,4). Draws an X at 1,4.
- draw.line(char,dir,xTo,yTo,len) - draw.line("O","right",4,6,5). Draws a 5 long line, at 4,6, going to the right, with O as the character.
- SOUND-CARD SETUP
- Order of Notes: (For sound-card setup)
- List Number. color - note - clicks on noteblock to attain this.
- 1. white - A - 3
- 2. orange - A#/Bb - 4
- 3. magenta - B - 5
- 4. lightBlue - C - 6
- 5. yellow - C#/Db - 7
- 6. lime - D - 8
- 7. pink - D#/Eb - 9
- 8. gray - E - 10
- 9. lightGray - F - 11
- 10. cyan - F#/Gb - 12
- 11. purple - G - 13
- 12. blue - G#/Ab - 14
- ]]--
- draw={} -- Establish the function tables
- util={}
- obj={}
- sys={}
- audio={}
- function sys.version()
- return "0.1"
- end
- function draw.line(char,dir,xTo,yTo,len)
- xTo=tonumber(xTo)
- yTo=tonumber(yTo)
- if char == nil then print("Char is nil") end
- if dir == nil then print("Direction is nil") end
- if xTo == nil then print("X is nil") end
- if yTo == nil then print("Y is nil") end
- if len == nil then print("Length is nil") end
- len=len-1
- for i=0,len do
- term.setCursorPos(xTo,yTo)
- write(tostring(char))
- if dir == "down" then yTo=yTo-1 end
- if dir == "up" then yTo=yTo+1 end
- if dir == "right" then xTo=xTo+1 end
- if dir == "left" then xTo=xTo-1 end
- end
- end
- function draw.dChar(char,x,y)
- if char == nil then print("Char is nil") end
- if x == nil then print("X is nil") end
- if y == nil then print("Y is nil") end
- term.setCursorPos(tonumber(x),tonumber(y))
- write(tostring(char))
- end
- function draw.square(char,topx,topy,botx,boty) -- square("X",1,1,6,6)
- len=botx-topx
- draw.line(char,"right",topx,topy,len)
- draw.line(char,"left",botx,boty,len)
- draw.dChar(char,topx+len,topy)
- draw.dChar(char,botx-len,boty)
- hlen=boty-topy
- draw.line(char,"up",topx,topy,len)
- draw.line(char,"up",botx,boty-hlen,len)
- end
- function draw.clean()
- term.clear()
- term.setCursorPos(1,1)
- end
- function util.sprint(text)
- textutils.slowPrint(tostring(text))
- end
- function util.bytecode(path, outname)
- -- Passing a non-string into a string excepting function is... not an expected case.
- local f=fs.open(path,"r") -- Open the file to read from
- local out=fs.open(outname,"wb") -- Open the file to write too
- local contents=f.readAll() -- Read the file
- local func=loadstring(contents) -- Loadstring the file
- local outfile=string.dump(func) -- Turn it into bin
- for i=1,#outfile do -- Files opened with wb are written byte by byte
- out.write(outfile:byte(i)) -- And write it
- end
- end
- function util.openAll()
- rednet.open("right")
- rednet.open("left")
- rednet.open("top")
- rednet.open("back")
- end
- function util.ejectAll()
- disk.eject("right")
- disk.eject("left")
- disk.eject("bottom")
- disk.eject("back")
- disk.eject("top")
- end
- function audio.side(side)
- aSide=tostring(side)
- end
- function audio.wipe()
- rs.setBundledOutput(aSide,0)
- end
- function audio.note(note)
- if tostring(note)=="a" or tostring(note)=="A" then redstone.setBundledOutput(aSide, colors.white) sleep(0.5) audio.wipe() end
- if tostring(note)=="a#" or tostring(note)=="A#" or tostring(note)=="bb" or tostring(note)=="Bb" then redstone.setBundledOutput(aSide, colors.orange) sleep(0.5) audio.wipe() end
- if tostring(note)=="b" or tostring(note)=="B" then redstone.setBundledOutput(aSide, colors.magenta) sleep(0.5) audio.wipe() end
- if tostring(note)=="c" or tostring(note)=="C" then redstone.setBundledOutput(aSide, colors.lightBlue) sleep(0.5) audio.wipe() end
- if tostring(note)=="c#" or tostring(note)=="C#" or tostring(note)=="db" or tostring(note)=="Db" then redstone.setBundledOutput(aSide, colors.yellow) sleep(0.5) audio.wipe() end
- if tostring(note)=="d" or tostring(note)=="D" then redstone.setBundledOutput(aSide, colors.lime) sleep(0.5) audio.wipe() end
- if tostring(note)=="d#" or tostring(note)=="D#" or tostring(note)=="eb" or tostring(note)=="Eb" then redstone.setBundledOutput(aSide, colors.pink) sleep(0.5) audio.wipe() end
- if tostring(note)=="e" or tostring(note)=="E" then redstone.setBundledOutput(aSide, colors.gray) sleep(0.5) audio.wipe() end
- if tostring(note)=="f" or tostring(note)=="F" then redstone.setBundledOutput(aSide, colors.lightGray) sleep(0.5) audio.wipe() end
- if tostring(note)=="f#" or tostring(note)=="F#" or tostring(note)=="gb" or tostring(note)=="Gb" then redstone.setBundledOutput(aSide, colors.cyan) sleep(0.5) audio.wipe() end
- if tostring(note)=="g" or tostring(note)=="G" then redstone.setBundledOutput(aSide, colors.purple) sleep(0.5) audio.wipe() end
- if tostring(note)=="g#" or tostring(note)=="G#" or tostring(note)=="ab" or tostring(note)=="Ab" then redstone.setBundledOutput(aSide, colors.blue) sleep(0.5) audio.wipe() end
- end
- -- Order of notes and sound-card setup at top of page.
Advertisement
Add Comment
Please, Sign In to add comment