Messaging from @render possible?

Hello, I have seen this how i can get the width and the height of the screen of user?
which is what I was looking for but now I stuck. I have tried in a few ways to use “msg” from render_script to send screen height and width but it won’t let me do that. So I get the feeling its not allowed/possible.

Does anybody know if what im trying to do is possible or not?

At the moment im just trying stuff, testing whats possible and what’s not

The url im sending is definitely correct because I use it alot but here is a code snipping from the render_scrupt
image

Thanks in advance for any information :slightly_smiling_face:

You can send messages from the render script in the normal way.

Might be worth putting a print(message_id) in the on_message function in controller.script to see if the message is getting through.

1 Like

First of all thanks alot for your super quick answers! :grinning:

I should have mentioned that, sry. I have already tried debugging but it sounds to me as if its not allowed/possible. Syntax should be right as well as the path. I wonder whats the problem

Is it really named “conteroller” with an e?

1 Like

OMG this cursed typos :sob:
Thanks sooo much for this great answers and help of this community! :sparkling_heart:

but it still not send a message to the controller for some reason :slightly_frowning_face:

when I remove the msg it works and as you can see it reaches the controller.

Any ideas what I’m doing wrong? :thinking: sry for making trouble for probably such a little thing :no_mouth:

The URL print comes after the debug print. Is the render script perhaps initialised before the controller script is ready?

2 Likes

Could be the reason :thinking:
But when should you check screen size to pass it to for example to the controller? I guess render_scripts are initialized as very first so nothing will be initialized at this point?
I could do it in the update mehtod but then I assume code will be executed only if screen size is changed right?

You could store the screen size in a module, and the controller could access that when it’s ready.

1 Like

oh that make sense :sweat_smile:
I will try that - thanks alot for your answer!

1 Like