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

nezd

Members
  • Content Count

    18
  • Joined

  • Last visited

Posts posted by nezd

  1. OctoTapeFS v0.1

    Slowest way to store your files

    Do you remember this days when your commodore loads software from tape? I don't, i weren't even born when commodore were popular.

    Well, now you could bring this days back with OctoTapeFS - The slowest way to store your files!

    Link to pastebin

    Video Showcase

    Possible arguments:

    • -h Displays help message
    • --save=path Save file from path to tape
    • -l Loads file from tape
    • --dump=path Save file from tape to path
    • -v Toggle verbosity
    • -f Disable waiting for user input in load

    TODO:

    • Code compression(removing spaces)
    • Make it faster
    • Adding a file structure

     

  2. You forgot to specify the direction in a functions swing() and compare()

    Ðnd the robot can not move to the sides 4 and 5, for this it is necessary to turn to left/right.

    What do you mean about sides 4 and 5? There is no code thats moves it to this sides.

  3. Hi!(again)

    My program for robot(flashed in eeprom) dont work and causes error i typed in topic title.

    Here is the code:

    robot = component.proxy(component.list("robot")())
    rs = component.proxy(component.list("redstone")())
    function getBatteryPercent ()
      local percent = computer.energy() * 100 / computer.maxEnergy()
      return percent
    end
    function wait(seconds)
      local begin = os.time()
      repeat
        computer.pullSignal(0.05)
      until os.time() - begin >= seconds
    end
    while true do
      robot.turn(true)
      robot.turn(true)
      robot.move(1)
      while robot.compare() ~= true do
        robot.move(3)
        if robot.detect(5) == true then
          robot.turn(false)
          robot.swing()
          robot.turn(true)
        end
        if robot.detect(4) == true then
          robot.turn(true)
          robot.swing()
          robot.turn(false)
        end
      end
      robot.turn(true)
      robot.move(0)
      robot.turn(true)
      while true do
      if redstone.getInput(1) > 0 then
        if getBatteryPercent() < 20.0 then
          rs.setOutput(0, 15)
        else
          rs.setOutput(0, 0)
        end
        wait(60)
      else
        robot.move(3)
    end end end
    
    
  4. My code crashes with this reason:too long without yielding.

    How to fix this?

    Here is code:

    red = component.proxy(component.list("redstone")())
    local bottom = 0
    local back = 2
    function wait(seconds)
      local start = os.time()
      repeat until os.time() > start + seconds
    end
    while true do
      if red.getInput(bottom) > 0 then
        wait(50)
        red.setOutput(back, 15)
        wait(5)
      else
        red.setOutput(back, 0)
    end end
    
  5. Here is receiver program:

    event = require("event")
    require("component").modem.open(1)
    function receive ()
      while true do
        local eventData = { event.pull() }
        if eventData[1] == "modem_message" then
          local message = eventData[6]
          local port = eventData[4]
          local adress = eventData[3]
          return message, port, adress
    end end end
    while true do
      local m, p, a = receive()
      print(p)
    end
    

    And here is sender program:

    m = require("component").modem
    print("Type address")
    adr = io.read()
    print("Type message")
    msg = io.read()
    if m.send(adr, 1, msg) == true then
      print("Message sended succesfully")
    else
      print("Error occured")
      computer.beep(500)
      os.sleep(0.5)
      computer.beep(500)
    end
    

    And the problem: receiver receives only broadcast messages.

    I use wireless card on tablet and on PC

  6.  

    process.load(path:string[, env:table[, init:function[, name:string]]]):coroutine

    Loads a Lua script from the specified absolute path and sets it up as a process.

    It will be loaded with a custom environment, to avoid cluttering the callers/global environment. This environment will have access to anything in the specified environment, or the default (top level) environment if none is given.

    (since OpenOS 1.6) path can also be a function, in which case env must be nil.

    If an init function is specified, that method is called the first time the resulting coroutine is executed, and run before the actual program is started. This allows fine-tuning of the programs environment.

    If a name is specified, that is the name the process will specify in process.running. It will be nil otherwise.

    http://ocdoc.cil.li/api:process?s[]=process

×
×
  • Create New...

Important Information

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