raycar5 0 Posted January 8, 2016 Share Posted January 8, 2016 With this eeprom you can send the drone any lua command via network message in port 123 and it will execute it and send the response as a broadcast in the same port (if there's no response you'll get a bunch of nil) local m = component.proxy(component.list("modem")()) m.open(123) local typ local data while true do while typ ~= "modem_message" do typ,_,_,_,_,data = computer.pullSignal() end local f = assert(load(data)) w,x,y,z = f() m.broadcast(123, w,x,y,z) typ = nil f = nil end Quote Link to post Share on other sites
MaHuJa 1 Posted February 8, 2016 Share Posted February 8, 2016 Here's my (old) take on it. This is loaded onto the eeprom: https://github.com/MaHuJa/OpenComp-Scripts/blob/master/drone/remote_control.lua And this is on the controller you have a console for https://github.com/MaHuJa/OpenComp-Scripts/blob/master/drone/remote_controller.lua Differences of note: - Syntax errors don't crash the drone - Runtime errors (including misspelled names) don't crash the drone - "Unlimited" return values. This is one of the few ways to crash the drone, running it over the oc config value. - a few "dump table" commands useful for exploring or debugging. - first return value is always a boolean saying if it ran successfully. In the posted code above, false would instead shut down the drone. - function com(name) for getting a component. Makes subsequent code, including user input, much less verbose. Quote Link to post Share on other sites