←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

OpenPeripheral Terminal Glass print a pict...

gfcwfzkm's Photo gfcwfzkm 28 Mar 2014

Hello Pro's

i have a little problem/question:
I want to use the OpenPeripheral Terminal Glass to print a picture/Icon. Is that possible?
I already found the command '.addIcon' but i dont understand how to use it :/

Can you pro's explain it to me (maybe a little tiny simple sample? thats the best way for me to understand something)

Thank you all =)

gfc
Quote

CometWolf's Photo CometWolf 28 Mar 2014

public ILuaObject addIcon(
  @Arg(name = "x", description = "The x position from the top left", type = LuaType.NUMBER) short x,
  @Arg(name = "y", description = "The y position from the top left", type = LuaType.NUMBER) short y,
  @Arg(name = "id", description = "The id of the item to draw", type = LuaType.NUMBER) short id,
  @Arg(name = "meta", description = "The meta of the item to draw", type = LuaType.NUMBER) short meta
){
  return addDrawable(new Drawable.ItemIcon(x, y, id, meta));
}
From what i can tell, addIcon is used to draw the picture of whatever item id you pass it, and the usage is farily straight forward.
bridge.addIcon(posX,posY,id,meta)
Quote

gfcwfzkm's Photo gfcwfzkm 28 Mar 2014

And heres the problem: the usage.
i dont know how to use it. what do they mean with "id" and "meta" ?
Quote

CometWolf's Photo CometWolf 28 Mar 2014

I kinda figured you had enough of a grasp of Minecraft to know what an item id is...
http://minecraft.gam...com/Data_values
meta is the sub value, eg id 38 meta 15 would be black wool.
Quote

gfcwfzkm's Photo gfcwfzkm 29 Mar 2014

ok. So the addIcon is not able to print own pics. hmm.... Its possible to set a pixel in TerminalGlass?
Oh and the addIcon-Command dont work. It just give error's back.
Edited by gfcwfzkm, 29 March 2014 - 09:53 AM.
Quote

CometWolf's Photo CometWolf 29 Mar 2014

Yes, that could be done with addBox.
I've never used addIcon myself, so i can't really diagnose that unless you give me the error message.
Edited by CometWolf, 29 March 2014 - 11:00 AM.
Quote

theoriginalbit's Photo theoriginalbit 29 Mar 2014

addIcon is designed only for rendering Minecraft items/blocks (and mod ones too)
as CometWold said use addBox.
the syntax is
bridge.addBox(xPos, yPos, width, height, colour, opacity)
Notes:
  • width and height is effected by the players GUI scale, so setting a width and height of 1 pixel will not always be displayed this way on a clients computer.
  • colour is a hexadecimal number between 0x000000 and 0xFFFFFF you can use services such as colorhexa to get these values
  • opacity is a number between 0 and 1 and deems the percentage of transparency.
Quote

gfcwfzkm's Photo gfcwfzkm 29 Mar 2014

=) Thanks

(problem solved) =D
Quote