Change id of gui.clone [SOLVED]

Hi,
I want clone and change the id for change the position.
The problem is that I don’t know how to change the id, because I don’t know what the clone id is.


Thank you for your future help. :grinning:

Hi @Lecricreator!

To change the position, you just need to use the node.

    local node = gui.clone(gui.get_node("box"))
-- set the position and color of the new node
    gui.set_position(node, vmath.vector3(400, 400, 0.5))
    gui.set_color(node, vmath.vector4(1, 1, 0, 1))
1 Like

Ok, it’s easier than I thought to change the position of the clone, but to change the id, I can’t. Is it possible to change the id?
ch

Sure it’s possible, see the example in the documentation.
Also note that the function returns void, which means your id = gui.set_id() will become nil, which you cannot concatenate with your string.

Edit: Also, please post actual code, instead of screenshots. It will help us read the text, and others to search for similar issues.
We use Markdown formatting. Some examples here

1 Like

Ah, that’s why the print didn’t work.
Ok, that was really what stuck me.

Thanks for all your answers. :blush:

I try Markdown with this example:

local help = {}
for n = 0, 5 do
    help[n] = {}
    help[n].node = gui.clone(gui.get_node("cross"))
    gui.set_id(help[n].node, "newId"..n)
    gui.set_position(gui.get_node("newId"..n), vmath.vector3(400 + (n * 40), 400, 0.5))
    gui.set_color(help[n].node, vmath.vector4(1, 0, 0, 1))
end

cross

1 Like

How to make the page resolved? :sweat_smile:

Hello @Lecricreator,

I added “[SOLVED]” to the question title to signify it was resolved, I hope that’s okay?

Cheers,
Spen

2 Likes

Yes, perfect @SpencerWF . Thanks.

2 Likes