Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

sirdabalot

Members
  • Content Count

    9
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by sirdabalot

  1. Hello, everyone!

     

    As an opencomputers refresher after a long break from minecraft I've made a log file API.

     

    It currently offers:

    1. Its own interpreter ( included in repo, this thing is pretty darn tweakable )
    2. A WPF interpreter ( more pretty than the one above )
    3. An OOP structure
    4. Exceptionally easy entry creation / filtration / saving / loading
    5. EVERYTHING is open source ( including WPF app )
    6. NEW: Both interpreters can export logs as CSV files for use in MS excel and Open/Libre Office Calc

     

    A link to the repo: https://github.com/sirdabalot/OCLOGAPI

    (All documentation in the API code)

     

    Sample program for creating a log file:

    require("logapi")
    term = require("term")
    
    newlog = logContainer( )
    
    for i = 1, 10 do
    	newlog:addEntry( entry( nil,string.rep( "test" .. i, 20), i + 1 ) )
    end
    
    newlog:save("testser.log")
    

    Sample program for reading a log file:

    require( "logapi" )
    term = require( "term" )
    
    newlog = logContainer( )
    
    newlog:loadFrom("testser.log")
    
    for k, v in ipairs ( newlog.entries ) do
    	term.write( v.timedatestamp .. "#" .. v.info .. "#" .. v.priority .. "\n")
    end
    
    for k, v in ipairs ( newlog:findEntriesByPriority( "5" ) ) do
    	term.write( v:serialize() )
    end
    

    And of course I had best throw in some semi-pretty pictures:

     

    MbEDz63.jpg

     

    I2kb08d.jpg3S8icrJ.jpg

  2. Feeling pretty thick for posting this but here goes...

     

    So I've decided to add a micro-controller to my world, after a while playing around I've figured out how to use components with them, but I have absolutely no idea ( even with an extensive wiki search ) how to get the events API working with them, of course my initial thought was to try and require it in but that obviously doesn't work because of the whole lack of openOS thing, what can I do? Are micro-controllers supposed to be so basic that you can't use events, or am I being a total sock-witt?

     

    Any help would be much appreciated. xD

     

    EDIT: Obviously the search wasn't extensive enough, found all the answers in funnily enough the writing a custom OS wiki page.

    For anyone stuck in the same boat as me: http://ocdoc.cil.li/tutorial:custom_oses

  3. https://github.com/sirdabalot/OCGUIFramework

     

    Hello everyone! This is my first API post so go easy on me. =P

    This is an OpenComputers GUI framework, its currrent features are:

    1. Movable Windows
    2. Buttons
    3. Textboxes
    4. Text inputs

    This is my new GUI framework API, designed to be simple as possible.

     

    Simply require the lua file into your program and start using the functions.

     

    Method information can be found on the readme on the github page.

     

    By the way windows can be moved by clicking the # in the top left corner, also note that after you've entered text into a textInput you must press enter.

     

    Example code:

     

    This code was to be used with the mekanism teleporters.

     
    require( "SOCGUIF" )
    term = require( "term" )
    components = require( "component" )
    
    tele = components.teleporter
    gpu = components.gpu
    
    function setTeleCus( )
    	code = codeIn.text
    	for i = 0, 3 do
    		tele.set( i, tonumber( string.sub( code, i+1, i+1 ) ) )
    	end
    end
    
    function setTeleP1( )
    	code = "0001"
    	for i = 0, 3 do
    		tele.set( i, tonumber( string.sub( code, i+1, i+1 ) ) )
    	end
    end
    
    function setTeleP2( )
    	code = "0002"
    	for i = 0, 3 do
    		tele.set( i, tonumber( string.sub( code, i+1, i+1 ) ) )
    	end
    end
    
    function exitProg( )
    	gpu.setBackground( 0x000000 )
    	gpu.setForeground( 0xFFFFFF )
    	term.clear( )
    	os.exit( )
    end
    
    controlPanelWindow = window( point( 120, 3 ), 18, 6, "Control panel", 0xFFFFFF, 0x00FF00 )
    exitButton = button( controlPanelWindow, point( 2, 2 ), 15, 3, "Exit", 0xFFFFFF, 0xFF0000, exitProg )
    
    customTeleWindow = window( point( 3, 3 ), 22, 9, "Custom teleport", 0xFFFFFF, 0x00FF00 )
    codeInTB = textBox( customTeleWindow, point( 2, 2 ), #"Custom code:", 1, "Custom code:", 0xFFFFFF, 0xFF0000 )
    codeIn = textInput( customTeleWindow, point( 1, 3 ), 19, 0xFFFFFF, 0xFF0000 )
    customTeleButton = button( customTeleWindow, point( 2, 5 ), 19, 3, "Set", 0xFFFFFF, 0xFF0000, setTeleCus )
    
    presetTeleWindow = window( point( 3, 17 ), 22, 10, "Preset teleport", 0xFFFFFF, 0x00FF00 )
    customTeleButton1 = button( presetTeleWindow, point( 2, 2 ), 19, 3, "To portal 1", 0xFFFFFF, 0xFF0000, setTeleP1 )
    customTeleButton2 = button( presetTeleWindow, point( 2, 6 ), 19, 3, "To portal 2", 0xFFFFFF, 0xFF0000, setTeleP2 )
    
    table.insert( windowTable, customTeleWindow )
    table.insert( windowTable, controlPanelWindow )
    table.insert( windowTable, presetTeleWindow )
    
    GUILoop( 0x0000FF )
    

    Result in attached file...

     

     

    post-558-0-92856600-1420316781_thumb.png

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.