I add that I've a second problem... D'=
I've an error "BAD_PARAMS".

I send this request (that's the request wich return the error) :
Neotopia.Pipe.request.send('PNeotopia', { cmd: "Connexion", session:
Neotopia.SESSION });

And my JS Module on APE is :
var $Neotopia = {
        users: [],
        Objets: [
            { 'image':'http://mydomain.fr/buildset.png','x':0,'y':
0,'tile':464,'id':1,'index':1,'collision':false },
            { 'image':'http://mydomain.fr/buildset.png','x':1,'y':
0,'tile':464,'id':2,'index':1,'collision':false },
            { 'image':'http://mydomain.fr/buildset.png','x':2,'y':
0,'tile':464,'id':3,'index':1,'collision':false },
            { 'image':'http://mydomain.fr/buildset.png','x':3,'y':
0,'tile':464,'id':4,'index':1,'collision':false },
            { 'image':'http://mydomain.fr/buildset.png','x':5,'y':
2,'tile':58,'id':6,'index':1,'collision':true },
            { 'image':'http://mydomain.fr/buildset.png','x':5,'y':
3,'tile':116,'id':7,'index':1,'collision':false }
        ]

};

Ape.registerCmd("PNeotopia", false, function(params, infos) {
        if (!$defined(params.cmd)) return ["5000","NO_COMMAND_GIVEN"];

        switch (params.cmd) {
                case "Deplacement":
                        if (!$defined(params.deplacer)) return
["7000","DIRECTION_NOT_DECLARED"];
                        if (params.deplacer !== 0 && params.deplacer !
== 1 &&
params.deplacer !== 2 && params.deplacer !== 3) return
["7100","BAD_DIRECTION"];

                        var pipe = Ape.getPipe(params.pipe);
                        if (!$defined(pipe)) return ["4400",
"WHERE_S_THE_PIPE"];

                        if ($defined(infos.user.$Neotopia)) {
                                switch (params.deplacer) {
                                        case 0:
                                               
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].y++;
                                        break;
                                        case 1:
                                               
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].x--;
                                        break;
                                        case 2:
                                               
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].x++;
                                        break;
                                        case 3:
                                               
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].y--;
                                        break;
                                        default:
                                                return
["7100","BAD_DIRECTION"]
                                }

                                pipe.sendRaw('PN_dataPositions', {
                                        'name':
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].name,
                                        'id':
infos.user.getProperty("ID_Neotopia"),
                                        'direction': params.deplacer,
                                        'x':
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].x,
                                        'y':
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].y
                                });
                        }
                break;

                case "Connexion":
                        if (!$defined(params.session)) return
["6000","SESSION_NOT_DECLARED"];

                        if (!$defined(infos.user.$Neotopia)) {
                                infos.user.$Neotopia = true;

                                var getDATA = new Http("http://
mydomain.fr:80/APE-" +
params.session + "-getDATA.html");

                                getDATA.getContent(function (MyData) {
                                        var data = JSON.parse(MyData);

                                        $Neotopia.users[data.id] = {};
                                        $Neotopia.users[data.id].id =
data.id;
                                       
infos.user.setProperty("ID_Neotopia", data.id);

                                        $Neotopia.users[data.id].name
= data.name;

                                        var Positions =
data.position.split("|");
                                        var MyPositionX =
Positions[0];
                                        var MyPositionY =
Positions[1];

                                       
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].x =
MyPositionX;
                                       
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].y =
MyPositionY;
                                });

                               
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].pipe =
params.pipe;
                        }

                        return { 'raw': { 'name':
'PN_connexionReussie', 'data':
{ 'connexion': 'Reussie' } } };
                break;

                case "Joueurs":
                        if (!$defined(params.session)) return
["6000","SESSION_NOT_DECLARED"];

                        var pipe = Ape.getPipe(params.pipe);
                        if (!$defined(pipe)) return ["4400",
"WHERE_S_THE_PIPE"];

                        if ($defined(infos.user.$Neotopia)) {
                                var getPlayers = new Http("http://
mydomain.fr:80/plugins/json/
personnages-" + params.session + ".json");

                                getPlayers.getContent(function
(Players) {
                                       
pipe.sendRaw('PN_gestionJoueurs', {
                                                        'joueurs':
Players
                                        });
                                });
                        }
                break;

                case "Personnage":
                        var pipe = Ape.getPipe(params.pipe);
                        if (!$defined(pipe)) return ["4400",
"WHERE_S_THE_PIPE"];

                        if ($defined(infos.user.$Neotopia)) {
                                pipe.sendRaw('PN_Personnage', {
                                                'id':
infos.user.getProperty("ID_Neotopia"),
                                                'x':
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].x,
                                                'y':
$Neotopia.users[infos.user.getProperty("ID_Neotopia")].y
                                });
                        }
                break;

                case "Objets":
                        pipe.sendRaw('PN_Objets', {
                                'objets': $Neotopia.Objets
                        });
                break;

                default:
                        return ["5100","NO_COMMAND_FOUND"];
        }
        return 1;

});

Ape.addEvent("deluser", function (user) {
        if ($defined(user.$Neotopia)) {
                var setPosition = new Http("http://mydomain.fr:80/APE-
NONE-
setPOSITION=" + user.getProperty("ID_Neotopia") + "-" +
$Neotopia.users[user.getProperty("ID_Neotopia")].x + "-" +
$Neotopia.users[user.getProperty("ID_Neotopia")].y + ".html");

                setPosition.getContent(function (resultat) {
                        var pipe =
Ape.getPipe($Neotopia.users[user.getProperty("ID_Neotopia")].pipe);
                        if (!$defined(pipe)) return ["4400",
"WHERE_S_THE_PIPE"];

                       
$Neotopia.users[user.getProperty("ID_Neotopia")] = '';

                        pipe.sendRaw('PN_delJoueur', {
                                'id': user.getProperty("ID_Neotopia")
                        });
                });
        }

});

But when I send :
Neotopia.Pipe.request.send('PNeotopia', { cmd: "Connexion" });

That's return me the error 6000 : "SESSION_NOT_DECLARED".

Anyone can help me please ? :o

Thanks very much ! =D

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to