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

Molinko

Members
  • Content Count

    451
  • Joined

  • Last visited

  • Days Won

    35

Everything posted by Molinko

  1. @Izaya that magic bees info is actually interesting, thx.
  2. 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.
  3. I believe this is actually by design so that OC(particularly robots) isn't considered too 'OP'
  4. 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.
  5. 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,
  6. 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.
  7. you're going to have to be more specific.
  8. just type the command install with the oppm disk in a floppy drive. You will be prompted for installation, type y and press enter.
  9. 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
  10. 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(
  11. 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
  12. 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
  13. Hot damn asie, I think you win coolest shit on the forums with this one...
  14. 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?
  15. 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"
  16. 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...
  17. Need the full error of current code and a copy of the all the current code to help you bud...
  18. I totally forgot about fishing... I'll hop on in a bit and give this a shot :3 -- Nope. I've tried several times but the robot never actually casts the fishing line. You can get robot.used to return true on the rod when its successful but even then you never see a fishing line nor any fish
  19. What you want is code that will "block" further execution until some condition is met. Because drone.move is non-blocking(pain in the ass if you ask me :p) we have to write a function to wait until the drone is finished moving. function waitUntil(freq, predicate) -- # wait 'freq' amount of time until 'predicate' returns true repeat computer.pullSignal(freq) until predicate() end Can then apply it to your code like so.. local r=component.proxy(component.list("radar")()) local m=component.proxy(component.list("modem")()) local d=component.proxy(component.list("drone")()) d.setLig
  20. Post any code you believe should be working. I'll take a look and give it a test. Most likely not the component.
  21. So I did some testing and I think what your approach is misunderstood. Once a Tunnel is placed into a Relay it cannot be addressed (as a component). It effectively becomes a part of the "physical" network layer. A better approach would be to place a Tunnel into a Relay on the "master" computer network (via some cable. the master has a modem inside). Your robot should have a wireless modem. And the third piece is a "Network extender". A "Network extender" consists of a Power Distributor component connected via cable to two Relay components (these must not touch each other nor can both dire
  22. Okay, so i worked something up for you. These two scripts should get you started. If you need something better you'll have to build it yourself :p Add these files to /home/, /home/bin/, or /usr/bin/. Whichever you prefer. tmsp.lua "term swap" local component = require "component" local term = require "term" local args, opts = require("shell").parse(...) local USAGE = [[ Usage: $cmd [q, m, f, --gpu, --screen] [screen_address] $cmd -mf --screen=27f include motd, flush screen $cmd -qf 27f --gpu=38a quite mode, flush ]] if not term.isAvailable() then os.exit() end if no
  23. It is possible but mirroring in the precise sense is a bit tricky. If you just want to run a program on a screen and still have a shell in the remote terminal that's not that difficult. What are you trying to achieve? Do you really need mirroring? Or do you just want to be able to run more than one program at a time?
×
×
  • Create New...

Important Information

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