Cranium, on 18 September 2012 - 06:52 PM, said:
I must admit to being behind Cranium on this one... please post to help or ask, that is pretty much the point of the forum
Posted 19 September 2012 - 09:46 AM
Posted 19 September 2012 - 09:57 AM
Jajnick, on 18 September 2012 - 06:15 PM, said:
Quote
Posted 05 October 2012 - 07:32 PM
Jajnick, on 19 September 2012 - 09:46 AM, said:
Posted 05 October 2012 - 09:18 PM
Posted 06 October 2012 - 04:43 AM
FunshineX, on 05 October 2012 - 09:18 PM, said:
Posted 07 October 2012 - 08:00 AM
ElvishJerricco, on 06 October 2012 - 04:43 AM, said:
Posted 07 October 2012 - 08:39 AM
Posted 08 October 2012 - 05:56 PM
FunshineX, on 07 October 2012 - 08:00 AM, said:
ElvishJerricco, on 06 October 2012 - 04:43 AM, said:
tiin57, on 07 October 2012 - 08:39 AM, said:
Posted 21 November 2012 - 04:02 AM
-- Cache of the current turtle position and direction local cachedX, cachedY, cachedZ, cachedDir -- Directions North, West, South, East, Up, Down = 0, 1, 2, 3, 4, 5 local deltas = {[North] = {0, 0, -1}, [West] = {-1, 0, 0}, [South] = {0, 0, 1}, [East] = {1, 0, 0}, [Up] = {0, 1, 0}, [Down] = {0, -1, 0}} -- cache world geometry local cachedWorld = {} ... function forward() local D = deltas[cachedDir] local x, y, z = cachedX + D[1], cachedY + D[2], cachedZ + D[3] local idx_pos = x..":"..y..":"..z if turtle.forward() then cachedX, cachedY, cachedZ = x, y, z -- update the position cache cachedWorld[idx_pos] = 0 -- clear the world cache return true else cachedWorld[idx_pos] = (turtle.detect() and 1 or 0.5) -- update the world cache return false end end ...
os.loadAPI("egps") if egps.startGPS() then local x, y, z, d = egps.locate() print(x, ' ', y, ' ', z, ' ', d) egps.forward() x, y, z, d = egps.cachedLocate() print(x, ' ', y, ' ', z, ' ', d) end
Posted 22 November 2012 - 10:09 AM
local run=shell.run _G.shell.run=function(command,...) --configuration code here return run(command,...)
Posted 22 November 2012 - 11:25 AM
louitzie, on 22 November 2012 - 10:09 AM, said:
local run=shell.run _G.shell.run=function(command,...) --configuration code here return run(command,...)
Posted 25 November 2012 - 11:23 AM
Posted 25 November 2012 - 03:06 PM
Cabu, on 21 November 2012 - 04:02 AM, said:
old_turtle=turtle turtle={} turtle.forward= function (args) stuff -here you want to go forward, so you do: old_turtle.forward() ect
Posted 25 November 2012 - 10:44 PM
local oldT=turtle turtle.forward=function(...) print('whoah! you just moved forwards!') return oldT.forward(...) --you want to always return whatever the oldT command would do so you still get back the output of the move CMD end
if not mod then local oldT=turtle mod=true turtle.forward=function(...) print('whoah! you just moved forwards!') return oldT.forward(...) --you want to always return whatever the oldT command would do so you still get back the output of the move CMD end end
if not oldT then oldT=turtle turtle.forward=function(...) print('whoah! you just moved forwards!') return oldT.forward(...) --you want to always return whatever the oldT command would do so you still get back the output of the move CMD end end
Posted 25 November 2012 - 11:56 PM
KaoS, on 25 November 2012 - 10:44 PM, said:
if not turtle.old then local old=turtle turtle={} turtle.old=old --modifications end
Posted 26 November 2012 - 02:19 AM
Posted 26 November 2012 - 03:16 AM
KaoS, on 26 November 2012 - 02:19 AM, said:
Posted 26 November 2012 - 03:22 AM
Posted 30 November 2012 - 12:36 PM
Edited by ChunLing, 30 November 2012 - 12:40 PM.
0 members, 1 guests, 0 anonymous users