Page 1 of 1

onRoomAdded no variables!

Posted: 25 Nov 2005, 23:35
by fwe
Hello, great product you have here :)

Although I do have a problem. I'm not sure if I'm donig something wrong or if it's the server's problem. (I doubt it)

Well, People can create rooms (acting like servers, like you would in Counter Strike) and they autojoin it, but when I test in the server list, it shows the getName() and all of that, but it does NOT just any of the variables I assigned,

Code: Select all

game = {}
	game.name 			= nam
	game.password 		= ""
	game.maxUsers 		= 10
	game.maxSpectators 	= 0
	game.isGame 		= true
	game.isTemp 		= true
	game.vars  			= []
	game.vars.push( {name:"map", val:"de_dust"} )
	smartfox.createRoom(game)
And to recieve the servers,

Code: Select all

smartfox.onRoomAdded = function(roomObj) {
	o = roomObj
	if(o.isGame()) {
		newServer = {ID:1, Server:o.getName(),Players:o.getUserCount()+"/"+o.getMaxUsers(),Map:o.variables.map}
		servers.addItem(newServer)
	}
}
All of it shows up, but the map variable, which should be "de_dust".


By the way, I have another question. Does onRoomListUpdate get called whenever a server variable changes AND when a new server is created?

Posted: 26 Nov 2005, 10:33
by Lapo
Hi fwe,
Although I do have a problem. I'm not sure if I'm donig something wrong or if it's the server's problem. (I doubt it)
Actually it's not a server problem but there's a small bug with the client side API. Thanks for spotting it!

You can safely download the fixed API here >> http://www.smartfoxserver.com/products/ ... #downloads
(just click and download the new "Flash API Classes")

In order to use them just point your Actionscript classpath to the folder containing the it/ directory (if you use AS 2.0) or copy the SmartFoxClient.as file in your working directory (if you use AS 1.0)
By the way, I have another question. Does onRoomListUpdate get called whenever a server variable changes AND when a new server is created?
The onRoomListUpdate is called once when the login process is okay. Once you have the main room list you will only receive the necessary messages to keep the list updated.

Hope it helps :)

Posted: 26 Nov 2005, 17:01
by fwe
Lapo wrote: Actually it's not a server problem but there's a small bug with the client side API. Thanks for spotting it!


You can safely download the fixed API here >> http://www.smartfoxserver.com/products/ ... #downloads
(just click and download the new "Flash API Classes")
Aha! That did the trick, thanks a lot.