Persistent RoomVariables get deleted

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Danneman
Posts: 33
Joined: 03 Apr 2005, 17:10
Location: Sweden

Persistent RoomVariables get deleted

Postby Danneman » 13 Apr 2005, 07:56

Ive predefined a persistent RoomVariable (and assigned a value) in the config.xml.

Code: Select all

<Var name="myRoomVar" type="n" persistent="true" private="false">0</Var>


First, I login with the "roomVarsExample.swf" to check the RoomVariables in realtime. I see "myRoomVar = 0", as expected.

Then I login with my swf, which contains code in the onJoinRoom()-event that changes the RoomVariable's value.

Code: Select all

var rVars:Array = [];
rVars.push( {name:"myRoomVar", val:1, persistent:true} );
smartFox.setRoomVariables(rVars);


I see "myRoomVar = 1", as expected.

Then I logout, and suddenly "myRoomVar" doesnt exist anymore (or atleast isnt shown in the Variable List of "roomVarsExample.swf".

Strange, I thought the existence of those variables should be independent of wether the user who created them were logged in or not?
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 13 Apr 2005, 10:29

The behaviour is right, but if you're used to SmartFoxServer Lite you may suspect it is a bug.

After some thinking we have changed the behaviour of the so called "Persistent" Room variables so that they exist until the user exist in the server. In other words if you create a room var called "Test" in room A and then you log out of room A and go in room B the variable will always exist.
It will be destroyed when the user disconnects from the server.
This is also well explained in section 5.11 of the online docs.

In our "TODO" list we have also a new option that we may introduce for "LOCKED" Room variables. Locked variables should not be destroyed when the user logs out.

At the moment we haven't found a possible scenario where these types of variables could be usefu.

Hope it helps :)
Lapo
--
gotoAndPlay()
...addicted to flash games
Danneman
Posts: 33
Joined: 03 Apr 2005, 17:10
Location: Sweden

Postby Danneman » 14 Apr 2005, 17:55

Ok, that cleared things up :)

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 37 guests