Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vectors = {}
- function printUsage()
- print("Uses are gps+ set <name of waypoint>")
- print("or you can do gps+ go <waypoint>")
- end
- local tArgs = {...}
- if #tArgs < 1 then
- printUsage()
- return
- end
- local sCommand = tArgs[1]
- local detail = tArgs[2]
- if sCommand == "set" then
- x1,x2,x3 = gps.locate()
- print(gps.locate(9))
- print("gps Cords,",x1,',',x2,',',x3)
- x11 = toFloat(x1)
- x22 = toFloat(x2)
- x33 = toFloat(x3)
- --Above is to float below is tostring
- x1 = tostring(x1)
- x2 = tostring(x2)
- x3 = tostring(x3)
- --x4 = x1....x2....x3
- --create addin code
- print(gps.locate())
- loc,loc1,loc2 = gps.locate()
- --lo1 = --loc..loc2--,loc2
- --print(loc,',',loc1)--,',loc2)
- strg = detail.." = "..loc..','..loc1..','..loc2
- --print(strg)
- h = fs.open("apps/gps+/vectorfile","a")
- h.writeLine(strg)
- h.close()
- --print(detail)
- --print(test)
- elseif sCommand == "go" then
- print(detail)
- h = fs.open('apps/gps+/vectorfile','r')
- --f1 = h.readAll()
- f2 = string.find(h.readAll(),detail)
- if f2 then
- --vectorfile = os.loadAPI("apps/gps+/vectorfile")
- --print(vectorfile.test())
- print("returned true")
- print(detail)
- file = fs.open("apps/gps+/vectorfile",'r')
- for line in file.readAll():gmatch( "[^\n]+" ) do vectors[line:match( "[^=%s]+" )] = ( { line:match( "(%d+),(%d+),(%d+)" ) } ) end
- file.close()
- print(unpack(vectors[detail]))
- else
- print("couldn't find waypoint. Does it exist?")
- end
- elseif sCommand == "flush" then
- h = fs.open("apps/gps+/vectorfile",'w')
- h.flush()
- h.writeLine("-- Here is where gps+ stores your waypoints cords.")
- h.close()
- print("flush complete")
- else
- printUsage()
- end
- --home = vector.new(-5321,76,-1383)
- --pos = gps.locate(2)
- --print("Your current Position is ",home)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement