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

Molinko

Members
  • Content Count

    385
  • Joined

  • Last visited

  • Days Won

    30

Molinko last won the day on February 19

Molinko had the most liked content!

2 Followers

About Molinko

  • Rank
    Leading Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1884 profile views
  1. Molinko

    more filter for long text content

    Exit the Lua interpreter. Run `components | more` without the backticks just like you would in a Linux shell.
  2. Molinko

    How to identify which side is connected to the computer

    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
  3. 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.
  4. 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
  5. Molinko

    Signal for a change in an external inventory

    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..
  6. 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
  7. Molinko

    Multithreading in drones

    Id check out this tiny library that you can probably fit along with your main program. multithread <- yeehaw
  8. Molinko

    AE2 and opencomputers

    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
  9. Molinko

    AE2 and opencomputers

    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.
  10. Molinko

    AE2 and opencomputers

    Got any errors I can look at?
  11. Molinko

    Need a time function program

    I made you a 'simple' program that does what you ask. Create a file in the /home dir of your computer called 'timer.lua' with the code below as the file contents and save it. -- # Lua timer for OC forum member local sides = require 'sides' local thread = require 'thread' local component = require 'component' local setOutput = component.redstone.setOutput local time local side = ... -- # set redstone output to back by default if not side or not sides[side] then side = 'back' end local proc = thread.create(function() while true do time = os.date('*t') if time.hour >= 6 and time.hour < 20 then setOutput(sides[side], 15) elseif time.hour < 6 or time.hour >= 20 then setOutput(sides[side], 0) end os.sleep(10) -- # update every 10 seconds end end) proc:detach() -- # background this timer after start Type edit .shrc in the command prompt and add the line timer.lua side and save the file Note: replace side above with a valid side string like 'back' or 'south' etc.. and restart the computer or execute the program with timer.lua side like in the .shrc file. The .shrc file will execute this program on startup for you whenever the computer restart from a shutdown or a crash. Cheers
  12. Molinko

    Event function losing scope?

    It might be that you've re-run this program again after the edits with the global declaration still existing. Hard to say without the whole program. It's not that your program will crash but that the listener, which technically exists beyond the scope of your program, will crash and report the error in /tmp/event.log You should take a hard look at how Lua scope works and ponder why it works the way it does. Particularly that scope is built line by line at 'run' time. local buildWitherButton = app:addChild(GUI.roundedButton(buttonLeftAnchor, 13, buttonWidth, 7, buttonDefaultColor, bgColor, buttonPressedColor, bgColor, "BUILD WITHER")) local buildProgressBar -- # forward declaration whilst still local to program. Now the definitions below will have the ref at run time. local function clearAndInitProgressBar() buildProgressBar.hidden = false buildProgressBar.value = 0 end local function progressUpdate() buildProgressBar.value = buildProgessBar.value + 50 note.play(75) end buildWitherButton.onTouch = function() if(powerButton.pressed ~= true) then throwWitherBuildError("Can't build Wither with shield down, are you mad?!?!?") return end -- # Do wither stuff note.play(80) clearAndInitProgressBar() e = event.timer(1, progressUpdate, 10) end --# buildProgressBar is now being defined as declared above and will still be local buildProgressBar = app:addChild(GUI.progressBar(buttonLeftAnchor, 20, buttonWidth, buttonPressedColor, fgColor, textDefaultColor, 0, true, true, "Building Wither : ", "%")) buildProgressBar.hidden = true
  13. Molinko

    Any Linux users around?

    I've fiddled with Ubuntu mate a tad. Mostly I mess around with Debian Raspbian a bit on the pi.
  14. Molinko

    How to implement filesystem related functions in my custom OS?

    This is actually requires a really complex answer I'm not qualified to give.. I would recommend staring and tearing at the OpenOS filesystem API until you have some ideas. Be warned that it gets pretty difficult to grep at some points especially concerning virtual files and directories. lib filesystem also see core full_filesystem
  15. Molinko

    Help with wireless redstone

    I apologize @LORD MJ as I'm on the road atm and internet is spotty place to place. Thanks to @payonel for the input, you're a wonderful pal for strolling the forums with your insight. P.s the update looks awesome
×

Important Information

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