Forum Multiplayer RoomData save problem

Discussion and help relating to the PlayerIO Multiplayer API.

RoomData save problem

Postby Swoopjockey » April 26th, 2010, 5:29 am

Hi there, I'm trying to use RoomData to control whether or not a room is joinable (instead of relying on Visible). The reason is because I want players in the Lobby to see all current rooms, even if they can't join them. For some reason though, RoomData.Save() does not seem to be working.

Here is my AS3 Lobby.as code:
Code: Select all
                    if (PlayerCount >= 4)
                    {
                        //Visible = false;
                        RoomData["closed"] = "yes";
                        RoomData.Save();
                    }


Here is my C# code:
Code: Select all
                    if (PlayerCount >= 4)
                    {
                        //Visible = false;
                        RoomData["closed"] = "yes";
                        RoomData.Save();
                    }

....

            gameStarted = true;
            //Visible = false;
            RoomData["closed"] = "yes";
            RoomData.Save();
            Broadcast("startGame");


Whenever I run a trace of "closed" from AS3, it always returns 'no'. Is this a bug or am I missing something?
Swoopjockey
 
Posts: 21
Joined: February 5th, 2010, 2:17 pm

Re: RoomData save problem

Postby fox1980 » April 26th, 2010, 2:53 pm

It's working for me, how are you listing rooms in AS3 ?
fox1980
 
Posts: 206
Joined: April 1st, 2010, 10:39 pm

Re: RoomData save problem

Postby Benjaminsen » April 27th, 2010, 7:43 am

As fox1980 says, how are you listing the rooms?

Likewise you should look into the following to room attributes as well:
http://playerio.com/documentation/refer ... owUserJoin
http://playerio.com/documentation/refer ... me#Visible

Direct control over who can join and visibility of rooms.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: RoomData save problem

Postby Swoopjockey » April 27th, 2010, 8:44 am

I'm not having trouble with Visible or Joining rooms. That works fine. What I want to do is instead of hiding a room that is full/closed, for it to still be visible in the lobby list BUT for the Join button to be removed. That way players can still see all current rooms in the list, but only have a Join button for open rooms.

Here is my AS3 RoomEntry.as:
Code: Select all
function RoomEntry(room:RoomInfo, joinHandler:Function){
         super();
         trace ('closed = '+room.data.closed);
         if (room.data.closed == "yes") {
         margin(1,1,1,1).minSize(40,35).add(
            new Box().margin(0,0,0,0).fill(0xffffff,.5,10).border(1,0xFFFFFF,1).add(
               new Box().margin(NaN,NaN,NaN,5).add(new Label(room.data.name))
            ).add(
               new Box().margin(3,3,3).add(
                  new Box().margin(0,0,0,0).minSize(200,0).add(
                     new Columns(
                        new Box().margin(1,0,0,0).add(new Label("- Closed -",14, TextFormatAlign.CENTER ))
                     )
                  )
               )
            )
         )
      } else {
         margin(1,1,1,1).minSize(40,35).add(
            new Box().margin(0,0,0,0).fill(0xffffff,.5,10).border(1,0xFFFFFF,1).add(
               new Box().margin(NaN,NaN,NaN,5).add(new Label(room.data.name))
            ).add(
               new Box().margin(3,3,3).add(
                  new Box().margin(0,0,0,0).minSize(200,0).add(
                     new Columns(
                        new Box().margin(5,0,0,0).add(new Label(room.onlineUsers.toString() + " players",14, TextFormatAlign.CENTER )),
                        new TextButton("Join Table", function(){  joinHandler(room.id) })
                     )
                  )
               )
            )
         )
      }
      }


The problem is that this line always returns 'no':
Code: Select all
trace ('closed = '+room.data.closed);


So rooms still show up with a Join button. The AllowUserJoin still works properly, because once a player joins a full/closed room, he is instantly booted out. But the Join button remains. Any ideas?
Swoopjockey
 
Posts: 21
Joined: February 5th, 2010, 2:17 pm

Re: RoomData save problem

Postby fox1980 » April 27th, 2010, 4:59 pm

When i get home i'll check you code against mine, cause i don't remember how i did it but i know it's working ok for me.
This may seem obvious but you did add the "closed" to the search variables in the admin panel, haven't you ?
fox1980
 
Posts: 206
Joined: April 1st, 2010, 10:39 pm

Re: RoomData save problem

Postby Swoopjockey » April 28th, 2010, 7:02 am

For whatever reason, it seems to be working now.
Swoopjockey
 
Posts: 21
Joined: February 5th, 2010, 2:17 pm


Return to Multiplayer