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

yesiwear.pants

Members
  • Content Count

    5
  • Joined

  • Last visited

Posts posted by yesiwear.pants

  1. As an Example I wrote a platform builder but if I set the dimensions to big I have to babysit the robot to make sure it doesn't run out of material.

     

    I would like to stop the build get resources and pickup where I left off.

     

    robot.select(slot) is in a separate file as part of a library of Inventory related functions

     

    in-case you wanted to see

     

    Edit:

    I have not Implemented it yet but i was going to try this

     

    Edit:

    platform

    http://pastebin.com/Bd2rdY87

    Inventory

    http://pastebin.com/euHL9zAz

    Break

    http://pastebin.com/CcCTWJ5Z

     

    I realize the doLoop wont work but I am getting this error    "module 'Inventory' not found              no package.preload['Inventory'] /home/lib/Inventory.lua:33: expected <eof> near return

  2. I apologize that was a derp on my part. yes the file is currently named slots. I made a copy named Inventory and forgot to change build.lua

    slots is still there for now

    and as a side note Ive never used CC

     

    Edit : that worked thank you

              had to restart the robot to take effect I guess

  3. I wrote a simple tower building script/program, it works, but then I thought " I'm going to use this code a lot" so I started an Inventory.lua filled with functions no scripting of its own.

     

    If I run this I get attempt to index upvalue 'Inventory' (a boolean value)

     

    Inventory.lua

    local robot = require ("robot")
    
    slot = 1
    
    function nextFull()
    if robot.count(slot) == 0 then
      slot = slot + 1
      robot.select(slot)
    end
    end
    

    build.lua

    local tArgs = {...}
    local length = tonumber(tArgs[1])
    local width = tonumber(tArgs[2])
    local height = tonumber(tArgs[3])
    local robot = require ("robot")
    local Inventory = require ("Inventory")
    local slot = 1
    
    toggle = true
    
    
    print ("Enter Length for Structure")
    length = io.read()
    print ("Width?")
    width = io.read()
    print = ("Height?")
    height = io.read()
    
    length = length - 1
    width = width - 1
    
    robot.select(1)
    
    function block()
      if toggle == true then
        for i=2,length do
          Inventory.nextFull()
          robot.placeDown()
          robot.forward()
          toggle = false
        end
      else
        for j=2,width do
          Inventory.nextFull()
          robot.placeDown()
          robot.forward()
          toggle = true
        end
      end
    end
    
    function row()
    block()
    robot.turnRight()
    end
    
    function layer()
      for k=0,3 do
        row()
      end
    end
    
    layer()
    for l=1,height do
      robot.up()
      layer()
    end
    
    robot.turnRight()
    robot.back()
    robot.back()
    robot.select(16)
    
    for m=1,height do
      robot.down()
      robot.place()
    end
    
×
×
  • Create New...

Important Information

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