Page 2 of 2
Posted: 29 Aug 2007, 09:38
by Lapo
From the client side you can create variables in any room provided that you are joined in that room. (reason? security )
If you need to create variables in any room then you should perform it from server side
Posted: 24 Sep 2007, 13:44
by tdous
Hi, server side room variable setting problem..
I have a function which receives the params to be used as room variables, creates the room then tries to set the variables:
Code: Select all
// ROOM CREATION CODE, then...
trace(cr_tag + ' and ' + ce_tag);
var roomVars = [];
roomVars.push({ name: 'c_id', val: 1 });
roomVars.push({ name: 'cr_id', val: false });
roomVars.push({ name: 'ce_id', val: false });
roomVars.push({ name: 'cr_tag', val: cr_tag }); // fail
roomVars.push({ name: 'ce_tag', val: ce_tag }); // fail
roomVars.push({ name: 'hash', val: false });
roomVars.push({ name: 'completed', val: false });
_server.setRoomVariables(theRoom, null, roomVars);
What happens is that the first, second and third vars, and the sixth and seventh vars, all numeric or boolean, are set correctly, but the two strings are not.
The trace at line 3 of this example outputs the two strings, eg. "X and Y", correctly. I have tried setting the vars as I create the room but with the same result. I'm running 1.5.5. Help!

Posted: 24 Sep 2007, 13:52
by Lapo
cast them to Strings like this:
Code: Select all
roomVars.push({ name: 'cr_tag', val: String(cr_tag) });
Btw, why receiving the data from an extension call and then perform a server side Room Var set, instead of doing this directly from the client side?
Posted: 24 Sep 2007, 14:05
by tdous
Thanks
There's a minimum of data passing between the client and server. The room variable data here is stored in a mysql database earlier in a different part of the site. The extension only receives an id to access the data from the client, fetches it from mysql and sets the room variables for use by the two clients who will be involved in that multiplayer game.
They're really just part of ensuring the right people are in the right room. More than likely, by the end of development it'll just be down to ids or names but all the relevant data's there at the moment just in case.