createRoom() - Specify which room to leave

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

Moderators: Lapo, Bax

User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

createRoom() - Specify which room to leave

Postby Pippoflash » 01 Mar 2006, 16:43

Hello,
Imagine I joined various rooms.
Imagine I want to create a new game room and join it, and I want to leave another game room, which is not the last one I joined.
Using joinRoom(), I can specify which room I am coming from, so that I can leave that room, and remain in the other rooms.
Is there a way to do it with createRoom()?

In a few words: when I create a new game room with exitCurrentRoom:true, is there a way to specify which room I want to exit?
Apparently, it leaves only the last room I joined...

thx!!!
-----------------------
www.pippoflash.com
-----------------------
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 01 Mar 2006, 19:13

Also, it seems that I can't get to work smartFox.leaveRoom(roomId)...
Does leaveRoom() have any known limits?

I tried with game rooms, non game rooms, getting the id from room.getId() or from Number(id)...
but no way...

Does someone ever find problems with leaveRoom()?

thanks!
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 21588
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 Mar 2006, 19:32

In a few words: when I create a new game room with exitCurrentRoom:true, is there a way to specify which room I want to exit?

No, you will leave the current room, in other words the last one

Also, it seems that I can't get to work smartFox.leaveRoom(roomId)...
Does leaveRoom() have any known limits?

No there aren't limits.
I will do a test and let you know what I've found...

:)
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 02 Mar 2006, 13:34

I still cant let leaveRoom() work :(
maybe its becdause of my setup?

here's the drawing:
I am logged in 3 rooms,
room 1 is defined in the config.xml and is the autoJoin() room. And I will remain logged there all the time.
room 2 is logged
room 3 is logged

I want to go into room 4, leaving only rooms 2 and 3
If I go with create-room, it will only leave room 3, but remains joined into room 2.
There is no way to leave room 2 :(

did something like this happen before?

thanks a lot
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 21588
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 02 Mar 2006, 14:25

I would suggest this:

- enter the autoJoin room
- join room 2
- join room 3

Now before going in room 4, leave room 2 and 3 (with leave room), then create the new room and join it

Alternatively: before going in room 4, leave room 2 and create room 4 passing the exitCurrent = true (which will make you leave the last room = room 3)

Let me know if it helps :)
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 02 Mar 2006, 23:30

thanks, I will try tomorrow morning and let you know ;)
-----------------------

www.pippoflash.com

-----------------------
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 03 Mar 2006, 15:12

Hello Lapo,
I tried in all possible permutations, but there is no way I can let leaveRoom() work :(
I dont know...
It doesnt leave the autoJoin room, as well as it doesnt leave any other room...
I call it 10 times, and in the admin the user is still in the room...
did something similar ever happen before?

thanks
Filippo
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 21588
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Mar 2006, 15:23

I will do a test on my side and let you know if there's a bug or something wrong with your code.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 03 Mar 2006, 15:49

Thank you Lapo,
I found a solution anyway, I just disconnect the user and re-connect again...
I keep the "guest_N" name given by server as choosen username so it keeps consistency...
It works now, but really the leaveRoom() which doesn't work remains a mistery...
I don't think it can be a bug in my code since it's very simple... and I tried so many times and in so many ways that a typo is impossible :)
maybe something in the server configuration on my machine, or related to the type of rooms created, but it doesnt work with any kind of room, static, dynamic, game, non-game, etc.

I hope we find the light :)
ciao
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 21588
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Mar 2006, 15:57

Question: the leaveRoom() command is invoked from the client side or server side?
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 03 Mar 2006, 16:10

client side
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 21588
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Mar 2006, 16:14

humm... so this is weird.
I have just did a quick experiment.
My client connects to the autoJoin room plus 2 other rooms.

Then I have on stage 2 buttons: each one makes me leave the 2nd and 3rd room respectively.

Works nicely :)

Question... do you handle the onRoomLeft() in your app?
If so, after you invoke the leaveRoom ... don't you get the event fired???

If not... are you sure you're passing the correct roomId to the leaveRoom() method.

If you want I can send you my test. It just uses the "simpleChat" zone

:)
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Postby Pippoflash » 03 Mar 2006, 16:20

I am quite sure I did everything nicely... I mean it's a big complex application and everything works fine...
Regarding to room Id, I tried to input it manually, to use the activeRoomId, to use room.getId() directly... I tried so many options that for sure at least once should have worked :P

I have the onRoomLeft() defined, and it works ok when I create a new room leaving the old one, but doenst get triggered on loaveRoom(), and also on the admin panel, I see that I remain logged in rooms...

Misteries of the worderful world of bugs of new technologies :) it's probably something related to the server on my local machine then... also if nobody ever found this problem before me, it's probably related to my comp or my app...
Anyway I have no rush now anymore since I found the disconnect/connect workaround... :)

Thank you very much for your help
Filippo
-----------------------

www.pippoflash.com

-----------------------
User avatar
Lapo
Site Admin
Posts: 21588
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Mar 2006, 16:59

2 quick things:

1 - the fact you see the user still in the room from the AdminTool, might be a bug. It's already fixed in the 1.4.0 release candidate.

2 - the fact you don't get the leaveRoom() event is strange and should not depend on your local machine. Unless you have disabled the event with the <DisabledSysEvents> tag in the Zone it should definitely work...

I've done the test with static room and dynamic game rooms, they all work!
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 13 guests