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


  • Content Count

  • Joined

  • Last visited

  • Days Won


payonel last won the day on September 18

payonel had the most liked content!

About payonel

  • Rank
    Junior Member

Contact Methods

  • Minecraft
  • GitHub
  • IRC
    payonel on esper.net

Profile Information

  • Gender
  • Location
    Portland, Oregon
  • Interests
    Coding and Gaming

Recent Profile Visitors

694 profile views
  1. payonel

    fluid transfer program

    my code sample isn't using the predefined millibucket values at all. It reads user input and tries to convert it to a number. If you want to build something more clever that does a lookup for predefined sizes, you'll have to design that yourself. Here are a couple of snippets that would do some of what you're saying. local size = tonumber(arg) if not size then if arg == "ingot" then size = 144 end end or local predefined_sizes = { ingot = 144 } local size = predefined_sizes[arg] or tonumber(arg) I could write the whole program, but you'll learn more if you test your ideas yourself. There is a good online manual for learning lua: https://www.lua.org/pil/
  2. payonel

    fluid transfer program

    `io.read()` returns a string, and you want a number, there is a core lua function to convert strings to numbers: `tonumber(string): number` so something like: `local num = tonumber(io.read())` would be fine note that tonumber returns nil when the input can't be converted. Also, I strongly recommend you get in the habbit of declaring everything local, unless you are intended to modify the global state of the operating system, and future scripts that you run, at least until the next time you boot. Thus: local component = require("component") local sides = require("sides") local ingot_mb = 144 local nugget_mb = 16 local block_mb = 1296 while true do local arg = io.read() if not arg or arg == "end" then break end local num = tonumber(arg) if num then component.transposer.transferFluid(sides.south, sides.north, num) else print("could not understand", arg) end end
  3. payonel

    Big Reactors Grid Control

    in the more recent versions of OC (check out the dev builds for 1.7.10 and 1.10, I haven't merged up to 1.11 and 1.12 with all of these fixes as of this writing, but will "soon") it is safe/reliable to run gui programs from your .shrc the gui program for brgc is `brgc_gui`, so this should be sufficient to run the gui at start up echo brgc_gui >> /home/.shrc though this will probably work just fine in the version you are running, try it out. update if you have issues
  4. payonel

    Big Reactors Grid Control

    You need to read that whole page I linked. It literally tells you how to do that. That is what I said to you in my last post. Again, "if you want to start the controller at boot time" "start at boot time" IS literally what you are asking for, for it to "autorun" also, if you want more information about autorunning programs on OpenOS in general, read this: https://ocdoc.cil.li/tutorial:autorun_options But that covers all of the options, and is not specific to this program nor the service that XyFreak made for it
  5. payonel

    Big Reactors Grid Control

    I think you are using this on the br_reactor, yes? I found the br code for that here: https://github.com/ZeroNoRyouki/BigReactors/blob/master/src/main/java/erogenousbeef/bigreactors/common/multiblock/tileentity/TileEntityReactorComputerPort.java Strangely, there is no setControlRodsLevels method on that component. There is a setAllControlRodLevels. I searched the commit history on the component and there never was a setControlRodsLevels, nor a get*. I also checked the original BR code, same story there. So I"m confused what method this was calling. Searching the entire code base of ER also came up empty. Is @ZeroNoRyouki available to discuss this? I'd be happy to test this and review the related ER code, but as I stated above, I couldn't trace it. Thanks @Sindor Nex I'm quoting from that page I linked you: "Don't forget to add brgc_reactor, brgc_turbine and brgc_grid to your /etc/rc.cfg if you want to start the controller at boot time:" If that sounds like what you asked for: Then read more of that page: https://tenyx.de/brgc/index.html#setup If that isn't what you're asking for, you'll need to explain yourself a bit more.
  6. payonel

    Big Reactors Grid Control

    @Sindor Nex It is well documented here: https://tenyx.de/brgc/index.html#setup
  7. payonel

    Change Text Size

    our screen resolutions are not exposed in the config. you can make a multi-block of screens though, if that helps. they auto connect, and I think they have a 6x8 max grouping, or something like that
  8. payonel

    Change Text Size

    If you increase your font size, you are reducing the number of lines you can print to If you decrease your resolution, your font appears larger, and you reduce the number of lines you can print to It is effectively the same
  9. payonel

    Change Text Size

    nothing has changed in the term api, and there was never a way to change font size, only ever could you change the resolution, via the gpu require("component").gpu.setResolution(newWidth, newHeight)
  10. payonel

    Multi Threaded Send and Receive

    This is definitely not a bug in the thread library, but instead you misunderstand what this code is doing -- having nothing to do with threads, but in the logic of the code you have written You are attempting to store the thread.create result in your local variable, t1 -- nothing wrong there thread.create takes a single parameter, a FUNCTION. `handleMessage` is a function, but `handleMessage()` is the invocation of that function. Thus, you are attempting to pass the RESULT of `handleMessage` (i.e. the value returned by `handleMessage`) as the argument to `thread.create`. Thus, `handleMessage()` executes, and must complete and return a value before thread.create is called What do you think this code would do? local function a() return "foobar" end local function b(value) print(value) end b(a()) compared to if instead of calling `b(a())`, you were to call `b(a)` To fix your code, you need to pass the function, not the result of the function: local t1 = thread.create(handleMessage) Your code is stuck executing handleMessage(), and never returns to thread.create
  11. payonel

    Are there any tutorials or doumentations for plan9k OS?

    OpenOS has absolutely proper pipes now, such as those you invoke with `cat file | grep foobar`, and a kick butt threading library (read https://ocdoc.cil.li/api:thread ) As for virtual components? No, there is nothing built into OpenOS for virtual components, but gamax92 has written a nice vcomponent library you can add via oppm, `oppm install vcomponent` Plan9k is retired, to be honest. It was ahead of its time, but is now outdated. OpenOS is faster, lower memory, has gobs of great libraries, super awesome command line parsing, and is ACTIVELY developed. I might be biased....
  12. payonel

    Multi Threaded Send and Receive

    > I want to create a server that pulls the modem_message event and prints to the console Cool, you can `listen` or `pull` for that event > but I also want the computer to be able to send messages (based on io.read()) while waiting for a message. `listen` works well for background handling, while in the foreground you are doing other work (such as io.read). However, you want your background to also print to the console? That'll obscure/interfere (visually) with the io.read getting user input. But okay > I tried using threads Sure, threads can do this job too. With threads, your event handling can be designed in a more selfish manner. You can `event.pull` and such without worrying about blocking the rest of the system > but I think I am using them wrong. Feel free to share some code! > As far as I know there is no thread.sleep() so I'm not sure how to suspend a thread for a short period of time No, there isn't. But, calling `os.sleep` from inside the thread is identical to what you would expect from `thread.sleep`. **HOWEVER** (please keep reading) > so that you can still type messages, but still have that thread automatically continue. How would I go about doing this? I wouldn't call `os.sleep` in THIS program because you want your thread to handle specific messages. `os.sleep` is a RUDE sleep, it DROPS events in the garbage. If any modem_messages occur during the sleep, you missed them. Instead, just pull with a timeout, `event.pull(.5, "modem_message")` in fact, I don't see the point of giving a timeout at all. Is your modem_message thread doing anything else or just waiting for modem_messages? Just call `event.pull("modem_message")` in your thread, done local thread = require("thread") local event = require("event") local t = thread.create(function() while true do local pack = table.pack(event.pull("modem_message")) print(table.unpack(pack)) end end) while true do local command = io.read() if command == "quit" then break end end t:kill() BTW: os.sleep *does not* rob events from any other thread or process, it only throws away events of its own process
  13. payonel

    changing a table to a string

    From the screen shot, it actually appears that the `getPlayers()` function is returning an array (a type of table), so while _Jacques is being helpful, the code sample they provided won't work. However, I do highly recommend you read the lua.org links _Jacques provided. Those will definitely be good to read try this local component = require("component") for _, player in ipairs(component.radar.getPlayers()) do print(player.name, player.distance) end
  14. payonel

    How do I navigate the terminal

    Our `components` command line program can help too. It lists components attached to the system, but you can pass an argument to filter the results to components that match the name you ask for, and that can be a partial match too `components file` will list all `filesystem` components. Also, you can get the "long" output, which prints the methods and method documentation string `component robot -l` Which prints the robot component and its methods Now, this can fill up more than a screen's worth of output, you can pipe to `less` and scroll up and down to read the text `component robot -l | less` On older versions of OpenOS, our `less` program was a bit buggy. Sorry about that. Update if you can, it works very well now. If you are unable to update, you can also redirect the output of commands to a file for reading with `edit` `component robot -l > /tmp/robot-methods.lua` And then open the file for reading: `edit /tmp/robot-methods.lua`

Important Information

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