filter roomlist from getRoomListFromGroup

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

aliko
Posts: 117
Joined: 09 Mar 2013, 16:26

filter roomlist from getRoomListFromGroup

Postby aliko » 08 Dec 2015, 06:21

Hello,

How can I fillter the roomList that I get from getRoomListFromGroup.
I want to filter the games that not started.

var roomList:Array = sfs.roomManager.getRoomListFromGroup(games_grup);

Best Regards,
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: filter roomlist from getRoomListFromGroup

Postby Lapo » 08 Dec 2015, 10:44

I'd recommend doing it via RoomVariables.
If you use rooms of type SFSGame there's already a variable signaling if the game is started.
http://docs2x.smartfoxserver.com/Advanc ... s/game-api

Otherwise you can set up your own Room Variables and then use them as filters. In other words you can cycle through the room list and select those that match your criteria.

An even better way is to use the FindRoomRequest passing a specific MatchExpression, which is a query-like expression to filter rooms based on multiple parameters.
MatchExpressions are also explained in the above link.

hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
aliko
Posts: 117
Joined: 09 Mar 2013, 16:26

Re: filter roomlist from getRoomListFromGroup

Postby aliko » 08 Dec 2015, 11:24

Hi Lapo,

Thank you very much your quick and detailed answer.
My main problem is changing the rooms.

Beginners have 1000 active users and 500 games,
Masters have 20 users and 10 games
Promasters have 10 users and 5 games.

When i change the room from masters to promaster, it becomes very fastly, but when i try to login Beginners room, it is coming slowly (because of counts)
I planned to show only the game rooms that game not started, so that i asked this question.

After trying the FindRoomsRequest, i understand that i asked wrongly :) Because same problem goes on.
Also i wanto to inform that i'm creating games with CreateSFSGameRequest.

Do you have any advice for me my main problem? (i hope I explained the problem)

Best Regards

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 12 guests