How to do style-button with Item in it?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Gergely
Filter Inserter
Filter Inserter
Posts: 595
Joined: Sun Apr 10, 2016 8:31 pm
Contact:

How to do style-button with Item in it?

Post 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 1628 times
I was expecting a normal sized button with an image of the item on it. What did I do wrong here?
Last edited by Gergely on Thu Dec 14, 2017 1:57 pm, edited 1 time in total.

Helfima
Fast Inserter
Fast Inserter
Posts: 199
Joined: Tue Jun 28, 2016 11:40 am
Contact:

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

Post 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"})

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post by darkfrei »

[GUIDE] How to style buttons with images on them.

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

User avatar
Gergely
Filter Inserter
Filter Inserter
Posts: 595
Joined: Sun Apr 10, 2016 8:31 pm
Contact:

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

Post by Gergely »

Oh boy...

Where do I find the list of available styles?

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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.

Post Reply

Return to “Modding help”