Page 1 of 1

Update GUI

Posted: Mon Sep 25, 2017 5:24 pm
by darkfrei
Hi all!

How to update GUI properties?

When I added

Code: Select all

		player.gui.left.add{type = "frame", name = "frameTick", direction = "horizontal"}
		player.gui.left.frameTick.add{type ="table", name = "tabTick", colspan = 2}
		local tab = player.gui.left.frameTick.tabTick
		tab.add{type = "label", name = "label_tick", caption = "Tick"}
		tab.add{type = "button", name = "tick_value", caption = game.tick}
Then it works only on GUI-creation-event, but not on every tick.

Re: Update GUI

Posted: Mon Sep 25, 2017 7:09 pm
by darkfrei
Is it the best solution to destroy and make new one on every tick?

Re: Update GUI

Posted: Mon Sep 25, 2017 7:12 pm
by DaveMcW

Code: Select all

player.gui.left.frameTick.tabTick.tick_value.caption = game.tick

Re: Update GUI

Posted: Tue Sep 26, 2017 1:41 pm
by robertpaulson
DaveMcW wrote:

Code: Select all

player.gui.left.frameTick.tabTick.tick_value.caption = game.tick
do you still have to put it in a function that runs per tick? or this will automatically refresh? is so how do you make it run every 60ticks? =game.tick%60?

Re: Update GUI

Posted: Tue Sep 26, 2017 5:41 pm
by darkfrei
robertpaulson wrote:
DaveMcW wrote:

Code: Select all

player.gui.left.frameTick.tabTick.tick_value.caption = game.tick
or this will automatically refresh?
No, it can't be automatically refreshed.