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

issue with my code

Question

i modified the old geoglasses code to work with openglasses 2.  the code is as follows:

local com=require("component")

local arg={...}
local glass=com.glasses
glass.removeAll()
local geo=com.geolyzer

local size=tonumber(arg[2]) or 16
local pl=tonumber(arg[1] or 3)
local minpl = 2
local maxpl = 5

local maxY
if (tonumber(arg[3]) or 0)==0 then maxY=1 else maxY=size end

local function tocolor(pl)
  local color = (pl-minpl)/maxpl
  if color<0 then
    return {1,1,1}
  elseif color>1 then
    return {1,0,1}
  else
    return {color,1-color,0}
  end
end

function create(x,y,z,p)
  local a=component.glasses.addText3D()
  a.set3DPos(x,y,z)
  a.setColor(table.unpack(tocolor(p)))
  a.setText(p)
end

for x=-size,size do
  for z=-size,size do
    tile=geo.scan(x,z)
    os.sleep(0)
    for Y=-math.min(size,18),math.min(maxY,18) do
      local y=Y+32
      if tile[y]>pl then create(x+0.5,Y+0.5,z+0.5,tile[y]) end
    end
  end
end
print("found objects:", glass.getObjectCount())

when i try to run it I get the error of tried to index components, geolyzer returned nill value.  I have a geolyzer in both the tablet and glasses.  What could be the problem?

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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