←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft


Terminal Glasses - grabbing playername and...

xNightmare's Photo xNightmare 17 Jun 2015

Hello there,

I've been trying to work on my own little custom HUD for the past day or so, and I was wondering how I could personify it to the extent where the program would be able to detect the name of the player who was wearing the glasses, then being able to display it on the HUD. I have no idea on how this would be achieved, hence why I came here.

I'd appreciate any help here.

The Crazy Phoenix's Photo The Crazy Phoenix 17 Jun 2015

There is indeed a method that allows you to get a list of all connected players (however, I cannot remember). It returns an array of all players with the terminal glasses equipped. The command event also includes a player argument, which allows you to know which player issued a certain command. It is however impossible to make a player-specific HUD using only one Terminal Glasses Bridge, you would need multiple to do so.

xNightmare's Photo xNightmare 18 Jun 2015

Pretty sure it's possible. The "Plastic" program seems to cue the player by name.

doublequestionmark's Photo doublequestionmark 18 Jun 2015

 xNightmare, on 18 June 2015 - 12:50 AM, said:

Pretty sure it's possible. The "Plastic" program seems to cue the player by name.
if i recall correctly, the plastic program asks you to enter your name during setup

RootSlayers's Photo RootSlayers 23 Jul 2015

Hello there !

To detect the name of the player(s) who wearing the Terminal Glasses you need to call this fonction :

Users = Glasses.getUsers()

Users is the array containing the player name.
Glasses is the T. Glasses object.

I hope this helps :)
Edited by RootSlayers, 23 July 2015 - 10:47 PM.