Page 1 of 1
Problems with Zone.getRoomListFromGroup()
Posted: 24 Aug 2010, 15:26
by peter.dalton
The method Zone.getRoomListFromGroup( string groupId ) does not seem to be working. I get an empty list however if I use the following code I find rooms:
Code: Select all
List<Room> rooms = getParentExtension().getParentZone().getRoomListFromGroup( "General" );
// rooms is empty.
List<Room> roomLists = getParentExtension().getParentZone().getRoomList();
for(Room r: roomLists)
{
if (r.getGroupId() == "General")
{
// I will find my room here.
trace( "Found room" );
}
}
My understanding was that getRoomListFromGroup() should be doing this filtering for me.[/code]
Posted: 24 Aug 2010, 17:24
by Lapo
Actually I think there is an error in your code.
You cannot compare Strings like this:
It must be
Code: Select all
if (r.getGroupId().equals("General"))
Once that's fixed you should get a different result.
Posted: 25 Aug 2010, 16:10
by peter.dalton
Actually I found the problem seems to be that if I set the room group within CreationSFSGameSettings for the room everything works fine. However if I call room.setGroupId( "Name" ) then nothing works. My guess is that you don't expect people to call setGroupId(). I really wish that there was better documentation or that apis would not be exposed like user.setVariable() on the client if they are not supposed to be called. If the methods need to be public for your internal code I really with that you would document the issue and change the name of the function to something like setGroupIdInternal(). This would avoid a lot of confusion as I'm digging through the list of functions to determine how everything fits together.
By the way the string compares work just fine.
On a positive note I'm very excited and impressed with the changes from SFS 1.6 to 2. It is most definitely headed in the right direction.
Posted: 27 Aug 2010, 09:22
by Lapo
The problem is that the group is not modifiable at runtime.
It is decided at creation time and cannot be changed later.
As regards the documentation we ask to be patient if there's some extra method here and there. The most "beta" part of this beta is really the documentation. We are working on a lot of improvements for the docs, especially for all the articles that will come etc...
It's quite unfortunate that the javadoc tool is so limited and strictly anchored to the packaging rules of Java which are so restrained and such a pain.
We will have to establish a convention to mark methods that are not useful to developers.
Re: Problems with Zone.getRoomListFromGroup()
Posted: 05 Feb 2016, 18:22
by Carl Lydon
This works for me:
Code: Select all
List<Room> roomList = pZone.getRoomListFromGroup(groupName);