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

Forums

  1. OpenComputers

    1. Announcements

      OpenComputers official announcements.

      120
      posts
    2. Feedback

      Tell us what you think.

      364
      posts
    3. IRC

      #OC channel discussion
      irc.esper.net #oc

      26
      posts
  2. Code Central

    1. Support

      Ask for support from the OpenComputers community

      3423
      posts
    2. Showcase

      Showcase what you have created for OC. No 'malware' or other junk!

      2331
      posts
    3. Tutorials

      Help other users out. Please no 'false tutorials'

      109
      posts
  3. Addons & More

    1. Addons Mods

      Show off your OC addons mods

      208
      posts
    2. Architectures

      Discussions for Architectures

      172
      posts
    3. OpenEngineering Task Force

      Discussion board for the OETF documents

      66
      posts
  4. General

    1. Lounge

      Just lounge around or have an open discussion.

      296
      posts
    2. Forum Games

      Fight boredom!

      62
      posts
    3. Showcase

      Show off your creations! (not for your programs)

      124
      posts
    4. Servers

      A place to advertise your servers

      141
      posts
  5. Archives

    1. Public Archives

      OpenComputers public archive forum

      8
      posts
  • Topics

  • Posts

    • thank you for all of your help, looking back over this i might as well have posted this in requests.
    • https://git.asie.pl/asie-minecraft/Nadeshicodec Apologies for scarce documentation, it's a bit of a project dump. It has a GUI, however. Feel free to fork and clean it up with the terms of the license in mind.
    • 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/
    • thanks, this works with numerical values, but the program isn't reading the variables right, if i input ingot it skips straight to "could not understand" do i need to place the variable values somewhere else in the code, or is there some other way i have to do this. but at least i have a working prototype, so thanks!   after replacing arg with num in the print section, it now reads "could not understand nil" so, that means that it isn't recognizing that ingot = 144 right?
    • `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  
  • Popular Contributors

×

Important Information

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