SFS 1.4beta3 - Room Extension Problem.

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

Moderators: Lapo, Bax

User avatar
Virusescu
Posts: 260
Joined: 07 Sep 2005, 09:36
Location: [RO]Bucharest
Contact:

SFS 1.4beta3 - Room Extension Problem.

Postby Virusescu » 12 Mar 2006, 18:54

I used this kind of code before, but now it doesn't seems to react.
Here's my problem.
I have the following extension attached to one room in my zone.

Code: Select all

function init ()
{
   trace ("Challenge Extension Loaded");
}
function destroy ()
{
   trace ("CHALLENGE EXTENSION DESTROYED");
}
function handleRequest (cmd, params, user, fromRoom)
{
   trace ("NEW REQUEST on the login extension???");
   switch (cmd)
   {
      case "asd" :
      trace ("ASD request recieved");
      default :
      trace ("ERROR - Command not defined");
      break;
   }
}
function handleInternalEvent (evt)
{
   trace("New event >>> "+evt.name);
   if (evt.name == "userJoin")
   {
      var r = evt.room;
      var u = evt.user;
      var c = Math.random () * 1000;
      u.properties.put ("chips",);
      trace ("User " + u.getName () + " has " + c + " chips");
      delete r;
      delete u;
      delete c;
   }
}

The extension is attached from the server config.xml file as this rooms are supposed to be permanent (created by the server itself).
I can see the extension if I look at that room with the admin tool. Problem is that I can't see any message when the userJoins. Bigger problem is that even if I press the reloadExtension button in the admin tool I can't see the init nor the destroy traces I set in the trace window from the admin console.

This is the xml attached inside the Room Node in the config file. But as I told you before, the extensions seems to be attached corectly.

Code: Select all

<Extensions>
   <extension name="gameRoom" className="thu_challenge.as" type="script" />
   </Extensions>


Do you think I'm doing something wrong? What tests do you sugest?
function onJoin(usr) {if (usr.getName() == "Lapo") trace ("All Hail Lapo");}
User avatar
Virusescu
Posts: 260
Joined: 07 Sep 2005, 09:36
Location: [RO]Bucharest
Contact:

Postby Virusescu » 13 Mar 2006, 16:22

Hope to hear from you soon :roll:
function onJoin(usr) {if (usr.getName() == "Lapo") trace ("All Hail Lapo");}
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 13 Mar 2006, 17:32

Sorry,
but I can't reproduce the problem. The extension works as it should :)

Very simple question: when the server starts and creates the room, you should see the output of the trace in the init() method.

Do you at least see that?

Are you sure the <Extension> block is inside the <Room> definition?
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Virusescu
Posts: 260
Joined: 07 Sep 2005, 09:36
Location: [RO]Bucharest
Contact:

Postby Virusescu » 13 Mar 2006, 18:03

you should see the output of the trace in the init() method.

Yes I should. But it doesn't show up.
If I inspect the room with the admin tool I can see the extension listed. But no traces there, even if I press the reload button. The extension is also marked as "active".

Are you sure the <Extension> block is inside the <Room> definition?

It is. If it wasn't the admin tool would have listed it in the Zone maybe.
function onJoin(usr) {if (usr.getName() == "Lapo") trace ("All Hail Lapo");}
User avatar
Virusescu
Posts: 260
Joined: 07 Sep 2005, 09:36
Location: [RO]Bucharest
Contact:

Postby Virusescu » 13 Mar 2006, 18:07

One thing ... the <Extension> block you are talking about is in fact <Extensions>. Am I correct? I guess I am, because otherwise it wouldn't have showed up in the admin tool.
function onJoin(usr) {if (usr.getName() == "Lapo") trace ("All Hail Lapo");}
User avatar
Virusescu
Posts: 260
Joined: 07 Sep 2005, 09:36
Location: [RO]Bucharest
Contact:

Postby Virusescu » 13 Mar 2006, 19:00

SOLVED.
Here was the problem. Silly me.

Code: Select all

u.properties.put ("chips",);

I forgot a parameter.
Weird thing was that the trace didn't showed up no errors :(.


Maybe because that I am running the server as a service and I can't see the dos console? Where are this kind of errors dumped?
function onJoin(usr) {if (usr.getName() == "Lapo") trace ("All Hail Lapo");}
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 17 Mar 2006, 09:41

In the log files.
Also the console output is redirected to the wrapper.log file in the runAsService/ folder
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 26 guests