What I'm doing wrong?

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
Dr_Malito
Posts: 18
Joined: 13 Dec 2006, 20:52
Location: Chile
Contact:

What I'm doing wrong?

Post by Dr_Malito »

Hi, I'm creating a game where the players can move an avatar in the scene.

to update the position I want to use an extension, because I want to autorize the movement before the players do it. Then, send the update to the clients.

I have an extension based on the "simple login extension" in the docs. It works OK for login, When a player sends a login request, I have this code and trace on the server:

Code: Select all

function handleInternalEvent(evt)
{
        trace("Event received: " + evt.name)

        if (evt.name == "loginRequest")
...
And the server has the following trace:

Code: Select all

[mwLogin.as]: Event received: loginRequest
[mwLogin.as]: Event received: userLost
But, with the sendXtMessage nothing happens:
Flash Code:

Code: Select all

var obj:Object = {};
obj.targetX = 100;
obj.targetY = 250;
this.smartfox.sendXtMessage("mwlogin", "walk", obj, "xml");
Extension Code:

Code: Select all

function handleRequest(cmd, params, user, fromRoom)
{
        trace("Request received: " + cmd);
}
Flash Trace

Code: Select all

[Sending]: <msg t='xt'><body action='xtReq' r='null'><![CDATA[<dataObj><var n='name' t='s'>mwlogin</var><var n='cmd' t='s'>walk</var><obj t='o' o='param'><var n='targetY' t='n'>100</var><var n='targetX' t='n'>200</var></obj></dataObj>]]></body></msg>
Extension Trace:

Code: Select all

Nothing...
In my config:

Code: Select all

		<Zone name="mw" uCountUpdate="true" buddyList="20" maxUsers="4000" customLogin="true">
			<Rooms>
				<Room name="Lumina" maxUsers="100" isPrivate="false" isTemp="false" autoJoin="true" uCountUpdate="true" />		
			</Rooms>
			
			<Extensions>
				<extension name="json" className="jsonSample.as" type="script" />
				<extension name="mwlogin" className="mwLogin.as" type="script" />
			</Extensions>
			
			<Moderators status="on">
				<Mod name="modName" pwd="modPass" />
			</Moderators>
		</Zone>
What I'm doing wrong?
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Post by patso »

[Sending]: <msg t='xt'><body action='xtReq' r='null'><![CDATA[<dataObj><var n='name' t='s'>mwlogin</var><var n='cmd' t='s'>walk</var><obj t='o' o='param'><var n='targetY' t='n'>100</var><var n='targetX' t='n'>200</var></obj></dataObj>]]></body></msg>
Are you sure you are in room when you try to call the extension?
the r attribute of the msg tag is roomId of the room where you are. As you can see it's null. May be the problem is this.
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Post by patso »

The problem is with the room id - in this case activeRoomId it's not updated properly - the reason why is here http://forums.smartfoxserver.com/viewtopic.php?t=1338
Dr_Malito
Posts: 18
Joined: 13 Dec 2006, 20:52
Location: Chile
Contact:

Post by Dr_Malito »

thanks patso. That was the problem
Post Reply