24,026 ARTICLES
ON THIS WIKI

Terminal Glasses

Terminal Glasses is an item added in the OpenPeripheral mod, and is used in conjunction with the Terminal Glasses Bridge to link and communicate with your ComputerCraft Computer or Advanced Computer. The Glasses allow you to create a unique HUD filled with information which you code yourself, ranging from simple text, to a digital clock displaying in-game time, to the status of machines including a full sized chat.

Usage[edit]

To begin coding your own custom HUD onto your Terminal Glasses you must first bind them to your Computer or Advanced Computer via a Terminal Glasses Bridge.

2014-07-08 15.20.54.png


Configuring your own custom HUD isn't too complicated. You can start with simple commands in your Computer's lua console such as:

glass.addBox([x-coordinate], [y-coordinate], [vertical size], [horizontal size], [hexadecimal code]*, 0.2) *Note: ComputerCraft's Color API does not work, only hexadecimal color codes can be used


ex: glass.addBox(1, 1, 50, 50, 0xFFFFFF, 0.2)

This input will result in a small white box on your screen while wearing your Terminal Glasses. Text can also be adding via this input:

glass.addText([x-coord], [y-coord], ["string"], [hexadecimal])

ex: glass.addText(5, 20, "Test Text", 0x000000)

For the text to show up you might need to add:

glass.sync()


2014-07-08 15.24.13.png

Coding Tutorials[edit]

Now for some basic coding tutorials.


Clock: Ever want to know exactly what time it is in your Minecraft world or Server? Well now it's a bit more accurate than your golden clock from vanilla, and it's hands free!

To program a clock into your Terminal Glasses, you'll start by binding them to your Computer via a Terminal Glasses Bridge. Once they are bound, enter your Computer and open a new program by typing "edit (desired program name)" and follow the steps below.


Written by Charlemagne
glass = peripheral.wrap("side the Bridge is on")
function addBox()
glass.addBox(1,1,80,10,0xFFFFFF,0.2)
end
function timeDis()
time = textutils.formatTime(os.time(), false)
glass.addText(5,2,"TIME: " .. time, 0xFF0000)
end
function start()
while true do
glass.clear()
addBox()
timeDis()
glass.sync()
sleep(0.1)
end
end
start()


After writing this program, press ctrl, and save. Then exit, and run the program by typing it's name in your Computer and pressing enter.

Result

Chat[edit]

For a chat that is being updated regularly the below program is provided.

https://pastebin.com/QDGKgTAh

Used in the chat is an API coded by the chat author. If you wish to customize the chat yourself or wish to see the API used the below program is provided.

https://pastebin.com/FM10T2EU