Page 1 of 1

onRoomVariablesUpdate()-question

Posted: 12 Apr 2005, 13:28
by Danneman
I finally noticed the API-docs with the user documentations so my first question got answered. They are great, btw, short and conscise.

Question: Is it possible to get the userId of the user who was responsible for changing roomVariables and triggering a onRoomVariablesUpdate()-event to everybody?

Parameters are only "roomObj" and "changedVars", so I dont know how to identify the user who triggered the change.

Posted: 12 Apr 2005, 13:51
by Lapo
You're right, at the moment changes to room variables are broadcasted but the Id of the user is not passed.

However, if you take a look at the "Advanced Board game" you will notice that we send the id of the user that sent the game move within the roomVars themselves.
Also in that same example we show how to "compress" variables by using strings.

Let me know if that helps :)

Posted: 12 Apr 2005, 13:57
by Danneman
heh, I was just thinking of doing exactly that. Thats whats fun about programming - theres a workaround to every problem :)

Are you thinking of adding it, though? You said "at the moment", so I figured perhaps that meant you were going to.

Anyway, Ill go ahead with sending the userId as a variable. Thanks Lapo :)

Posted: 12 Apr 2005, 14:10
by Lapo
Yeah, we could add that if it's needed.
At the moment we're working on the next update: it will incorporate new cool features for the Administrator Tool, a couple of other enhacementes etc...

Also we're gathering the first impressions from users to add fixes etc... So if we see that the user ID can be useful we'll definately add it.

We didn't add it to avoid sending extra data all the times, and we thought that if it is needed one can add it in the var itself.

Let me know if this is giving you any troubles

:)

Posted: 13 Apr 2005, 07:42
by Danneman
Its a constant struggle between functionality and performance, I guess :)

But if you make a parameter optional for a function (as you do with the joinRoom()-function, for instance), and you dont use it, does it still generate overhead?
Because if it didnt, then it would be great to have a lot of parameter-options for some of the functions.
And if it does, perhaps you could do a set of similarly named functions which only differs in what/how many parameters they take?

Anyway, I did send the userId as a RoomVariable as you said, and it works fine, so Im not desperate for this functionality :)