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

Issue with placing liquid in world

Question

Posted

Hello, I am attempting to create a program which will mimic the functionality of a bucket by placing the equivalent amount of fluid into the world from the internal tank of the robot. However, I am having an issue when attempting to do this within the program when importing the Robot API.

The functionality I am attempting to achieve is possible using the lua console.

When I use the "robot.fill()" command within the lua interpreter and the robot is not facing a block it places the fluid into the world without issue. I have attempted to reproduce this functionality using a program on the disk of the robot which runs the same function:

component = require("component")
robot = component.proxy("967f2323-a467-47b4-aba0-f56eba593d6f")
robot.fill(1000)

When attempting to run this code with the component's functions imported, it presents the following error in relation to the use of the 'fill' command:

invalid side:
stack traceback:
		[C]: in function 'error'
		machine:986: in function <machine:983>
        (...tail calls...)
        /home/progs/oil:21: in main chunk
        (...tail calls...)
        [C]: in function 'xpcall'
        machine:751: in function 'xpcall'
        /lib/process.lua:84: in function </lib/process.lua:80>

Please be aware that I am fairly new to using this mod (I have only started using this mod yesterday).

Any insights you could provide to this issue would be helpful,

Thanks in advance!

2 answers to this question

Recommended Posts

  • 0
Posted
--try loading the robot lib through the require statement. In the lua interpreter the robot lib is loaded by default.
-- I dont think the component.robot library uses the same robot.fill function....
-- So, either replace the top lines of your program with this...
local robot = require 'robot'
robot.fill(1000) -- this assumes the tank is attatched to sides.front

-- Or try this which i would recommend...
local component = require 'component'
local sides = require 'sides'
local robot = component.proxy( component.get('967f') )
robot.fill( sides.front, 1000 ) -- or whatever side you want...

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

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