Cannot get Room Variables JS API 1.1.0

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

darkera13
Posts: 3
Joined: 20 Jun 2013, 08:10
Contact:

Cannot get Room Variables JS API 1.1.0

Postby darkera13 » 12 Feb 2014, 10:16

I just update to latest API version, but can't get Room Variables. The code still work with previous API version.
User avatar
Bax
Site Admin
Posts: 4610
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Cannot get Room Variables JS API 1.1.0

Postby Bax » 12 Feb 2014, 10:39

Can you please describe the steps to reproduce the issue?
Paolo Bax
The SmartFoxServer Team
darkera13
Posts: 3
Joined: 20 Jun 2013, 08:10
Contact:

Re: Cannot get Room Variables JS API 1.1.0

Postby darkera13 » 12 Feb 2014, 11:37

Send Request:

Code: Select all

this.smartfox.send(new SFS2X.Requests.System.JoinRoomRequest(room, password, roomIdToLeave, asSpect));


Listen Response:

Code: Select all

this.smartfox.addEventListener(SFS2X.SFSEvent.ROOM_JOIN, this.onRoomJoin, this);

p.onRoomJoin = function (event) {
      console.log("onRoomJoin");
      console.log(event.room.getVariable("betMoney")); // return undefined
}


API V1.0.1 Console log
Screen Shot 2014-02-12 at 17.54.45.png
API V1.0.1
(33.03 KiB) Not downloaded yet


API V1.1.0 Console log
Screen Shot 2014-02-12 at 17.56.02.png
API V1.1.0
(32.47 KiB) Not downloaded yet
User avatar
Bax
Site Admin
Posts: 4610
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Cannot get Room Variables JS API 1.1.0

Postby Bax » 12 Feb 2014, 15:49

Thank you for reporting the issue. We fixed it and released version 1.1.1 of the API.
You can get the new version here: http://www.smartfoxserver.com/download/sfs2x#p=client
Paolo Bax
The SmartFoxServer Team
darkera13
Posts: 3
Joined: 20 Jun 2013, 08:10
Contact:

Re: Cannot get Room Variables JS API 1.1.0

Postby darkera13 » 21 Feb 2014, 17:19

Thanks Bax.

I think i have found other bug. I use FindRoomRequest to filter my Rooms list, but when join to room the function getSpectatorCount() always return zero. But when reset FindRoomRequest this thing out, getSpectatorCount() correct.

Request:

Code: Select all

this.getSmartFox().addEventListener(SFS2X.SFSEvent.ROOM_FIND_RESULT, this.onRoomFindResult, this);
var exp = new SFS2X.Entities.Match.MatchExpression("bet", SFS2X.Entities.Match.NumberMatch.EQUALS, parseInt(bet));
this.getSmartFox().send(new SFS2X.Requests.System.FindRoomsRequest(exp, game));


Spectator Count:

Code: Select all

var roomSpectators = this.room.getSpectatorCount() + "/" + this.room.maxSpectators;
User avatar
Bax
Site Admin
Posts: 4610
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Cannot get Room Variables JS API 1.1.0

Postby Bax » 22 Feb 2014, 10:45

darkera13 wrote:Thanks Bax.

I think i have found other bug. I use FindRoomRequest to filter my Rooms list, but when join to room the function getSpectatorCount() always return zero. But when reset FindRoomRequest this thing out, getSpectatorCount() correct.

Request:

Code: Select all

this.getSmartFox().addEventListener(SFS2X.SFSEvent.ROOM_FIND_RESULT, this.onRoomFindResult, this);
var exp = new SFS2X.Entities.Match.MatchExpression("bet", SFS2X.Entities.Match.NumberMatch.EQUALS, parseInt(bet));
this.getSmartFox().send(new SFS2X.Requests.System.FindRoomsRequest(exp, game));


Spectator Count:

Code: Select all

var roomSpectators = this.room.getSpectatorCount() + "/" + this.room.maxSpectators;

Can you please rephrase? Because I can't understand sorry.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 20 guests