This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mibac138's profile picture

MibCore - basic functions

Started by mibac138, 22 January 2013 - 02:38 AM
mibac138 #1
Posted 22 January 2013 - 03:38 AM
Outdated! (I think so it still work but for now I don't do anything with this)

SpoilerHey guys,

here is a small API that i writed my self (with help of grabie2).

I will be still updating the API but for now it is what it is :P/>

functions
SpoilertGetPos() - term.getCursorPos()

tB(color) - term.setBackgroundColor(color)

tT(color) - term.setTextColor(color)

clear() - term.clear()

tSize() - term.getSize()

tPos( [x=1], [y=1] ) - term.setCursorPos(x,y)

clearL( [line=tGetPos()] ) -term.clearLine()

wall( char, line, color ) - on pos 1 of the line and pos 51 of the line it prints char with the color or white

pixWall( line, color ) - on pos 1 of the line and on the pos 51 of the line it's printing pixel with the color

Ln( [x=1] ) - print()

printLine( text, color ) - it's print text with color and scrools 1 line

printLn( text, color ) - printLine(text, color)

printC( text, color ) - print text with color

writeC( text, color ) - write text with color

getInput ( x, y, [replaceChar=nil] ) - reads from the pos and replace it with replaceChar (default not replacing)

TextLine( line, color) - print line from 1 to 51 x pos and color it

drawImage( img, x, y ) - draws image (img - dir)

printCentered( text, line, color ) - print centered text on line with color

require( file ) - if required file not exists then prints: Required file not exists!

wFile( path, text ) - prints to path dir text

download( adress, save ) - downloads file from internet and save it to save dir(tested ONLY with pastebin & dropbox) not working with dropbox, pastebin works correctly only in raw

getDir() - return shell.dir()

cdPath( [dir] ) -if dir isn't nil then shell.run("cd ", dir) else return getDir()

createDir( name ) - shell.run("mkdir ", name)

run( dir ) - shell.run( dir )

code
http://pastebin.com/WVLcpr5H

required
SpoilerComputerCraft 1.45 or above
Advanced computer

installation
Spoiler> pastebin get WVLcpr5H startup
> reboot

Credits
Spoilermibac138 - Creator/Developer.
grabie2 - help

Changelog
Spoilerv1.0.2 Added getDir(), cdPath(), createDir(), run(), RunningProgram() & changed all of variables to local.
v1.0.1 Added tSize() - term.getSize() & fixed getInput() return.
v1.0 First public version published.
If you like it please give +1 ;)/>

I'm from Poland sorry for my English :P/>
smigolpol #2
Posted 23 January 2013 - 06:33 AM
-
mibac138 #3
Posted 23 January 2013 - 06:37 AM
Thanks! :)/>
Dlcruz129 #4
Posted 24 January 2013 - 01:04 PM
What's the point of this? It seems to me like just aliases of simple, easy to use code.
mibac138 #5
Posted 26 January 2013 - 09:43 AM
-