Page 1 of 1

How to do style-button with Item in it?

Posted: Thu Dec 14, 2017 12:46 pm
by Gergely
I want to show a button with an image of the item prototype "infinity-chest" on the top part of the player gui.

First, I want to achieve this with a console command:

/c game.player.gui.top.add({type = "sprite-button",name = "test",sprite = "item/infinity-chest"})

The result looks like this:
smallbutton.jpg
smallbutton.jpg (2.2 KiB) Viewed 1653 times
I was expecting a normal sized button with an image of the item on it. What did I do wrong here?

Re: How to do style-button with Item in it?

Posted: Thu Dec 14, 2017 1:27 pm
by Helfima
you must add a style or your picture size is null

Code: Select all

/c game.player.gui.top.add({type = "sprite-button",name = "test",sprite = "item/infinity-chest", style="icon_button"})

Re: How to do style-button with Item in it?

Posted: Thu Dec 14, 2017 2:05 pm
by darkfrei
[GUIDE] How to style buttons with images on them.

viewtopic.php?f=34&t=24007#p300165

Re: How to do style-button with Item in it?

Posted: Thu Dec 14, 2017 3:01 pm
by Gergely
Oh boy...

Where do I find the list of available styles?

Re: How to do style-button with Item in it?

Posted: Thu Dec 14, 2017 4:09 pm
by darkfrei
Gergely wrote:Oh boy...

Where do I find the list of available styles?
From this mod:
viewtopic.php?f=33&t=54423#p321674

available styles
By the 0.16 there's no "_style" on the end of name.