How to properly implement "set_time_step"?

(GUI object)
{...}
			msg.post(":/main#main", "set_time_step", {factor = 0, mode = 1})
{...}

If I understood correctly, instead of proxy it is required to insert the root script of the collection, in this case it is main, inside of which there is a go with the name main. Can you please explain what I am doing wrong? Believing the guide and example from britzl (https://github.com/britzl/publicexamples/blob/master/examples/pause_game/pause_game/pause.gui_script) I have to stop the game, but nothing happens.

Struct:
image

1 Like

Assuming your main collection is called “main” try this to pause:

msg.post("main:/main", "set_time_step", {factor = 0, mode = 0})

1 Like

You can only send that event to the collection proxy component.

1 Like

Then how do you change the time step for the current collection?

But how do you send it? I am a relative newbie to programming I have a slight misunderstanding of proxy and how it works. Can you tell me where to send this message or how to find the sending address ?

You can only change the “current” collection, if it is in fact loaded by a collection proxy.
Documentation: Collection proxy manual

2 Likes

You should see the url of the collection proxy in the editor.
A common way to debug the url of a game object, is to add a script to it, and in that script, in the init() function, add a debug print:

function init(self):
    print("URL", msg.url()) -- the url to this script
end

Knowing that url, you can figure out how to construct your other url.

2 Likes

Thank you so much for your tips and explanations. (I did it !)