Script boite de dialogue avec menu pour téléporteur

Répondre
Partager Rechercher
Bonjour
j'essaie de configurer un téléporteur 1 prim tout simple avec click sur le téléporteur pour choisir une destination.
J'ai trouvé un script permettant d'afficher une fenetre bleue dans le coin de l'écran avec choix possible, mais mon probleme est qu'une fois le choix entré, le script n'ouvre pas le script de téléport.
Dois je ajouter dans ce script celui du tp ou dois je simplement modifier le //do .. et que dois je ajouter après ?
Voici le script, modifié avec un //do qui ne fonctionne pas

Code:
//DIALOG MENU by Kyrah Abattoir
 
integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
    menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,buttons,menu_channel);
    llSetTimerEvent(5.0);
}
default
{
    touch_start(integer t)
    {
        menu(llDetectedKey(0),"*Fuze* Teleporter, Where do you want to go ?",["Shop","Laboratory","Taira"]);
    }
    timer() //so the menu timeout and close its listener
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) //in case you have others listeners
        {
            if(message == "Shop")
            {
                //do open 1
            }
            else if(message == "Laboratory")
            {
                //do open 2 
            }
            else if(message == "Taira")
            {
                //do open 3
            }
        }
    }
}
Merci de m'aider.

PS: J'ai essayé de le modifier en ajoutant une partie du script de TP, cela ne fonctionne pas non plus.

voice la partie du script TP
Code:
//The target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <56, 79, 703>;
// Text for the "pie menu"
string gSitText="Teleport";
// Define channel number to listen to user commands from
integer myChannel = 123;
 
// No need to edit the global variables below
// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// Key for avatar sitting on object, if any
key gAvatarID=NULL_KEY;
// If you don't enable this the teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
Pas testé, mais tu me diras

Code:
list lieu=["lieu1","lieu2"]; // tu en mets autant que tu veux
list pos=[<10,12,30>,<40,50,60>]; // coordonné de destination
integer MyChannel;
default
{
state_entry()
{
llSetText(llList2String(lieu,0),<1,1,1>,1.0);
llSitTarget(llList2Vector(pos,0)-llGetPos(),ZERO_ROTATION);
MyChannel=(integer)llFrand(1000.0)+5000;
llListen(MyChannel,"",NULL_KEY,"");
}
touch_start(integer total_number)
{
llDialog(llDetectedKey(0),"votre destination",lieu,MyChannel);
}
listen(integer channel, string name, key id, string message)
{
integer i;
i=llListFindList(lieu,[message]);
llSetText(llList2String(lieu,i),<1,1,1>,1.0);
llSitTarget(llList2Vector(pos,i)-llGetPos(),ZERO_ROTATION);
}
changed(integerchange)
{
if(change==CHANGED_LINK&&llAvatarOnSitTarget()!=NULL_KEY)llUnSit(llAvatarOnSitTarget());
}
}
Ahh Merci Magic Cat, mais je place ou? ( suis un peu blonde... )
A la suite de mon 1er script ou a sa place?


Edit:
Alors, j'ai dupliqué mon objet et placé ce script seul dedans.. ca ne marche pas ( pas de boite de dialogue en haut de l'écran avec choix possible de la destination .. ).


Je teste en le mettant a la suite du script de ma boite de dialogue.

En fait, je vois pas ou je peux le placer dans mon script ....

J'ai remanié le script avec la boite de dialogue. Ca donne ca:

Code:
//DIALOG MENU by Kyrah Abattoir

integer menu_handler;
integer menu_channel;
menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
    menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,buttons,menu_channel);
    llSetTimerEvent(5.0);
}
default
{
    touch_start(integer t)
    {
        menu(llDetectedKey(0),"*Fuze* Teleporter, Where do you want to go ?",["Shop","Laboratory", "Taira"]);
    }
    timer() //so the menu timeout and close its listener
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) //in case you have others listeners
        {
            if(message == "Shop")
            {
                //do target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <56, 79, 703>;
                // Text for the "pie menu"
string gSitText="Teleport";
                // Define channel number to listen to user commands from
integer myChannel = 123;
// No need to edit the global variables below
// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// Key for avatar sitting on object, if any
key gAvatarID=NULL_KEY;
// If you don't enable this the teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
            }
            else if(message == "Laboratory")
            {
                //do target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <11,76,722>;
// Text for the "pie menu"
string gSitText="Teleport";
// Define channel number to listen to user commands from
integer myChannel = 123;
// No need to edit the global variables below
// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// Key for avatar sitting on object, if any
key gAvatarID=NULL_KEY;
// If you don't enable this the teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
            }
            else if(message == "Taira")
            {
                //do target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <55,53,29>;
// Text for the "pie menu"
string gSitText="Teleport";
// Define channel number to listen to user commands from
integer myChannel = 123;
// No need to edit the global variables below
// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// Key for avatar sitting on object, if any
key gAvatarID=NULL_KEY;
// If you don't enable this the teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
            }
        }
    }
}
Les 2er choix me téléportent la ou je veux, mais le 3eme choix n'est pas pris en compte. Y a t il une variable qui configure le nombre de choix et la prise en compte de ceux ci ?
Le sscript que je t'ai donné est complet.
Tu mets dans la première liste les nom des lieux, et dans la deuxième les coordonées de l'endroit (tu peux les voir en te mettant à l'endroit)
Ensuite tu touche l'objet, là il te donne un menu et tu choisi l'endroit de destination.
Ensuite sur ta ball s'affiche la destination courante de ta ball.

Pour aller à la destination, tu fais s'assoir (j'ai oublié de changer les menu)
Merci
Ca marche, l'as tu modifié? ( quand je l'ai essayé hier, j'avais pas de menu ... et j'ai rien changé de plus )

