BUG: joinRoom forcing me to leave previous room

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
panthoz
Posts: 25
Joined: 09 Jan 2012, 19:58

BUG: joinRoom forcing me to leave previous room

Post by panthoz »

I am using this code on the server, to have a user join a new room:

Code: Select all

getApi().joinRoom(user, room, null, false, null);
I'd like the user to stay in his current room, while joining this new room. It is still forcing him to leave his current room even though the "roomToLeave" variable is set to null, which is supposed to allow him to stay.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: BUG: joinRoom forcing me to leave previous room

Post by Lapo »

Can you provide a little bit more of detail here?
1- What server version do you use
2- Can you describe the steps that you do prior to that?
3- Are there any errors in the logs that might be related?
Lapo
--
gotoAndPlay()
...addicted to flash games
panthoz
Posts: 25
Joined: 09 Jan 2012, 19:58

Re: BUG: joinRoom forcing me to leave previous room

Post by panthoz »

Server Version: 2.0.0-RC3

Room is created by a user using this server code:

Code: Select all

 // Create the room's settings
            CreateRoomSettings crs = new CreateRoomSettings();
            crs.setName(roomName);
            //crs.setName("TestDungeon"+user.getId());
            crs.setMaxUsers(100);
            crs.setMaxVariablesAllowed(20);
            crs.setGame(true);
            //
            vars.add(new SFSRoomVariable("isBattle", 1));
            crs.setRoomVariables(vars);
            // Create the room on the server
            room = extension.getApi().createRoom(user.getZone(), crs, user, false, null);
Upon creating room, user joins it using this code:

Code: Select all

extension.getApi().joinRoom(user, room, null, false, null);
I then have another user join the newly created room with this code:

Code: Select all

getApi().joinRoom(user, room, null, false, null);
I now have both users in this room. When the user who created the room joins it, he is still in both rooms. However, when the second user joins that room, that second user is removed from his previous room, even though he is using the same code to join it as the first user.

There are no log errors at all.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: BUG: joinRoom forcing me to leave previous room

Post by Lapo »

That is certainly strange. I cannot test under RC3 because we are now at version 2.0.1, although I would expect it to work under RC3 as well.
Additionally if works for one user it should work for any others unless there are errors that you are not seeing.
Did you check the logs for possible errors when the 2nd user joins?
Lapo
--
gotoAndPlay()
...addicted to flash games
panthoz
Posts: 25
Joined: 09 Jan 2012, 19:58

Re: BUG: joinRoom forcing me to leave previous room

Post by panthoz »

Lapo wrote:That is certainly strange. I cannot test under RC3 because we are now at version 2.0.1, although I would expect it to work under RC3 as well.
Additionally if works for one user it should work for any others unless there are errors that you are not seeing.
Did you check the logs for possible errors when the 2nd user joins?
Nothing at all in the log after the 2nd user joins the room aside from a trace that says he left his previous room. I have tried upgrading to 2.0.1, but I still have the same issue.
panthoz
Posts: 25
Joined: 09 Jan 2012, 19:58

Re: BUG: joinRoom forcing me to leave previous room

Post by panthoz »

Bump. Need this solved as soon as possible. I've tried different variations of the joinRoom command with no luck. It's strange how only the owner of the room is not leaving his current room when he joins it.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: BUG: joinRoom forcing me to leave previous room

Post by Lapo »

I have test this myself and found no problems. Both users can join the game Room without leaving the first one.
We need you to send us a reproducible case.
Please follow these instructions:
http://www.smartfoxserver.com/support/info

This is the core of the script we used to test the scenario:

Code: Select all

def runTest():
	zone = _base.parentZone
	theLobby = zone.getRoomByName("The Lobby")
	
	userPippo = _sfsApi.createNPC("PiPPo", zone, False)
	userCiccio = _sfsApi.createNPC("CiCCio", zone, False)
	
	# Join a common Room
	_sfsApi.joinRoom(userPippo, theLobby)
	_sfsApi.joinRoom(userCiccio, theLobby)
	
	# Create game room, join it, without leaving lobby
	theRoom = createRoom(userCiccio)
	_sfsApi.joinRoom(userPippo, theRoom, None, False, None)
	_sfsApi.joinRoom(userCiccio, theRoom, None, False, None)
	

def createRoom(owner):
	currZone = _base.getParentZone()
	
	settings = CreateRoomSettings()
   	settings.setGame(True)
	settings.setDynamic(True)
   	settings.setName("Room_" + owner.name) 
   	settings.setMaxUsers(10)
	
	newRoom = _sfsApi.createRoom(	
		currZone,
		settings,
		owner,
		False,
		None,
		False,
		False
	)
	
	trace("New Room: ", newRoom)
	return newRoom
Lapo
--
gotoAndPlay()
...addicted to flash games
Stigma
Posts: 15
Joined: 22 Feb 2010, 13:30
Location: Switzerland

Re: BUG: joinRoom forcing me to leave previous room

Post by Stigma »

Hi,

I have exactly the same problem. When my NPC joins a room, he leaves previous room.

Nothing in the logs and the method call is correct. I tried all method call but unfortunatly it don't work.

Code: Select all

requestHandler.getApi().joinRoom(bot, room, null, false, null);
Did you found something about this problem?

Thomas
Post Reply