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

    1. Announcements

      OpenComputers official announcements.

      122
      posts
    2. Feedback

      Tell us what you think.

      391
      posts
    3. IRC

      #OC channel discussion
      irc.esper.net #oc

      25
      posts
  2. Code Central

    1. Support

      Ask for support from the OpenComputers community

      3808
      posts
    2. Showcase

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

      2661
      posts
    3. Tutorials

      Help other users out. Please no 'false tutorials'

      115
      posts
  3. Addons & More

    1. Addons Mods

      Show off your OC addons mods

      226
      posts
    2. Architectures

      Discussions for Architectures

      176
      posts
    3. OpenEngineering Task Force

      Discussion board for the OETF documents

      73
      posts
  4. General

    1. Lounge

      Just lounge around or have an open discussion.

      321
      posts
    2. Forum Games

      Fight boredom!

      62
      posts
    3. Showcase

      Show off your creations! (not for your programs)

      133
      posts
    4. Servers

      A place to advertise your servers

      145
      posts
  5. Archives

    1. Public Archives

      OpenComputers public archive forum

      8
      posts
  • Forum Upkeep

    In order to keep the forums updated with improvements and security fixes, we need to pay for a subscription.

    Currently, this is: $25/6-months for the forums itself and $10/6-months for the Theme (totalling $35 USD/6-months).

    You're not obligated to donate anything, but anything you do donate will be much appreciated. :)

    Donate Sidebar by DevFuse
  • Topics

  • Posts

    • This definitely broke my blockade! I completely misunderstood component.proxy functionality. Even managed to create a table put it into a string now to see a specific position also thanks to the tutorial. Now I'm gonna try to figure out how I can send the string to my client interface since the resolution of the drone interface doesn't allow me to see all coordinates properly.   Thank you!
    • Try this out.. The require function is defined by OpenOS which isn't available in the drone env.  require is used to load libraries from the package path. See /lib/package.lua local drone = component.proxy(component.list('drone')()) local position = component.proxy(component.list('navigation')()).getPosition() -- # The require keyword is for libraries accessed via a filesystem which the drone doesn't have. Therefor it isn't available. -- # The `component.someComponentName` functionality is defined in the OpenOS component library.. Again, not available here. if position ~= nil then drone.setStatusText("We in business bb") end while true do drone.move(0, 0, 0) -- to keep the drone running end Drones can be a bit of a pain to get used to as they dont have any of the sweet libs defined in OpenOS. See https://ocdoc.cil.li/tutorial:custom_oses to see what is available in a hardware only env like drones or and hw that is without an OS
    • RC args are accessible from the start method in your startup.lua module under the args env name. Its a little complicated but basically when your startup rc module is loaded the rc.cfg variable with the same name (startup) is accessible as args in your module. -- # rc.cfg enabled = {"startup"} startup = {} -- # this table notation requires quotes btw startup["col0"] = 0xFF9200 startup["col1"] = 0xFF6D00 startup["col2"] = 0x000000 startup["col3"] = 0xFFFFC0 -- # /etc/rc.d/startup.lua local gpu = require("component").gpu function start(cfgColor, text) local color = args[cfgColor] -- # the `args` table here is your `startup` table as defined in /etc/rc.cfg local ofg = gpu.setForeground(color) print(text) gpu.setForeground(ofg) end -- # call start from the cmd line like so.. -- > rc startup start col2 "this is colored text"  
    • Did a clean reinstall of OpenOS, and now it works properly smh. I guess I messed up my HDD then.   Hi,   so I opened this second thread for another problem I had, using a github script in order to ease the interaction with my drone and execute code on it remotely, maybe even get something printed into my client interface and get an understanding of what some methods are actually returning for example. I came across https://gist.github.com/fnuecke/6bcbd66910b946b54ec7   So the thing is, when I try to execute this client.lua: local component = require("component") local event = require("event") local modem = component.modem modem.open(2412) modem.broadcast(2412, "drone=component.proxy(component.list('drone')())") while true do local cmd=io.read() if not cmd then return end modem.broadcast(2412, cmd) print(select(6, event.pull(5, "modem_message"))) end it immediately throws me this error: ERROR IN NET EVENTHANDLER[modem.lua]: /lib/network/modem.lua:28: attempt to concatenate a nil value (local 'data')   I opened modem.lua, to read that line and maybe understand whats going on but nope. Modem.lua is definitely too high for me to understand at this point in time. But I think I would find solutions to most drone specific things, if I could get this provided script working, even though it takes time.   Thanks in advance for any help!
    • Hi, I hope this is the right place to post this. So basically, since I am really not into lua at all, I firstly tried to just play around with the drone, and I wanted to write a program sooner or later, to harvest things. I tried to figure out how getPosition() works and what it actually returns when I tried to setup a variable with that method, it always threw "string expected, got table". Tried like position = {component.navigation.getPosition()}.  <- That somehow had to do with something else, I don't know what exactly.   So I tried to get "getPosition()" to work, for to use it to craft some primitive if/else based actions. What I tried lately was: local drone = component.proxy(component.list('drone')()) local position = component.navigation.getPosition() -- since I have the navigation upgrade on my drone if position ~= nil then drone.setStatusText("NotNil") -- since I couldn't get a value like setStatusText(position) to work, it expects string end while true do drone.move(0, 0, 0) -- to keep the drone running end -- throws error oc:bios:2: attempt to index field 'navigation' (a nil value)   Also I couldn't get " x = require("X")" to work at all (I also don't know what I actually require when I say "x = require("component")" or "x= require("event") components? librarys? Can I get a list of these librarys that exist?) The require attempts threw "attempt to call global 'require' (a nil value)". Things like "table.toString(tableName)" didn't work for me too. Guess toString is just not included maybe.   I am really not much into scripting yet, not to mention lua. The only thing I ever learned quite a bit was javascript es5 and a bit React.js with es6. Quite frustrating for me to not even get a simple variable that calls a method of some component working in lua lmao.   Thanks in advance for any help!  
  • Popular Contributors

×
×
  • Create New...

Important Information

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