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


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Molinko

  1. The error you received stems from the second variant of this function. You can call rs.setOutput like so.. -- # with a number side[0-5] and a signal strength rs.setOutput(2, 15) -- # using the sides api but basically the same thing rs.setOutput(sides.east, 15) -- # or by setting multiple sides at the same time by passing a table rs.setOutput({ -- # [sides.west] evaluates to a number side [sides.west] = 15, [sides.south] = 10 })
  2. Pretty sure you need to use the HTTP Request Object API that component.internet.request returns. It is a userdata table with methods. I broke my MC launcher so I cant test this but you can try something along these lines.. Got a chance to test and the below code I have didn't quite work... I've updated it local success, response = pcall(web.request, "<your api call>") if not success then error("Something sucks here..") end local content = "" for chunk in response.read do -- # changed to response.read content = content .. chunk end doStuffWithData(content) -- # yay!?
  3. I would expect that you're somehow overwriting the string lib in your context.. I would recommend using a different variable name for your string value other than `string` as this will probably cause your error later when calling string.format on it.. The result of type(string) by default would normally result in "table" because `string` is a global Lua library.
  4. Molinko

    Hep with my code?

    Can you do me a solid and either point me to the print3d source code or take a screenie of line 70 in OC?
  5. @Nogitsu there is actually already a mod for that called OC glasses and OC glasses 2
  6. I just tried this in OC | MC 1.12.2 | Forge No dice. I guess there is indeed a bug.. Perhaps it was fixed in OC when you tried it.. Bummer
  7. Have you tried it in the tool slot and in an inventory slot(while selected)? I'm gonna try it and get back to you..
  8. Have you tried using the sneaky parameter with robot.use?
  9. I think some form of navigation library and server would be great. Imagine a robot or drone wants to go somewhere in your base. You could write a server that calculates a path from point 'A' to point 'B' and serves a path string (like the one your library uses) back to the robot/drone. Maybe have the server update knowledge of the base layout with a robot / drone using a geolyzer so it can give clear paths to clients. It's a mouthful but could keep other programs very simple and would be very reusable.
  10. I love that you're posting OC videos on youtube! Definitely not enough content out there to enjoy . I would suggest a perhaps more simple handler for the list of movements though. -- # The almighty lookup table local actions = { f = robot.forward, b = robot.back, u = robot.up, d = robot.down, tl = robot.turnLeft, tr = robot.turnRight, ta = function() -- # turn around local status, reason for i = 1, 2 do status, reason = robot.turnLeft() if not status then break end end return status, reason end, s = robot.swing, su = robot.swingUp, sd = robot.swingDown, ... } function move.act(act) if not actions[act] then return false, "Undefined act" end return actions[act]() end
  11. Happy to help. Remember to use the man command to check for docs on shell programs and when possible mentions any errors you get verbatim.
  12. I'm not sure exactly but the leading slash may be throwing you off.. Follow my instructions from your home dir so we can be sure to replicate what I just tested. On source computer: /home # cp ./main.lua /mnt/38d/test.lua /home # ls /mnt/38d #this is to check we're not crazy and the file has been copied to the floppy On robot: /home # cp /mnt/38d/test.lua ./main.lua /home # ls . #list the current dir to check that we have copied our file successfully Run man cp to get a better grip on what the cp command can do.
  13. Insert the floppy into a drive then in the Shell run ls /mnt to find your floppy. Let's say it was /mnt/5ae. Run cp my_file /mnt/5ae/my_file I may be rusty so if you need help on shell programs run the man program with the name of a program for usage instructions. man cp
  14. I'm not sure it's possible. You could try to use component.invoke but I'm not sure if that's the issue..
  15. Exit the Lua interpreter. Run `components | more` without the backticks just like you would in a Linux shell.
  16. local function findInvs(ic) -- # ic: inventory_controller proxy local invs = {} -- # Loop over all sides for an inventory name. for side = 0, 5 do local name = ic.getInventoryName(side) -- # If an inventory name is present then store the name/type and the side:number if name then table.insert(invs, {name = name, side = side}) end end return invs end Example: local component = require 'component' local sides = require 'sides' local ic = component.inventory_controller local inventories = findInvs(ic) for i, inv in ipairs(inventories) do local side, size = sides[inv.side], ic.getInventorySize(inv.side) print("inventory at side: '" .. side .. "' has " .. tostring(size) .. " slots") end
  17. The server code has no queue implementation so if the server takes too long too execute a certain command then i imagine the packet with a command from another client simply won't be executed. If you can wait a bit I'll update the example with a queue or you can take a walk at it yourself. You're very welcome bud.
  18. I believe I see where you're trying to go with this but I think there is an easier way. Store the reactor proxies as values in a key/value table and then send method names and args to be executed. Here's a simple example.. -- # Reactor server: Recieves commands from remote client to be run local component = require 'component' local event = require 'event' local modem = component.modem modem.open(1040) -- # List of reactors to call methods remotely upon local reactors = { r1 = component.proxy(component.get '0c60c'), r2 = component.proxy(component.get '0ef58'), r3 = component.proxy(component.get '255aa') } repeat -- # pack it all into a table local msg = table.pack(event.pull('modem_message')) -- # the droids we're looking for local reactor, method = msg[6], msg[7] -- # args to call with the remote method (if any) local args = #msg > 7 and table.pack(table.unpack(msg, 8)) or {} -- # if remote reactor id is present then... if reactors[reactor] then -- # execute the method call with args on a specific reactor. guarded for faulty messages with pcall so we dont crash. local result = table.pack(pcall(reactors[reactor][method], table.unpack(args))) print(sting.format("called %s on reactor id %s", method, reactor)) -- # respond to client with result modem.send(msg[2], msg[3], table.unpack(result)) end -- # client can send the message 'exit' to quit or hold Ctrl+C on the server until msg[6] == 'exit' -- # End of server -- # client: Send remote commands to be run on server components -- # A very simple client... Spruce it up as needed local component = require 'component' local event = require 'event' local modem = component.modem modem.open(1040) modem.send(server.address, server.port, 'r1', 'isProcessing') -- # exec 'isProcessing' on 'r1' at server print(event.pull('modem_message', modem.address, server.address, server.port)) -- # print and await server response -- # End of client
  19. I don't think there is but you can double check by running the dmesg program for observing available events. The only other thing rather than polling the contents would be an observer block maybe.. But that won't give you a slot number..
  20. Molinko

    Wired networks

    Pretty sure you need to separate them as you described. Also because each computer will see the others components and eventually fail to boot from a too many components error
  21. Id check out this tiny library that you can probably fit along with your main program. multithread <- yeehaw
  22. Im trying to test it right now but Im not too good with Applied energistics... What component of the me network is your OC adapter touching? I have it touching the me_interface but I dont have the component method me_interface.getAvailableItems() just me_interface.getItemsInNetwork(). And the list doesnt appear to show the correct amount of items or any at all really... just an empty list "{n=0}" I updated to 1.12.2 and now the me_interface.getItemsInNetwork() method returns a populated list however I still dont have the me_interface.getAvailableItems() method.. Anything I need to know about how your ME network is setup or configured? Remember im an ME noob so help me help you
  23. centerT func looks fine.. I'd suspect the checkMe func, specifically the loop over the list, or the list length operator. Check that the list is actually reporting the proper length? Shove a few print calls in there to debug.. I can't test ATM but nothing is standing out as the culprit.
  24. Got any errors I can look at?
  • Create New...

Important Information

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