In the game that I am writing I want to show a “league table” with the standing of the 4 best players and then the current standing of the current player. To that end I have created a “leaguetable” GUI with four boxes containing text nodes to show the scores and handles of those 4 “best” players. I then use this GUI in a “leaguetable” collection which gets loaded via a proxy after first fetching the current league table from one of my servers.
All right thus far. But now here lies the problem. At play-time I cannot be certain that there will be 4 “better” players. So from within the script that works with the collection in question I need to hide the unrequired leaguetable boxes that are present courtesy of the embeded GUI. It is not clear to me how I do this.
Here is what I am doing
local count = table.getn(_hold.leaguetable)
local index = 1
while (index < count) do
--eventually to be used to populate the league table boxes that DO need to be shown
index = index + 1
end
--now I need to hide excess the leaguetable boxes if the server has returned < 4 "better" players
for i=index,4 do
local item ="boxOuter_"..i
local pos = go.get_position(item)
pos.z = -2
go.set_position(item)
end
The leaguetable boxes in leaguetable.gui bear the ids boxOuter_N where N is in 1…4. When I embed the GUI in my leaguetable.collection I can see boxOuter_N as expected. However, the above code I get
Instance boxOuter_2 not found. I assume that there is a way to address GUI nodes from within a collection but it is not clear to me what that mechanism might be.