Par contre, autre souci, ca me tp a 300 m maxi, mon " laboratoroire" est a 700m d'altitude...
le script que j'utilisais était pour du tp longue distance.
Oui, on ne peut téléporter quelqu'un seul qu'à une distance maximale de 300m.
Mais on peut téléporter quelqu'un assit sur un prim à n'importe quelle distance (il ne s'agit plus de téléporter mais de déplacer le prim sur lequel la personne est assise, à la façon d'un véhicule).

Il faudrait que tu nous donne ton premier script TP en totalité, celui du début du post ne l'était qu'en partie.

Merci.
Salut et merci de ta proposition.

je comprends mieux maintenant.

Voice le script de tp longue distance ( tous les scripts que je possède sont de provenance freebies )

Code:
//********************************************************
//This Script was pulled out for you by YadNi Monde from the SL FORUMS at http://forums.secondlife.com/forumdisplay.php?f=15, it is intended to stay FREE by it s author(s) and all the comments here in ORANGE must NOT be deleted. They include notes on how to use it and no help will be provided either by YadNi Monde or it s Author(s). IF YOU DO NOT AGREE WITH THIS JUST DONT USE!!!
//********************************************************
 
 
 
// Long distance teleport version 1.1 by Lisbeth Cohen
// ----------------------------------
//This is something I cooked together from other free scripts found at this forum. Just put it into a prim and sit on it to teleport - pretty standard. If you move the prim you'll have to reset the script so it will remember its new home position.
//Thanks to original authors for their great work and permitting me to publish this!
// This script is based on other public domain free scripts, so I don't
// take credit for any of the work here.
// Bits and pieces combined by Lisbeth Cohen - plus added show/hide.
//
// The basics of the script is based on Till Sterling's simple teleport
// script, with cross sim transportation routine developed by
// Keknehv Psaltery, modified by Strife Onizuka, Talarus Luan and
// Keknehv Psaltery.
// The transportation functionality is based upon Nepenthes Ixchel's
// 1000m Menu-driven Intra-Sim Teleporter
//
// Thank you to authors who have given me permission to publish this script.
// A special thank you to Keknehv Psaltery for suggesting small improvements!
//
// Realeased as public domain - you are NOT allowed to sell it without the
// permissions of all the authors I've credited above (except those who
// may have left sl at the time)!
// Feel free to use it in freebies and to give it to your friends :-)
//
// Please do not take credit for the work of all those great authors
// mentioned above!
// If you edit the script, please do not change the lines above - thanks!
// ------------------------------------------------------------------------
 
//The target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <246, 181, 415>;
// Text for the "pie menu"
string gSitText="Teleport";
// Define channel number to listen to user commands from
integer myChannel = 123;
 
// No need to edit the global variables below
// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// Key for avatar sitting on object, if any
key gAvatarID=NULL_KEY;
// If you don't enable this the teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
 
// This routine do the actual transport
warpPos( vector destpos)
{   //R&D by Keknehv Psaltery, 05/25/2006
    //with a little pokeing by Strife, and a bit more
    //some more munging by Talarus Luan
    //Final cleanup by Keknehv Psaltery
    // Compute the number of jumps necessary
    integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
    // Try and avoid stack/heap collisions
    if (jumps > 100 )
        jumps = 100;    //  1km should be plenty
    list rules = [ PRIM_POSITION, destpos ];  //The start for the rules list
    integer count = 1;
    while ( ( count = count << 1 ) < jumps)
        rules = (rules=[]) + rules + rules;   //should tighten memory use.
    llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
}
default
{
    state_entry()
    {
        // Put the teleport text in place of the Sit in the pie menu
        llSetSitText(gSitText);
        // Read the objects position so it can return to it after teleporting
        gStartPos = llGetPos();
        // Sit the avatar on the object
        llSitTarget(<0,0,1>,ZERO_ROTATION);
        // Define commands to listen for
        llListen(myChannel,"","","");
    }
 
    on_rez(integer startup_param)
    {
        llResetScript();
    }
 
    listen(integer chan, string name, key id, string cmd)
    {
        if (cmd == "show")
        {
            llSetAlpha( 1, ALL_SIDES );
        }
        else if (cmd == "hide")
        {
            llSetAlpha( 0, ALL_SIDES );
        }
        else if (cmd == "reset")
        {
            llResetScript();
        }
        else if (cmd == "help")
        {
            llSay(0, "Usage:");            
            llSay(0, "");            
            llSay(0, "show      Make teleporter visible");            
            llSay(0, "hide      Make teleporter invisible");            
            llSay(0, "reset     Resets teleporter script");            
            llSay(0, "help      This text");            
        }
    }
    changed(integer change){
        if(change & CHANGED_LINK)
        {
            // Find id for avatar sitting on the object
            gAvatarID = llAvatarOnSitTarget();
            // If someone sits on it...
            if(gAvatarID != NULL_KEY)
            {
                // Move avatar to destination
                warpPos(gTargetPos);
                // Pause for 1 second
                llSleep(1);
                // Unsit avatar
                llUnSit(gAvatarID);
                // Wait 1 second more
                llSleep(1);
                // If teleporter should return to original position....
                if (gReturnToStartPos)
                {
                    // ... send object to its start position
                    warpPos(gStartPos);
                }
            }
        }
    }
 
}

Par contre, j'ai regardé la site de ..... un des membres du forum qui a fait un tuto ( je sais plus sont nom dsl ) et j'ai du mal a tout comprendre pour faire mes propres scripts .. j'espère que ca viendra
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés