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

Molinko

Members
  • Content count

    350
  • Joined

  • Last visited

  • Days Won

    28

Molinko last won the day on June 28

Molinko had the most liked content!

2 Followers

About Molinko

  • Rank
    Leading Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1545 profile views
  1. Molinko

    Problem with threads

    Lua is single threaded. Meaning that only one chunck of code can ever run at a time. Coroutines are considered co-operative in that they yield to allow others to compute before they themselves finish. The idea is that we can do a little work we need right now and do it quickly, then yield so others can do the same, hence co-operative. Threads are fancy coroutines, but they are still limited to cooperation, so they must yield if you wish to begin another. Use term.read or io.read or os.sleep.... etc.
  2. Molinko

    Inventory Access Side

    I believe this is actually by design so that OC(particularly robots) isn't considered too 'OP'
  3. Molinko

    Serialization problems

    I haven't tested but I believe the file descriptor has a file position. After the call to :read("*all") you're at the end of the file and thus nil is returned.
  4. Molinko

    Internetcard github download

    local c = require("component") local computer = require("computer") local internet = require("internet") local f = io.open("test.txt", "wb") local imax = 0 local xmax = 75 local ymax = 180 local zmax = 87 local TIMEOUT = 5 -- in seconds local link = "https://raw.githubusercontent.com/LordNocturnus/sf-" local folder = "/master/" local pos = 0 for i = 0, imax do for xb = pos, xmax do for yb = 0, ymax do for zb = 0, zmax do print(xb, yb, zb) local file = xb .. "-" .. yb .. "-" .. zb .. ".mb3d" local url = link .. i .. folder .. file local status, connection = pcall(internet.request, url) if not status or not connection then print("Download of " .. url .. " failed.") else local startTime = computer.uptime() while true do local response, isFinished = pcall(connection.finishConnect) if response and isFinished then break elseif not response then print("Could not connect to " .. url .. ".") os.exit() elseif computer.uptime() - startTime > TIMEOUT then print("Request to " .. url .. " timed out") os.exit() else os.sleep(0.25) end end local f = io.open(file, "wb") for chunk in response do f:write(chunk) end f:close() connection:close() end end end end end Fixed some typos and made some things more readable. And a bug...
  5. Molinko

    how do you power down a drone remotely?

    Functions cannot* be sent over a modem. Only primitive types like strings, numbers or booleans can be sent raw. Tables can be serialized(turned into a string), but the same rules apply. Just send a command as a string or number that the drone will use as a command to call computer.shutdown on it's own.
  6. Molinko

    OPPM not installable

    you're going to have to be more specific.
  7. Molinko

    OPPM not installable

    just type the command install with the oppm disk in a floppy drive. You will be prompted for installation, type y and press enter.
  8. Molinko

    Duel Display Output

    If you're trying to use the *same terminal window on two screens at once it can be tricky to do unless you know OpenOS as well as Payonel does. However, if you just want to be able you run one program on a secondary screen and be able to use a shell or run a program on another screen , then you can check out this thread I answered before. I think it might be helpful. similar question
  9. Molinko

    HELP my drone fainted

    Debugging drones can be difficult but the analyzer will help you get an error message from crashed programs on microcontrollers. Seeing the code and where you say it crashes.. I'd say that indexing the supposed table `v` caused the error. Indexing being `v.name` or `v.x`. I suppose if v.x or v.z or v.y are nil then drone.move will likely throw an error. But it's hard to know without more info. Get that analyzer data and come back. Hell, just wrap the whole code in pcall and collect any errors. local d= component.proxy(component.list("drone")()) local m= component.proxy(component.list("modem")()) local r= component.proxy(component.list("radar")()) m.open(1) local ok, err --# declare outside loop so we can get the value later when true do local rtable,mov,x,y,z = select(6, computer.pullSignal()) if mov == "follow" then ok, err = pcall(function() for k, v in pairs(r.getEntities()) do if v.name == "PHOBOSS" then d.move(v.x, v.y, v.z) end end end) --# pcall end if not ok then --# we have an error break --# break the while loop end end end -- # send the error back to our controller and finish m.send(ourHost, port, 'ERROR: '..(err or ""))
  10. Molinko

    Power Saving

    The linked card is one of the most expensive components next to the geolyzer when it comes to energy. Coroutines are actually really efficient because all other forms i.e loops are a "busy" waiting and thus consume power running functions, evaluating... os.sleep is essentially coroutines.yield. As for remote booting you should see the doc on modem.setWakeMessage
  11. Molinko

    How do you make a loop stop on user input?

    local component = require("component") local event = require("event") local m = component.modem m.open(1) repeat print("Hi") -- # seconds, event name local cmd = select(6, event.pull(1, "modem_message")) until cmd == "stop" https://ocdoc.cil.li/api:event
  12. Molinko

    Introducing "Lunatic"

    Hot damn asie, I think you win coolest shit on the forums with this one...
  13. Molinko

    How do you make a loop stop on user input?

    I think I need you to ask your question again.. I thought you needed the loop to stop on a "modem_message" event, but I guess you're really trying to stop a loop when a key is pressed?
  14. Molinko

    How do you make a loop stop on user input?

    local component = require("component") local event = require("event") local m = component.modem -- # make local too m.open(1) -- # 001 ?? repeat -- # run in the loop to repeat reception of 'cmd' local cmd = select(6, event.pull("modem_message")) -- # this is cleaner until cmd == "stop"
  15. Molinko

    Tell me where I went wrong?

    I'm running MC 1.12.2 with Computronics meant for 1.12.1 and although it works* I also cannot retrieve any player information from the radar. So I wouldn't call it a bug because I'm in the wrong version... but it's prob a bug...
×

Important Information

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