Extension issue

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

Moderators: Lapo, Bax

kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Extension issue

Postby kaligus » 28 Mar 2012, 19:52

Hello,

I'm having a problem... a null is returned if I try to send a message from server to my client...look below:

//send("iPadCommand", answer, gameExt.getGameRoom().getUserList()); // THIS DOES NOT WORK
send("iPadCommand", answer, player); //this works

gameExt is my main extension parent. I got this from an example, and it just not work...

This command is inside a handleClientRequest with a class that extends a BaseClientRequestHandler, called in my main extension extended by SFSExtension.

EDIT: I found that getParentRoom() return always null... maybe a bug?
EDIT2: found the problem... but not exacly how to solve it: the getParentRoom() is valid only for Room-level extensions... my extension is in Zone, I thought it will inherit, but it was not (or dont know what)... so I put the following code in my getGameRoom method: return getParentZone().getRoomByName("Lobby"); and it worked...
Last edited by kaligus on 28 Mar 2012, 20:26, edited 2 times in total.
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: Extension issue

Postby itsmylifesoham » 29 Mar 2012, 15:15

hi,

please clarify this :

is gameExt a zone extension or a room extension?

if its a zone extension then getparentroom() will return null.

now for your solution, lets say its a zone extension. let the zone contain a room named "someroom". also lets say you want to send the message to the users in "someroom".

then do this in your handleclientrequest() :

gameExt .getParentZone().getRoomByName("someroom") instead of gameExt.getGameRoom().getUserList()

Return to “SFS2X Questions”

Who is online

Users browsing this forum: DavinVicy, DerikFent, JerodSa and 2 guests