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

All Activity

This stream auto-updates     

  1. Today
  2. Looks like it requires this graphics library to work properly: https://github.com/IgorTimofeev/GUI Also, from reading the installation instructions, it looks like you will need to modify the code so it accesses the correct sides of the computer.
  3. I've done something similar in the past without EC2, the robot takes its stuff from chests/drawers. Also any Structure is possible when defined in /usr/lib/ccRecipes.lua https://github.com/ben-mkiv/oc-lua/tree/master/src/robot/compactingmachines Setup should look like this https://imgur.com/a/YG0wWdm The movement of the robot can be optimized, but for me it never did matter as i just set it to craft a certain amount of machines so that im set
  4. There is a function called filesystem.exists(), which takes a path string and returns a boolean. You could use this to check whether the file exists.
  5. Yesterday
  6. I want my program to create a file named "variable" if it cant detect a file with the same name in the same folder.
  7. how would i use this program in channel-less packs ? ( no AE2 controller present since no channels in pack) feel free to msg me on disc for faster communication times disc BOF007#8812
  8. jangotat1138

    jangotat1138

    I need help getting a program I downloaded to control mob duplicators from Industrial Foregoing. I am playing on Minecraft 1.12.2 with the newest versions of Industrial Foregoing and OpenComputers. I have limited knowledge of programming and cannot figure out how to get the program to run properly. ocsp.lua
  9. Last week
  10. Have you ever wanted to encrypt something but couldn't afford a T2 data card? Well, look no further than icekey-lua and Igloo! Low Level: IceKey IceKey is the low level library. It's no RSA, but it should work for most purposes in OC. If you want to learn more about ICE, click here. Useful if you want to do more with the block cipher, rather than just encrypting files or whatnot. It can be found here. High Level: Igloo Igloo is the high level library, great for encrypting/decrypting files. Automatically uses a CBC and padding. It can be found here. PRs welcome!
  11. So it seems the Geolyzer can take some "options" when running .scan or .analyze. According to the wiki and in-game, the format is like so: scan (x:number, z:number [, y:number, w:number, d:number, h:number][, ignoreReplaceable:boolean | options:table]) :table analyze (side:number [, options:table]) :table For argument 7 the format is easy to understand, it's either boolean or table. Boolean works as expected but the table is throwing me off (options:table). What goes in here? What data types, and how many? Digging through the source code reveals this: val options = if (args.isBoolean(optIndex)) mapAsJavaMap(Map("includeReplaceable" -> !args.checkBoolean(optIndex))) else args.optTable(optIndex, Map.empty[AnyRef, AnyRef]) Unfortunately I'm not familiar with Java, so it's a little tricky for me to understand. What this means to me is, if arg7 is a boolean, it will use that. Otherwise it will use a table. Putting variables other than boolean or table throws an error (understandably). .analyze has a similar line of code, as it also takes "options". However instead of optIndex, it just has the number 1. val options = args.optTable(1, Map.empty[AnyRef, AnyRef]) That's about as far as I've gotten. Putting in values doesn't seem to do anything, the values themselves don't seem to do anything, and it seems anything I put in the table affects nothing. Any ideas?
  12. So I ended up manually editing event.lua with the fix that was linked above. Now it calibrates. Doing the wget and replacing event.lua did not work. The bug was still present in the downloaded version of event.lua. Now everything is working exactly as it should.
  13. Nice solution! Can you explain how did you do that?? I'm refering to the resizeable screen haha
  14. Thank you I'll give a try Curious and usefull explanation, thank you :)!
  15. Hi, I do this and reboot, and it does not fix the issue. Nothing different occurs.
  16. Earlier
  17. This was the answer I was looking for. Thank you!
  18. Well, first of all, if you only need the message to contain one string, then you are better off by just sending the string as the message, so no need to make a table with that string, serialize the table transforming it into a string which is then send via the modem, once received, transformed back into a table which is then indexed to get the string you want to send... But anyways, I would assume the error with the serialization comes from trying to serialize a nil value. You're using a timeout with your event.pull, that means, event.pull returns nil if no modem_message was received within that 239 seconds. So either you simply remove the number specifying the timeout, or you add an if-statement checking whether you actually received a message and skip the serialization part when the message is nil. -- without the timeout, if this is possible, but it looks like you want your robot to execute some stuff every 239 seconds function loopWait() loopOff = false db.clear(1) me.store({name = "minecraft:record_wait"}, db.address, 1) selectEmpty() me.requestItems(db.address, 1, 1) ic.equip() robot.useUp() repeat _, _, _, _, _, serialized_message = event.pull("modem_message") received_table = require("serialization").unserialize(serialized_message) if recieved_table.loopSwitch == "off" then loopOff = true end robot.useUp() selectFull() ic.equip() robot.useUp() until loopOff == true robot.useUp() selectFull() me.sendItems() end -------------------------------- -- with an if statement verifying there actually was a message received function loopWait() loopOff = false db.clear(1) me.store({name = "minecraft:record_wait"}, db.address, 1) selectEmpty() me.requestItems(db.address, 1, 1) ic.equip() robot.useUp() repeat _, _, _, _, _, serialized_message = event.pull(239, "modem_message") if serialized_message then received_table = require("serialization").unserialize(serialized_message) if recieved_table.loopSwitch == "off" then loopOff = true end end robot.useUp() selectFull() ic.equip() robot.useUp() until loopOff == true robot.useUp() selectFull() me.sendItems() end But the easiest and best way would be to send your string directly as the message -- the computer sending the message modem.send(address, port, "off") -- receiving computer function loopWait() loopOff = false db.clear(1) me.store({name = "minecraft:record_wait"}, db.address, 1) selectEmpty() me.requestItems(db.address, 1, 1) ic.equip() robot.useUp() repeat _, _, _, _, _, message = event.pull(239, "modem_message") if message == "off" then loopOff = true end robot.useUp() selectFull() ic.equip() robot.useUp() until loopOff == true robot.useUp() selectFull() me.sendItems() end
  19. There's only one string in the table, but that part's working fine. The thing is, after the event.pull() is unable to find a message (which is deliberate for the code), the serialization part errors out, cancelling the rest of the script.
  20. How big is the serialized table and what kind of values are in the table? Are there recursive entries or functions in the table?
  21. I can't send you an error message since for whatever reason Minecraft won't open up right now, but I'll send you an excerpt of the code. function loopWait() loopOff = false db.clear(1) me.store({name = "minecraft:record_wait"}, db.address, 1) selectEmpty() me.requestItems(db.address, 1, 1) ic.equip() robot.useUp() repeat _, _, _, _, _, serialized_message = event.pull(239, "modem_message") received_table = require("serialization").unserialize(serialized_message) if recieved_table.loopSwitch == "off" then loopOff = true end robot.useUp() selectFull() ic.equip() robot.useUp() until loopOff == true robot.useUp() selectFull() me.sendItems() end
  22. Can you post your code and a screenshot of the error message you are getting? This would help alot. I don‘t know exactly what you mean by serialization and why you have problems with the time expiring, but when I had the chance looking at the code I might be able to tell.
  23. I tried something similar to this with serialization, but within the time frame I gave with event.pull(), it threw an error message when the time expires. Does this method ignore the serialization error and continue with the script?
  24. Like Molinko said, you need a custom program that will allow you to manipulate another computer. And using network cards might be the best option. There are several ways to write programs that allow sending commands to a second computer; a very naive implementation would use the function load. When passed a string, the string is loaded as a chunk of Lua code and returns a function, that, when called, does whatever was coded in the string. And yes, you need to use event.pull or register a listener via event.listen, but your code needs to "pause" at least every 5 seconds anyways, via event.pull or os.sleep (which is essentially the same as event.pull), so that shouldn't be an issue. So a simple code would look like this: The computer receiving the commands: local event = require "event" while true do local _, _, from, _, _, message = event.pull("modem_message") local res, err_msg = load(message) if not res then -- an error occured while loading the string, so here you can do error management -- like throwing an error and ending the program, printing the error message or write it to a log file, -- ignore the error and continue running the main loop etc print(err_msg) else res() -- on success, load returns a funtion, so call it end end --------------------------------------------------------------------------------- -- if you want to throw an error on failure, using assert would be the way to go --------------------------------------------------------------------------------- local event = require "event" while true do local _, _, from, _, _, message = event.pull("modem_message") assert(load(message))() -- if load returns the function, i.e. loading the string was successfull, the function is called -- when an exception was catched, an error with the error message is thrown end So then you can send a message containing "io.write('test')", and the second computer will execute this task. You can also open files etc, so basically you can do everything remotely. But as I said, this is not a very optimized program since load is quite heavy on the machine since it has to compile the code, but it is probably the most versatile approach. (keep in mind, when you want to use strings inside your code, you need to use the correct quotes, if you wrap your string in ", you can't use " for strings inside, so you need to use ' for example, or you wrap your main string in [[..your code goes here..]] these brackets).
  25. To do that, I would need to use event.pull() right? The problem is, I need to write data without pausing either of the computers.
  26. Possible. Maybe. But definitely not practical. You would use the network card along with client and host programs on each machine. Computers dont have access to each others components so any communication can be done over a network. You can write a program on one machine to request access and write data over a network connection and another program on another machine to answer requests and read/write data from that connection. Im not really sure of another way to perform this. Perhaps others can chime in.
  27. Is it possible to use the internet API to do something similar then?
  28. I don't believe one computer can edit another computers files unless they are connected via some sort of client program over a network which you would have to write. io.write it's for writing to running processes or files in the same machine
  29. So I would want computer #1 to edit a text file in computer #2's directory.
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?
    Sign Up
×
×
  • Create New...

Important Information

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