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

CptMercury

Members
  • Content Count

    54
  • Joined

  • Last visited

  • Days Won

    7

CptMercury last won the day on August 3 2020

CptMercury had the most liked content!

About CptMercury

  • Rank
    Junior Member

Recent Profile Visitors

1707 profile views
  1. You want a progress bar for the file transfer via modems? There is no built-in method available, so you need custom scripts for this. My approach would start with calculating the file's size and transmitting it to the receiving computer. Then the file is split into packets and transferred; by the size of the arriving packets the progress can easily be calculated. The remaining question is how to split the file. You could either send line by line or send a fixed number of bytes. Depending on your choice, the calculation method for the file size will vary. Number of lines:
  2. Well, you can use “not“, which will do exactly what you‘re trying to do. if not (val > x and val < y) then -- do stuff end But: - not greater than is the same as less than (actually less or equal <=) - not less then is the same as greater than (greater or equal) It would look like this: if val <= x and val >= y then -- do stuff end
  3. Well, you actually just need a computer and an adapter to interact with me-components (not even an inventory_controller upgrade). You also require an database component to configure me I/o stuff (export busses, import busses and interfaces) In order to properly use the export bus, you need to have access to the items in the network. Then, using the database component, you can store information about a stack of items in the database and use this to configure the export bus. The functions for accessing the items in the network are provided by the "common network api", which should be shared
  4. @Chaoschaot234 I think this version is deprecated. Dustpuppy made a new guy lib with more features etc. Have a look at it. Here's the forum post Its installer link is working properly, I just checked.
  5. Ok, as promised, here is a more advanced function. Instead of giving it one string and specify its color, you mark parts of the string and specify foreground (and also background) color by using a xml/html like syntax. If you want to change on part of the string, put it between <color fg=hex, bg=hex>your string goes here</color>. Hex is the color code starting with 0x (like 0xFFFFFF). You don't have to specify both, background and foreground, just set the color you like to change; if you set both, use a comma (,) as delimiter. local component = require "comp
  6. I assume you are currently using the term lib for writing stuff on the screen? For full control over the screen, you need to interact with the gnu component directly. You then need to also specify the x and y coordinate where your text starts. But it's easy to write a function that works exactly like term.write but allows you to specify the colors of each part of the string. local component = require "component" local term = require "term" local unicode = require "unicode" local gpu = component.gpu local function advancedWrite(s, c) -- s is the string, c is its color local x,
  7. 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 with
  8. 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.
  9. 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,
  10. In what piece of code you have 3 ends? I only find 3 ends in the last program I posted. There you have one end for closing the main function (2nd end), one for closing the if-statement (1st end) and the last end is for closing the while loop. And for the error: First it would be good if you could post the actual screenshot. Second, could you post the code of the program you were running? From what I currently see, there‘s propably a typo in line 18, but I can‘t tell exactly, what is wrong until I see the actual code.
  11. Hey, in these if statements, you need to use relational operators. Since you want to see if you're variable is equal to a certain string, you need the '==' (two equal signs). So you're code would look like this -- local require commands start local component= require (“component”) local sides = require(“sides”) local rs = component.redstone local event = require(“event”) -- local os = require(“os”) remove this, the os lib does not need to be required, I think -- local require commands end -- Main function start local function main() local username, message = event.pul
  12. I‘m not 100% sure, what causes the error, but it seems the installer doesn‘t handle the http request user data properly. You could try running the following command: wget https://raw.githubusercontent.com/zenith391/Fuchas/master/Installers/openos.lua installer installer Sadly I can‘t test this right now, but it might be worth trying. Edit: Ok, i figured out what is causing the error. The colon (:) in function call "data = con:read(math.huge)" in line 11 must be replaced with a period (.). So what definitely works is running pastebin get s2YZJ0T6 installer.lua
  13. You can also use event timers. Then you need a function to check and send your stuff. local event = require "event" local function dostuff() -- this is ur function that is doing stuff end local interval = 20 -- time in seconds between the runs of the function event.timer(interval, dostuff, math.huge) -- math.huge for infinite repeats Or if you want to keep Skript as it is, you can use Molinko's approach with os.execute Then your code would be: event.timer(interval, function() os.execute("/path"), math.huge)
  14. Ok, I forgot the program doesn‘t always run in the executor thread. Too bad there are only ways to have blocking high precision sleeps and timers and no non-blocking alternatives... But anyways, thanks alot
  15. @payonel Hey, I was wondering if there is any chance to see a high precision computer.pull function in OpenComputers, allowing to have timeouts below one tick (I believe the currently used computer.uptime only returns time with .05 s precision). With that in hand, non-blocking sleeps and timers for small time intervals should be realizable. I was trying to implement this in openOS by adding a computer.pull function using os.clock instead of computer.uptime and changing some other libs accordingly, but it didn't work out. So I'm asking if there is any reason against adding a
×
×
  • Create New...

Important Information

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