Electronic tool

  • china-richway2
    20th Aug 2013 Member 0 Permalink

    Place this tool on an electronic element (such as METL, WIFI, etc). When this element gets sparked (PRTI and WIFI also count as this channel has been sparked) the game PAUSE.

    That 'instruction interpreter' part is actually a hardware program, and I want to break at 'breakpoints' and find the problems. If this tool is implemented, it will be much more easier to make my CPU.

     

    Hope it can be implemented in the next version!

  • boxmein
    20th Aug 2013 Former Staff 0 Permalink
    Oooooh breakpoints sound fun. I can implement them with Lua too.
    Edit: I do did doned them! Have fun!
    -- breakpoint element for very slow spark circuit debugging
    local ellie = elem.allocate("boxmein", "BRPT")
    elem.element(ellie, elem.element(elem.DEFAULT_PT_DMND))
    elem.property(ellie, "Name", "BRPT")
    elem.property(ellie, "Colour", 0xDEADBEEF)
    elem.property(ellie, "Description", "Breakpoints. When spark is touching, will pause the game and turn themselves red. Also glowy.")
    elem.property(ellie, "MenuSection", elem.SC_POWERED)
    elem.property(ellie, "Properties", elem.PROP_LIFE_DEC)
    elem.property(ellie, "Update", function (i, x, y, ss, nt)
    local life = sim.partProperty(i, "life")
    for ry=-1,1,1 do
    for rx=-1,1,1 do
    if life == 0 and tpt.get_property("type", x+rx, y+ry) == elem.DEFAULT_PT_SPRK then
    tpt.set_pause(1)
    sim.partProperty(i, "life", 10)
    end
    end
    end
    end)

    elem.property(ellie, "Graphics", function (i, colr, colg, colb)
    local pixel_mode
    local x, y = sim.partPosition(i)
    local life = sim.partProperty(i, "life")
    if life > 0 then
    pixel_mode = 296
    colg, colb = 0, 0
    colr = 255
    else

    pixel_mode = 1
    end
    return 0,pixel_mode,255,colr,colg,colb,255,colr,colg,colb
    end)
    Edited 3 times by boxmein. Last: 21st Aug 2013
  • mniip
    20th Aug 2013 Developer 0 Permalink
    pixel_mode, colr, colg, colb are globals

    EDIT: uh, i didn't sleep well today
    Edited once by mniip. Last: 21st Aug 2013
  • china-richway2
    21st Aug 2013 Member 0 Permalink

    @boxmein (View Post)

    Very good! Thanks!

  • boxmein
    21st Aug 2013 Former Staff 0 Permalink
    @mniip (View Post)
    colr, colg, colb are in fact call arguments. pixel mode tho.