I have been working on a program for a few days on and off. But I kind of hit a wall on what I should do to make it work.
It's supposed to be a program that scans the environment through a geolyzer installed inside a tablet, and thereafter sends the scan data through a linking card to a stationary computer with a OpenGlasses' terminal. It will then go through each entry and check its value to determine whenever or not it's an ore, a liquid or if it's indestructible.The tablet program will ask for the player's location and how a large area it should scan, then asks if the player wants to send this data to be processed.
The tablet program will ask for the player's location and how a large area it should scan, then asks if the player wants to send this data to be processed. The stationary computer should just receive and process the data, then create 3D graphics at the player's location. I've got the collection and transmission part done, but I have problems with how I would go about to draw this on the glasses.
Tablet program:
local c =require("component")local geo = c.geolyzer
local tunnel = c.tunnel
localevent=require("event")local ser =require("serialization")local coords ={}local rows ={}local radius
localfunction isInt(n)
n = pcall(function()return n==math.floor(n)end)returnnot n
endlocalfunction readCoordinates(cor)local w ={}for word instring.gmatch(cor,"%S+")do
table.insert(w,word)end
coords ={
x = w[1],
y = w[2],
z = w[3]}end
io.write("Your coordinates: ")
readCoordinates(io.read())if coords.x ==nilor coords.y ==nilor coords.z ==nilthenprint("You didn't type them in correctly.")
coords ={
x =-3042,
y =56,
z =3031,}end
io.write("Radius: ")
radius = io.read()if radius ==""or isInt(radius)thenprint("You didn't type it in correctly.")
radius =5end
tunnel.send("UserData",ser.serialize(coords),radius)
os.sleep(1)for x=-radius,radius-1dofor z=-radius,radius-1doprint("Scanning: ".. x .." ".. z)
table.insert(rows,ser.serialize(geo.scan(x,z,false)))endend
io.write("Scan Complete. Send data?[Y/n] ")ifstring.lower(io.read())=="y"then
tunnel.send("maxPack",#rows)
os.sleep(0.2)for i=1,#rows,4do
tunnel.send("Data",rows[i],rows[i+1],rows[i+2],rows[i+3])print("Sending package ".. i .."/"..#rows .. ".")
os.sleep(0.2)endprint("Sending package "..#rows .. "/" .. #rows .. ".")print("Data sent.")end
Stationary computer with Glasses terminal:
local c =require("component")localevent=require("event")local ser =require("serialization")local holo = c.hologram
local glasses = c.glasses
local radius
local coords
local localCoords ={
x =-3051,
y =51,
z =3027}local rows ={}local maxPack =0local isDone =falselocalfunction receive(evt,_,_,_,_,msg1,msg2,msg3,msg4,msg5)print("Received Message:")if msg1 =="maxPack"then
maxPack = tonumber(msg2)print(msg2 .." total packages.")endif msg1 =="UserData"then
io.write("Coordinates are: ")
coords = ser.unserialize(msg2)
radius = msg3
io.write("X:".. coords.x .." Y:".. coords.y .." Z:".. coords.z .." Radius: ".. msg3 .."\n")endif msg1 =="Data"then
table.insert(rows,ser.unserialize(msg2))
table.insert(rows,ser.unserialize(msg3))
table.insert(rows,ser.unserialize(msg4))
table.insert(rows,ser.unserialize(msg5))endprint("Size: "..#rows .. "/" .. maxPack)endlocalfunction cleanUp()print("Interrupted. Press [ctrl+alt+c] to exit.")event.ignore("modem_message",receive)event.ignore("interrupted",cleanUp)endlocalfunction toGlasses()local times =1while times <#rows dofor i=-radius,radius dofor d=-radius,radius doendend
times=times+1endendlocalfunction createDot(x,y,z,color)local dot = glasses.addDot3D()
dot.set3DPos(x+0.5,y+0.5,z+0.5)
dot.setColor(table.unpack(color))endlocalfunction update()if#rows > 0 then
toGlasses()endendevent.listen("modem_message",receive)event.listen("interrupted",cleanUp)--createDot(0,5,0,{255,0,0})whiletruedo
update()
os.sleep(1/5)end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hi!
I have been working on a program for a few days on and off. But I kind of hit a wall on what I should do to make it work.
It's supposed to be a program that scans the environment through a geolyzer installed inside a tablet, and thereafter sends the scan data through a linking card to a stationary computer with a OpenGlasses' terminal. It will then go through each entry and check its value to determine whenever or not it's an ore, a liquid or if it's indestructible.The tablet program will ask for the player's location and how a large area it should scan, then asks if the player wants to send this data to be processed.
The tablet program will ask for the player's location and how a large area it should scan, then asks if the player wants to send this data to be processed. The stationary computer should just receive and process the data, then create 3D graphics at the player's location. I've got the collection and transmission part done, but I have problems with how I would go about to draw this on the glasses.
Tablet program:
Stationary computer with Glasses terminal:
Link to post
Share on other sites