Room Variables Updated not firing

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Molix
Posts: 40
Joined: 01 Apr 2009, 19:34
Location: Toronto, ON, Canada

Room Variables Updated not firing

Postby Molix » 24 Feb 2012, 21:50

What could cause changes to room variables on the server side to not be sent to clients? It must be some overall setting I have missed, because I have tried a lot of different ways. e.g.

Code: Select all

// 1
RoomVariable var = room.getVariable( "X" );
var.setValue( String.valueOf( "1" ) );
   
// 2
HashMap<String, RoomVariable> vars = room.getVariables( room );
vars.put( "X", new RoomVariable("2", RoomVariable.TYPE_STRING, null, true, false ) );
         
// 3
room.setVariable( "X", RoomVariable.TYPE_STRING, "3", false, true, null, false );

// 4
vars.put( "X", new RoomVariable("4", RoomVariable.TYPE_STRING, null, true, false ) );
extensionHelper.setRoomVariables( room, null, vars, true, true);


They all seem to set the value (as viewed in the admin tool) but no message is sent to the client. I am watching the Debug messages in the Unity client. What have I missed?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Room Variables Updated not firing

Postby rjgtav » 24 Feb 2012, 22:35

Hi. Please check this section of the docs, it has an example code for setting RoomVariables of a Room via a Java Extension.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Molix
Posts: 40
Joined: 01 Apr 2009, 19:34
Location: Toronto, ON, Canada

Re: Room Variables Updated not firing

Postby Molix » 29 Feb 2012, 15:00

Yes, I reviewed that and did extensive searching before posting. I also tried the method (setRoomVariable) in the example before posting, and it also did not work; I didn't mention it due to it being flagged as deprecated.

Are there options that could be involved in setting up the room that would prevent the variables from being sent? It could be a bug in the Unity/C# client SDK I suppose, though all I am expecting is a debug message, so it seems unlikely.

For now I have just resorted to manually sending the update with an extension response, though that is obviously not ideal.
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: Room Variables Updated not firing

Postby itsmylifesoham » 02 Mar 2012, 07:13

if you are having the problem that client side event is not getting fired on setting a room variable then you can try this :

lets say the room you are setting it on is "modifiedroom"

then use this method :

getApi().setRoomVariables(User user, Room modifiedroom, java.util.List<RoomVariable> variables, boolean fireClientEvent, boolean fireServerEvent, boolean overrideOwnership)

pass user as null which tells the user setting it is the server. pass in the room to modify or set the variable on. pass the new roomvariables as a list. and most importantly set the fireclientevent as true.

hope that works.
Molix
Posts: 40
Joined: 01 Apr 2009, 19:34
Location: Toronto, ON, Canada

Re: Room Variables Updated not firing

Postby Molix » 04 Mar 2012, 17:49

Thanks for taking the time to reply. It looks like you are using SFS2X, but we are still using 1x. The call you have indicated looks a lot like my #4 anyway. The problem must be in the client API.
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: Room Variables Updated not firing

Postby itsmylifesoham » 04 Mar 2012, 17:58

oh sorry, thats right i was talking about sfs2x. :)
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Room Variables Updated not firing

Postby rjgtav » 04 Mar 2012, 22:52

Hi. Well, if your room is a limbo room, then when you update its variables, the update event is not broadcasted to anyone.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 7 guests