Page 1 of 1

cannot set room variables with Java API

Posted: 13 Jan 2009, 18:48
by olafmol
Hello,

we use the code from the documentation to set Room Variables:

Code: Select all

Map<String, RoomVariableRequest> rVars = new HashMap<String, RoomVariableRequest>();
RoomVariableRequest variable = new RoomVariableRequest("2500", SFSVariable.TYPE_NUMBER);
rVars.put("score", variable);
sfs.setRoomVariables(rVars, 4, true);


but when looking in the Administrator tool we cannot see any room variables added, and also the onUpdateRoomVariables event is never triggered.

In the debug info it seems the send variables is empty too? We see <vars></vars> strings, with nothing in them

Olaf

Posted: 17 Jan 2009, 16:38
by shinsa
Same situation as I experienced.

I think it's bug at getXmlRoomVariable() in SmartFoxClient.java.
In this function, "boolean" should be SFSVariable.TYPE_BOOLEAN, etc.

I fixed them and tried, then socket connection is disconnected just after room variables changing request is sent. Currently I don't know why it occurs...

Posted: 17 Jan 2009, 16:55
by shinsa
Workaround is found.
Set the room variable when creating a room.
(I experimented room creation in AS3, room variable retrieve in Java)

Posted: 19 Jan 2009, 06:40
by Lapo
Thanks for reporting. We're taking a look asap

Posted: 28 Jan 2009, 14:59
by franto
Lapo wrote:Thanks for reporting. We're taking a look asap


Hey, is something new with this issue? I have same problem

Posted: 28 Jan 2009, 16:15
by Lapo
Hi,
the bug has been fixed. Expect a release in the next days.

Posted: 30 Jan 2009, 16:33
by Lapo
Hi there,
we have a pre-release available here:
http://www.smartfoxserver.com/download/ ... I_beta.zip

Please let me know if it fixes the problem
Thank you

Thank you

Posted: 31 Jan 2009, 20:41
by franto
Lapo wrote:Hi there,
we have a pre-release available here:
http://www.smartfoxserver.com/download/ ... I_beta.zip

Please let me know if it fixes the problem
Thank you


Thank you Lapo, I will test it on Monday and will let you know...

Franto

Posted: 04 Feb 2009, 15:21
by Lapo
how did it go?

Basic or Pro?

Posted: 04 Feb 2009, 17:20
by franto
Lapo wrote:how did it go?


1 question Lapo, does it matter if this is for Lite, Basic or Pro version?
or is it for all versions?

Posted: 04 Feb 2009, 18:01
by Lapo
We tested using the PRO, should work well with the Basic and it won't work with the Lite version.

Trouble setting variable

Posted: 22 Oct 2009, 13:55
by alexgenaud
Hi, is it possible this has not been fixed or has regressed in 1.6.6.

I create two rooms, one in the config.xml named "y" with a variable "type=y", then other room I create in a java Task which I expect to be named "c2" with a variable "type=c".

While the "type=y" of the initially created room is seen by both the client and the server, the "type=c2" of the extension created room "c2" is seen by the server but not the client.

Perhaps I've misunderstood private, owner, etc?:


In the config/xml:

Code: Select all

<Room name="y" maxUsers="100"
isPrivate="false" isTemp="false"
uCountUpdate="true" autoJoin="true" limbo="true">
   <Vars>
      <Var name="type" type="s" private="true">y</Var>
   </Vars>
</Room>



In Java Extension:

Code: Select all

Room nwRoom = new Room("c", 10, false, "z");
int id = nwRoom.getId();
nwRoom.setName("c" + id);
nwRoom.setVariable("type", RoomVariable.TYPE_STRING,
"c", true, true, null, true); // and other boolean variations



In client AS:

Code: Select all

logMessage("type/id/name: " +
r.getVariable("type") + "/" +
r.getId() + "/" +
r.getName());



Server side logs:

Code: Select all

y/1/y
c/2/c2



Client side logs:

Code: Select all

y/1/y
undefined/2/c2



Any thoughts?

Posted: 26 Oct 2009, 08:50
by Lapo
Rooms on the server set cannot be created like that.
You need to use the server side API, via the ExtensionHelper class.
From there you find a method call createRoom()

Make sure to take a look at the documentation:
http://www.smartfoxserver.com/docs/docP ... ons.htm#10

And javadoc:
http://www.smartfoxserver.com/docs/docP ... elper.html