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. rsClient.lua local component = require "component" local event = require "event" local tunnel = assert(component.tunnel, "primary tunnel component required") local args, timeout = {...}, nil if args[1] and (args[1] == '-t' or args[1]:match "--timeout=%d+") then timeout = tonumber(args[2]) or tonumber(args[1]:match "--timeout=(%d+)") end tunnel.send("rs_info") -- # ask server for redstone interface details local isAnalog, side, level, color = select(6, event.pull(timeout or 5, 'modem_message', tunnel.address, nil, 0, 0)) tunnel.send("rs_update", side, level < 15 and 15 or 0, isAnal
  2. What you want may be possible, but I can't help without knowing exactly what you expect to be able to do..
  3. Line 4 of your script requires an 'end' to close the 'if' statement. The error mentions that the 'while' clause needs an 'end', but that's just because the interpreter thinks the 'end' on line 6 belongs if the 'if'.
  4. I don't know the current state of this issue but i have heard that certain mods bundled cable and OC don't integrate. I had this issue once and the substitute I used was another mods' bundled wire(immersive engineering). I'm not sure if this is OCs' 'fault' or the integrating mods' fault.. Personally I think somebody should just implement rs bundled cable/wire as a part of OC.
  5. Have you tried placing the cable on the computer case?
  6. This just isn't really possible in in much of a meaningful way.. a lot of websites are not static and have JavaScript, which can't be executed. Even if you downloaded a static site, rendering it in a meaningful way to the original would be almost surely impossible except for the most trivial of sites. Sites that are just text and hyperlinks and maybe some other very basic elements could be recreated. Maybe a Wikipedia without images or a simplified Reddit thread could be possible minus some novelties.
  7. A partial demo of your first script. Should get the ball rolling.. local component = require "component" local thread = require "thread" local event = require "event" local text = require "text" local term = require "term" -- # make a function that formats part(s) of its input local function status_print(x, y, pat, format) return function(str) term.setCursor(x, y) -- # pad the output to wipe old overhanging chars from prev long outputs term.write(text.padRight(str:gsub(pat, format), 30)) end end -- # NOTE: all the 'print format' functions below are using arbitrary values
  8. It's not that you need an actual 'server' but 1 of a pair of programs that acts the role of server. The 'client' can send a message to a 'server' to request that it(the server) calls a component method. The server then sends the result of that call back to the client. Presto, the client is using components on a separate network. Let me know if this isn't clear...
  9. You have to write a function that will split a string by length or by some delimiter into "lines", then call gpu.set for each line. Look into string.gmatch or string.sub
  10. I understand the learning curve can be difficult but the possibilities of OC are superior in my opinion. I'd like to help you solve your problem as best I can. If your up to post your full code I can take a look at it for you.
  11. I'm not sure component networks can be shared that way because of the problem you mentioned. Component networks are usually separated by a relay or a power distributer. If you want to call components remotely, on a separate network, you can try using a client server approach. Server 'offers' access to components. Client can connect and remote call component methods... Yadayada
  12. In your example the variable `address` is never defined.. and thus it's nil. local event = require("event") while true do -- # note we get the address from the event data. `_` is the event name 'motion' local _, address, x, y, z, name = event.pull("motion") print("Detected:", address, x, y, z, name) end
  13. Ahh, no problem buddy. Happy to be of some help. Thanks for the feedback as well, it would seem useful to know. Smooches
  14. I feel like I should add some more information.. Just some things I learned asking around and poking at the OpenOS source. So here it goes. Term "windows" aren't really a feature of the OS, they're kinda hidden, and in my quest to abuse them I learned that at the moment they're kinda 'half baked', although functional. If you look at the `term` library you'll see that a lot of methods take an optional `window` argument but the library lacks a documented way to create or get a new or active pty. Wtf mang. Another tip would be to note that the computer has no preference for screen and/or keyboard
  15. Maybe, opening a term window shouldn't be such a pain.. I have done it before, just need to remember and test how I did it... I'll post back asap I figured a way to switch terminals. Dunno if its a "good" way or not but it should work. local component = require "component" local process = require "process" local term = require "term" local termGpuAddr, termScrAddr = ... -- # use whatever logic you would to get the relevant component address (this line will cause an error if you dont shove some address in) local termGpu = component.proxy(termGpuAddr) termGpu.bind(termScrAddr) -- # co
  16. For reasons... Not sure why, but the doc on term.bind is incorrect. term.bind actually take a gpu proxy and a term window(internal hidden feature). If you want to control which screen is used you can do some thing like this... local termScreen = ... -- # the screen you want a term on local termGpu = ... -- # the gpu the term should use -- # bind the screen to the proper gpu termGpu = component.proxy(termGpu) termGpu.bind(termScreen) -- # if the term is not bound to our term gpu/screen pair term.bind(termGpu) -- # second arg is actually a process window. nil get current term process windo
  17. I'm glad you figured it out. It was just a hunch really. Happy trails
  18. event.pull has an optional first argument, a timeout. local name, _, x, y = event.pull(0.1, "touch") if name then -- # name will be nil if event.pull(0.1, ...) times out after 0.1 sec if y == 1 and x < 30 and x > 18 and reactorOnline then r.setActive(false) elseif y == 1 and x < 30 and x > 21 then r.setActive(true) elseif y == 8 and x == 21 or x == 22 then r.setAllControlRodLevels(rodLevel - 10) elseif y == 8 and x == 28 or x == 29 then r.setAllControlRodLevels(rodLevel + 10) end end
  19. Im not sure really what you're going for.. But I think the update function needs a little work. Also the event listeners you create in the update function might be acting funny because they're in threads, which are like little processes, and I think processes dump they're event registrations when they're complete(this may be nonsense...). One other note, you may want to stick to the term library instead of tty. tty is a core lib an subject to change. I think with your current setup update could look like this(below) and still hypothetically work. local function update() local ev = {event
  20. Molinko

    Wiki down

    Not an issue for me. Perhaps you need to clear browser cache or even see if your router is somehow blocking the domain?
  21. You might want to look into something like event.listen or event.timer. Basically every time an event occurs you can have a block of code run. Here's a small example. local event = require "event" local function printComp(ev, addr, ctype) print(string.format("component added: [type] %s [address] %s", ctype, addr)) end event.listen('component_added', printComp) -- some time later event.ignore('component_added', printComp) Here's a timer example. local event = require "event" local count = 0 local handle = event.timer(1, function() count = count + 1 print(string.forma
  22. Sorry but it would take a ton of work.. Basically the thread library is a fancy coroutine library that let you do fancy things.. like detach a process from the current process and attach it to the parent.. One possible option is to update OpenOS itself. A newer version of the OS should work with an older version of OC. Check out this thread .... (OpenOS updater)
  23. Seems you're on an older version of OpenOS. Sorry, but my example would require the thread library in order to function. If you update your OC version and reinstall OpenOS It should fix the issue.
×
×
  • Create New...

Important Information

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