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

Fingercomp

Members
  • Content Count

    120
  • Joined

  • Last visited

  • Days Won

    35

Everything posted by Fingercomp

  1. OpenOS has the filesystem API. There's the page about it on the wiki. You'll see the filesystem.list function there. It's exactly what you need. local fs = require("filesystem") for node in fs.list("/path") do print(node) end This code prints all files and directories in /path. You should also check if the node is a file or a directory. This can be done using the filesystem.isDirectory function. local fs = require("filesystem") for file in fs.list("/path") do if not fs.isDirectory(file) then print(file) end end You shouldn't use require to load your addon scripts
  2. So you are porting the program that already has the OpenComputers port, right? But... why? I've told you (link) to just download and use the OC version of the program. It actually works perfectly. As for the problem, though... You're probably doing something like file.read() instead of file:read(). You need to call the method using the comma. But, again, just use the OC version.
  3. Oh, sorry. I was wrong. It can't redirect error() messages. I wrote a simple program that writes error message to file when a program crashes. Run the following command to download it. $ wget https://gist.githubusercontent.com/Fingercomp/6563c64d70a4472f26923f78d77caeb9/raw/aa4f461ddee2af70a8040065be8974069e240e27/crash.lua /usr/bin/crash.lua Usage: $ crash /crash.log /home/bin/program.lua arg1 arg2 /crash.log is the file where the crash will be written. /home/bin/program.lua is the path to your program. arg1 arg2 are arguments passed to the program.
  4. OpenComputers version of the program doesn't have peripheral.find. If you're still getting an error related to peripheral.find, you're running the ComputerCraft version. You can try to download the program: $ wget https://raw.githubusercontent.com/asiekierka/Computronics/master/main/resources/assets/computronics/loot/tape/usr/bin/tape.lua /usr/bin/tape.lua
  5. If "basic OpenOS" means OpenOS 1.5, I strongly recommend you to update the mod (and reinstall the OS). In previous versions of the OS there's no easy way to redirect error messages.
  6. In OpenOS 1.6 you can redirect the stderr buffer to file by appending 2>/path/to/file when running the command. $ myprogram 2>/errors.log Now when your program crashes, the error message will go to the /errors.log file.
  7. Why do you need to open and close the port every time you send a message over the port? You can open the port at the beginning of the program, and close the port at the end. Also, you were almost right with your "if we could" code. You just didn't need to make the port a string. local com = require("component") local modem = com.modem local port = 123 modem.open(port) modem.broadcast(port, "Hello") modem.broadcast(port, "world") modem.broadcast(port, "Another message") modem.close(port)
  8. component.list returns an iterator. It's a function that returns a new value when it's called. The iteration stops when the iterator returns nil. Example: local component = require("component") local iter = component.list("screen") local addr1 = iter() local addr2 = iter() If only one screen is connected, the value of addr1 will be the address of that screen, and the value of addr2 will be nil. If you connect another screen, addr1 will contain the address of one of two screens, and addr2 will contain the address of another screen. Iterators are really useful when you're us
  9. You're trying to run a program written for ComputerCraft, not OpenComputers. There's a floppy disk that contains the tape program for OpenComputers. Craft any program disk (e.g., OpenOS floppy) and cycle through floppies by crafting the disk with a scrench until you get the right one. Then put it into a disk drive and run install.
  10. I've released a hpm update today. Now you can create a manifest for your program if you don't want to mess with uploading it to the repository. Suppose you're developing your OC project that has a lot of files and dependencies. It actually becomes tedious to manage all of such things up. No problem! Upload dependencies to the repository, and then create the manifest. {name="name-of-program", version="1.0.5-dev", dependencies={ {name="logging", version="^1,!=1.5", type="required"}, {name="network", version="^2", type="required"} }, files={ {url="path/relative/to/manife
  11. Okay, so I forgot that the tmpfs size is limited to 512 bytes. The installer was about seven times larger than that. I've fixed the bug. Rerun the command, it should work now. I hope you'll like what we've made. Oh, I'm aware of this issue and already working on resolving the bug. There's a workaround you can try using for now. Hopefully it will work. $ pastebin get vf6upeAN ./installer.lua $ ./installer.lua $ rm ./installer.lua The bug is going to be fixed as soon as possible. Thanks for reminding me, anyway.
  12. Greetings! Today we've finally released the Hel Repository, the project we've been working for a half of year (we have no idea why it took so long). We collected many good ideas about an ideal package repository, melted all of them together, and forged a solution to OC package distributing problems. It's really easy to use, not harder than downloading programs from Pastebin. To install a program type the following command in the OpenOS shell: $ hpm install <package name> A few moments later the package becomes installed with all of its dependencies, ready to be used.
  13. Ah, sorry, I didn't notice that you have two GPUs. Well, as you said, print functions work by default with the primary GPU component. An obvious way to do what you want is to access the two GPU components directly. local component = require("component") local gpu1 = component.proxy(component.get("897c")) -- the first GPU local gpu2 = component.proxy(component.get("b2bd")) -- the second GPU local screen1 = component.get("10da") -- the first screen local screen2 = component.get("e52a") -- the second screen -- bind the screens to the GPUs gpu1.bind(screen1) gpu2.bind(screen2) -- use t
  14. term.read, print, io.write print text on the first screen, as you said, because it is a primary component. Primary components are choosen randomly when the computer boots up. Proxies of such components are returned when they are accessed like that: component.screen (or component.redstone, component.gpu, etc.). The primary GPU is automatically bound to the primary screen. So you have to bind GPU to the second screen. The following example prints "Hello, world!" on the second screen. local component = require("component") local gpu = component.gpu -- get the proxy of the primary GPU l
  15. Some 3D print features: They can glow (unfortunately, the light can't be toggled). They can act as switch, lever, or whatever else, emitting the redstone signal in active state. A 3D print can consist of two states (well, one "3D print" block can actually have two different 3D models), toggled by clicking. A lot of things can be created already! And, well, chairs. There is a 3D print of chair. It was created by Krutoy242. The bottom part can be toggled by clicking. Stand on the seat, click on it, and, tada, you're "sitting" on the chair. { label = "Кр
  16. Well, because this is the default OC chunk limit. You can increase (or decrease) the limit in the configuration file.
  17. Connect the charger to the power converter (you can place them next to each other, or connect via the OC cable). Provide IC2 energy to the power converter (use IC2 wires). Put a lever on the charger and flip it. And then you're done, pretty much. Robots will charge up if they are next to the charger. Adapters are used when you want to control non-component blocks (note blocks, for example). Capacitors store energy. You need them because many OC components don't have a huge energy buffer, meaning they will shut down in a short time if no energy is supplied. So if you can't maintain non-
  18. The RFC 5246 describes the TLS 1.2 protocol that's very heavily used today to encrypt the traffic sent over regular sockets. Have you noticed the "https" part of this page's URL? It means that a HTTP server listens, generally, on the 443 port for HTTP requests sent over a TLS connection. Currently you can only send HTTPS requests, there's no built-in solution for establishing TLS sockets to send arbitrary data. An issue on GitHub asks exactly for this feature to be added. Now, look at the date of posting. After 1.5 years, we still don't have TLS socket support. Oh, mayb
  19. Suprisingly, your second piece of code is totally valid, and is a way you pass the value of variable as an argument.
  20. First, these two chunks of code are completely unnecessary. if event.onError(interrupted) then c.shutdown(true) end event.shouldInterrupt(false) Second, to prevent program interruption by pressing the key combination you mentioned in the title, you'll need to override the event.shouldInterrupt function to make it always return false. This can be done the following way: event.shouldInterrupt = function() return false end This code should be run after requiring event library. On the final note, I'd recommend you to learn about code indentation. It makes code look cleaner, nicer, an
  21. This happens because package library caches return values of libraries. This is simply workarounded, though. local lib = {} -- the following line is important lib.__index = lib -- the "word" variable will be defined later, so it will not be cached -- define your functions (note: colons should be used) function lib:talk() -- use "self" to access fields of library table print(self.word) end function lib:setWord(s) -- and here, too self.word = s end function lib:setWordAndTalk(s) -- if you need to access *methods* (functions) of your library, you should use the colon! self:setWo
  22. As far as I can understand the problem, you've downloaded not an image, but a HTML page with the downloader script. Type edit <image file name>, and you'll see that the file starts with <!DOCTYPE blah... To download the file instead, you'd better get a direct link to the file, not to download page or other things like that. Luckily for you, files stored on Dropbox can be easily downloaded directly. Simply replace www.dropbox.com with dl.dropboxusercontent.com.
  23. Please describe your problem in English. Most people here don't understand Russian. Err, nevermind, found your another topic. This is not how it's generally done, though. There's the "Edit" button that you should use to update your posts.
  24. First parameter event.pull returns is always a name of event. Here's the loop that should work. while true do local touch = {} touch.eventName, touch.screenAddress, touch.x, touch.y, touch.button, touch.playerName = event.pull("touch") for buttonName,buttonContent in pairs(buttons) do if ((touch.x >= buttonContent.x and touch.x < buttonContent.x + buttonContent.width) and (y >= buttonContent.y and y < buttonContent.y + buttonContent.height)) == true then --here is the error teleport(buttonName,touch.playerName) end end end
×
×
  • Create New...

Important Information

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