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

tobivandebulk

Members
  • Content Count

    4
  • Joined

  • Last visited

About tobivandebulk

  • Rank
    Junior Member
  1. Hi, Edit: feel free to ask me any questions since obviosuly I have not documented this script well... or at all I have created this little script when I started getting into scripting months ago when I created my first thread with a question in this forums - and thought I share it now. I might update and advance it but I am not sure yet. Since I haven't done any development work eversince then. Any feedback is appreciated, since I am really unexperienced in this topic You'll need: 1 Charger and Energy supply 1 Chest 1 Drone with this script The first thing you have to do is open the code and define your width and length of your field: fieldWidth = fieldLength = Then flash it onto your EEPROM and put it into your drone. You have to place the charger on one corner of your field. The drone moves positive on Z axis for "forward" and negative on X axis for "right" in my script. So you may have to try out all 4 corners or just compare to your coordinates in F3 data screen to get the right direction. Then place the drone on the charger and start it. You can place a Chest behind the starting position of the drone and it will place items in there. The reason you have to let the drone start from a specific direction is, that I couldn't get the navigation upgrade to work due to issues with which chunks the vanilla map loads, you use to craft the navigation module. Best Regards, a scripting noob harvestingScript.lua
  2. 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!
  3. 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!
  4. 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!
×
×
  • Create New...

Important Information

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