Hi,
I seem not to be able to access a room's variables before joining in. I understand this is meant to minimize traffic. But I was wondering if there was any way to do it, maybe some flag I missed to have rooms broadcast variables to all the zone instead of only to joined users.
Thanks
Access room variable before joining it
-
tortenazor
- Posts: 6
- Joined: 01 Mar 2012, 12:45
-
itsmylifesoham
- Posts: 186
- Joined: 16 Oct 2011, 14:33
Re: Access room variable before joining it
when you created a sfsroomvariable to be set on a room, just do
When a RoomVariable is set to global all changes will be broadcast not only to the Users in the Room but also to all other Users in the same Room Group .
note, users who want to see this variable from outside will have to subscribe to the room group of this room.
Code: Select all
newvariable.setGlobal(true)note, users who want to see this variable from outside will have to subscribe to the room group of this room.
Re: Access room variable before joining it
Hi,
you cannot do this on client side, you have code on server-side(Java) to achieve this,
please check the server-side java docs,
http://docs2x.smartfoxserver.com/api-do ... oc/server/
you cannot do this on client side, you have code on server-side(Java) to achieve this,
please check the server-side java docs,
http://docs2x.smartfoxserver.com/api-do ... oc/server/
======================================================
Choose a job of your choice and you will never have to work in life !!!
Choose a job of your choice and you will never have to work in life !!!
Re: Access room variable before joining it
Hi,
I'm using AS3 and I have a same problem. I have to get playerlist of any rooms shown to any user who hasn't join a room. I tried to access the room playerlist, but it can't be accessed by users outside the room. So then I tried using room variables to do the list. But, it's just the same. Can't be accessed by users outside the room.
So, how do we get the list?
Or at least tell us, is there any other way to access the room variable or playerlist property without joining it?
ps. I created the rooms from client side.
Please reply
Regards
I'm using AS3 and I have a same problem. I have to get playerlist of any rooms shown to any user who hasn't join a room. I tried to access the room playerlist, but it can't be accessed by users outside the room. So then I tried using room variables to do the list. But, it's just the same. Can't be accessed by users outside the room.
So, how do we get the list?
Or at least tell us, is there any other way to access the room variable or playerlist property without joining it?
ps. I created the rooms from client side.
Please reply
Regards
Re: Access room variable before joining it
htpeng wrote:Hi,
I'm using AS3 and I have a same problem. I have to get playerlist of any rooms shown to any user who hasn't join a room. I tried to access the room playerlist, but it can't be accessed by users outside the room. So then I tried using room variables to do the list. But, it's just the same. Can't be accessed by users outside the room.
So, how do we get the list?
Or at least tell us, is there any other way to access the room variable or playerlist property without joining it?
ps. I created the rooms from client side.
Please reply![]()
Regards
Hi,
again you cannot do that on client side because client cannot see outside of his room so as cannot access anything before joining the room, you have code on server side to do that, make a extension and return list of rooms or players in it and call that extension whenever you want ...
======================================================
Choose a job of your choice and you will never have to work in life !!!
Choose a job of your choice and you will never have to work in life !!!
Re: Access room variable before joining it
How to do it? 
Can you give me some examples? I've never used Java before, so it's still kinda confusing. And how to get it from client side (AS3) ?
Thanks before
Can you give me some examples? I've never used Java before, so it's still kinda confusing. And how to get it from client side (AS3) ?
Thanks before
Re: Access room variable before joining it
please check the java server api docs,
http://docs2x.smartfoxserver.com/api-do ... oc/server/
and if you dont know java than go on google for trainings, you will find many usefull links ..
Thanks.
http://docs2x.smartfoxserver.com/api-do ... oc/server/
and if you dont know java than go on google for trainings, you will find many usefull links ..
Thanks.
======================================================
Choose a job of your choice and you will never have to work in life !!!
Choose a job of your choice and you will never have to work in life !!!
Re: Access room variable before joining it
In particular check the SFSApi class and the methods to create a Room or to set a Room variable.secret007 wrote:please check the java server api docs,
http://docs2x.smartfoxserver.com/api-do ... oc/server/
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team