Page 1 of 1

Positioning relative to another CustomGui element

Posted: Wed Feb 05, 2020 5:26 pm
by raiguard
This has been churning in my head for a while... The base game has several GUIs that appear relative to other elements (for example, choose-elem-buttons). It would be awesome if we could do this as well. Obviously the game has some way of knowing where an element is on-screen, so could this be extended to CustomGui as well?

I'm not sure how the implementation would be done. The return value would be a location that you would use on a frame in player.gui.screen, but I'm not sure how you would get the location. Or if it can even be done within gamestate.

Is this possible?

Re: Positioning relative to another CustomGui element

Posted: Wed Feb 05, 2020 5:53 pm
by eradicator
LuaGuiElement.location allows you to read the position of elements in "screen" (only if it's been manually set according to doc). Location of non-screen elements is not part of gamestate as far as i know.

So as long as you only want to position stuff relative to guis you created youself it should already be possible?

Re: Positioning relative to another CustomGui element

Posted: Wed Feb 05, 2020 7:05 pm
by raiguard
I want to position stuff relative to any CustomGui element, whether that be a child in a frame stored in screen, or something in mod GUI. It's probably too much to ask for though.

As it is now I can just hardcode the relative locations of the children I want to position stuff relative to, but that's ugly.