[Aide] Je vous demande votre aide pour un script

Répondre
Partager Rechercher
bonsoir a tous j'ai un script que j'ai trouves sur se forum qui fait un volet rouler avec un bouton avec une fasse transparent je voudrai savoir si c possible de utiliser en porte mais en touchant la porte est qui et pas cet partie transparent si possible parce que sinon il faut mètre la porte en fantôme texture ainsi qu'on puisse changer la texture je vous met le script dessous merci de vos réponse
PS: je débute en script donc j'ai beaucoup de mal
Code:
integer Channel_Syn_Channel;
integer Reset_Syn_Channel;
string  Channel_User;
float   X;
float   Y;
float   Z;
key UUID_Shuter = "e5f7ea6d-ce87-edc9-ea39-7d658c73ff1c" ; /// UUID à replacer ICI
string Shutter;
Motor (string action)
{
// Methode testée  et retenue prim fixe  gestion de la texture un petit flash à la fin 
// mais le resultat  est très satisfaisant.
//
// l'image est composée de 2 zones 1 pleine  1 transarente 
// l'astuce a été  d'affichée au départ la zone pleine  (volet fermé ) et de deplacer l'image vers la zone transparente
// ou vice et versa  zone transparente vers zone pleine
// en fin d'animation on affiche la partie pleine or transparente en jouant de l'offset...     
// on synchronise les timing sleep & animation ...
    if  ( action == "DOWN"  &  Shutter == "OPENED")  
    {
        llSetTextureAnim(ANIM_ON  | SMOOTH | LOOP | REVERSE, ALL_SIDES , 2, 2, 1, 1, -0.25);        
        llSleep(4);
        llSetTextureAnim(FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0);  // stop l'animation
 
        llSetPrimitiveParams([  PRIM_TEXTURE, 
                                ALL_SIDES, 
                                UUID_Shuter,  // image 2 zones
                                <.5,1.0,0.0>,   //   1/2 image
                                <0.25,0.0,0.0>, //   offset    
                                PI_BY_TWO ]);  
        Shutter = "CLOSED";
    }
    else if (action == "UP"  & Shutter == "CLOSED") 
    {
 
        llSetTextureAnim(ANIM_ON  | SMOOTH | LOOP | REVERSE, ALL_SIDES , 2, 2, 1, 2, 0.25);        
        llSleep(4);
        llSetTextureAnim(FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0); // stop l'animation
 
        llSetPrimitiveParams([  PRIM_TEXTURE, ALL_SIDES, UUID_Shuter,
                                <.5,1.0,0.0>, <0.75,0.0,0.0>,PI_BY_TWO]);  
        Shutter = "OPENED"; 
    }
 
}
 
default
{
    on_rez(integer param)
    {   
        llResetScript();// Force the reset on rez.
    }
    state_entry()
    {           
        // Size  prim // >>>>>>>>>>>>A PARAMETRER  
        X =  8.700;      
        Y =  0.010;      
        Z =  7.068;    
 
        llSetScale ( < X,Y,Z > );
 
 
 
        llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, UUID_Shuter,
                          <.5,1.0,0.0>, <0.75,0.0,0.0>,PI_BY_TWO]);  // volet ouvert
 
        Shutter = "OPENED"; // status volet....  
 
 
        Channel_Syn_Channel = -1000;   //  canal de reception du channel  de com qui va être utilisé
        Reset_Syn_Channel   = -1010;   //  canal sortant pour indiqué au HUD  que l'on désire connaitre le cannal à utilisé 
 
        llListen(Channel_Syn_Channel, "", "", ""); // on est pret à recevoir le cannal de comm à utilisé 
 
        llSay (Reset_Syn_Channel, "ASK_SYNC");   // on demande le canal....          
    }
 
 
    listen( integer channel, string name, key id, string message )
    {
        if (channel == Channel_Syn_Channel)  
        {
            llListen((integer) message, "", "", ""); // Le message du HUD contient le ou LES CANAUX à utilisé
            llOwnerSay ("Synchro done with the HUD");// C'est gràce à cela que les volet pourront être  piloté par plusieurs HUD....        
        }
        else 
            Motor( message );  // Action!!
    }
}
bonsoir a tous j'ai un script que j'ai trouves sur se forum qui fait un volet rouler avec un bouton avec une fasse transparent je voudrai savoir si c possible de utiliser en porte mais en touchant la porte est qui et pas cet partie transparent si possible parce que sinon il faut mètre la porte en fantôme texture ainsi qu'on puisse changer la texture je vous met le script dessous merci de vos réponse
PS: je débute en script donc j'ai beaucoup de mal

Je crois que ça veut dire :
Bonsoir,
J'ai trouvé sur ce forum un script de volet roulant qui s'active via un bouton transparent et je voudrais savoir s'il est possible de le faire pour une porte, avec activation par clic directement sur la porte, parce que sinon je suis obligé de mettre la porte en fantôme.... la suite je ne sais pas trop...

En fait tu veux un script pour ouvrir et fermer une porte sans être obligé de la mettre en objet fantôme ?
C'est ça que tu voudrais ?
Il faut que tu essaies de faire un petit effort quand tu écris, parce qu'on a beaucoup de mal à te comprendre...
Tire la langue
je crois comprendre
en fait, le volet roulant est un prim, avec une texture couper en deux, la moitié est transparente et l autre moitié represente un volet roulant, donc au start on demande un décalage de la texture vers le haut puis on passe le prim en fantome pour laisser le passage, est ce bien ca ?
Oui c'est exactement ça Dave. Bon j'ai mieux à proposer: j'ai un volet roulant (full perm y compris script) dans mon inventaire qui fonctionne en diminuant la dimension du prim. Ce sera plus approprié pour ce cas là. Je t'envoie ça ce soir Demoss; si tu me contacte ou que je tu me donne ton nom d'avatar.

Edit: voilà le script que j'ai; il ya sans doute des choses inutiles mais si ça te va dans le principe on le nettoyera
Code:
integer steps = 20;

string secondOwner = "";  
integer object_id;
integer configchannel;
list blacklist;
string lastQuestion = "";
string lastPerson = "";

integer openListener = 0;

vector storedPos;
vector storedSize; 

integer Closed = TRUE;

OpenBlinds()
{
    if (!Closed)
    {
        return;
    }
    llOwnerSay("Open blinds");
    
    storedPos = llGetPos();
    storedSize = llGetScale();
    
    float stepsize = (storedSize.z - 0.1) / steps;
    vector currentSize = storedSize;
    vector currentPos  = storedPos;
    while(currentSize.z > 0.1)
    {
        currentSize.z -= stepsize;
        if (currentSize.z < 0.1)
        {
            currentSize.z = 0.1;
        }
        currentPos.z = storedPos.z + ((storedSize.z - currentSize.z)/2);
        llSetScale(currentSize);
        llSetPos(currentPos);
        
    }
    Closed = FALSE;
}

CloseBlinds()
{
    if (Closed)
    {
        return;
    }
    
    llOwnerSay("Close blinds");
    
    float stepsize = (storedSize.z - 0.1) / steps;
    vector currentSize = llGetScale();
    vector currentPos  = llGetPos();
    
    while (currentSize.z < storedSize.z)
    {
    
        currentSize.z += stepsize;
        if (currentSize.z > storedPos.z)
        {
            currentSize.z = storedPos.z;
        }
        currentPos.z = storedPos.z + ((storedSize.z - currentSize.z)/2);
        llSetScale(currentSize);
        llSetPos(currentPos);
    }
    
    llSetScale(storedSize);
    llSetPos(storedPos);
    
    Closed = TRUE;
}


default
{
    state_entry()
    {
        configchannel = llRound(llFrand(2000000000));
        object_id = (integer) llGetObjectDesc();
        llListen(object_id, "", NULL_KEY, "");
        llListen(configchannel, "", NULL_KEY, "");
    }
    
    touch_start(integer num)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            llDialog(llGetOwner(),"Owner Menu",["SecondOwner","BlackList","-","Open","Close","-"],configchannel);
            return;
        }
        
        if (llDetectedName(0) == secondOwner)
        {
            llDialog(llDetectedKey(0),"Second Owner Menu",["-","BlackList","-","Open","Close","-"],configchannel);
            return;
        }
        
        integer pos = llListFindList(blacklist,[llDetectedName(0)]);
        if (pos == -1)
        {
            pos = llListFindList(blacklist, ["*"]);
            if (pos == -1)
            {
                llDialog(llDetectedKey(0),"User Menu",["-","-","-","Open","Close","-"], configchannel);
            }
            
        }
        return;
    }
    
    listen(integer channel, string name, key id, string message)
    {
        // Open chat channel messages //
        if (channel == 0)
        {
            if (id == llGetOwner())
            {
                if (lastQuestion == "secondOwner")
                {
                    lastQuestion = "";
                    secondOwner = message;
                    llInstantMessage(llGetOwner(), "Second owner set to: "+secondOwner);
                    llListenRemove(openListener);
                    openListener = 0;
                    llDialog(llGetOwner(),"Send second owner to all blinds?", [" Yes", "No"],configchannel);
                    return;
                }
            }    
            
            if (id == llGetOwner() || id == secondOwner)
            {
                if (lastQuestion == "BlacklistAdd")
                {
                    lastQuestion = "";
                    integer pos2 = llListFindList(blacklist, [message]);
                    if (pos2 == -1)
                    {
                        blacklist += message;
                        llInstantMessage(id, "Added: "+message+" to the blacklist");
                        llListenRemove(openListener);
                        openListener = 0;
                        lastPerson = message;
                        llDialog(id, "Send add to blacklist to all blinds?", ["Yes add", "No"], configchannel);
                    }
                    
                }
                
                if (lastQuestion == "BlacklistRemove")
                {
                    lastQuestion = "";
                    integer pos2 = llListFindList(blacklist, [message]);
                    if (pos2 > -1)
                    {
                        blacklist = llDeleteSubList(blacklist, pos2, pos2);
                        llInstantMessage(id, "Removed: "+message+" from the blacklist");
                        llListenRemove(openListener);
                        openListener = 0;
                        lastPerson = message;
                        llDialog(id, "Send remove from blacklist to all blinds?", ["Yes remove", "No"], configchannel);
                    }
                    
                }
                
            }
            return;
        }

        // Messages from other blinds //
        if (channel == object_id && llGetOwner() == llGetOwnerKey(id))
        {            
            list templist = llParseString2List(message, [";"], []);
            if ("secondOwner" == llList2String(templist,0))
            {
                secondOwner = llList2String(templist,1);
            }
            
            if ("addBlack" == llList2String(templist,0))
            {
                integer pos2 = llListFindList(blacklist, [llList2String(templist,1)]);
                if (pos2 == -1)
                {
                    blacklist += llList2String(templist,1);
                }
            }
            
            if ("removeBlack" == llList2String(templist,0))
            {
                integer pos2 = llListFindList(blacklist, [llList2String(templist,1)]);
                if (pos2 > -1)
                {
                    llOwnerSay("removing from blacklist: "+(string) pos2);
                    blacklist = llDeleteSubList(blacklist,pos2,pos2);
                }
            }
            
            if ("OpenBlinds" == llList2String(templist,0))
            {
                OpenBlinds();
            }
            
            if ("CloseBlinds" == llList2String(templist,0))
            {
                CloseBlinds();
            }
                        
            return;
        }
        
        // Normal config messages owner only //
        if (id == llGetOwner() && channel == configchannel)
        {
            if (message == "SecondOwner")
            {
                llSetTimerEvent(60);
                openListener = llListen(0,"",llGetOwner(),"");
                llInstantMessage(id, "Enter the name of the second owner in the chat");
                lastQuestion = "secondOwner";
            }
            
            if (message == " Yes")
            {
                llRegionSay(object_id, "secondOwner;"+secondOwner);
            }
        }
        
        // Normal config messages owner and second owner only //
        if ((id == llGetOwner() || id == secondOwner) && channel == configchannel)
        {
            if (message == "BlackList")
            {
                llDialog(id, "BlackList menu.", ["Add BlackList", "Remove BlackList"], configchannel);
            }
            
            if (message == "Add BlackList")
            {
                llSetTimerEvent(60);
                openListener = llListen(0,"",NULL_KEY,"");
                llInstantMessage(id, "Enter the name of the person to be added to the blacklist in the chat");
                lastQuestion = "BlacklistAdd";
            }

            if (message == "Remove BlackList")
            {
                llSetTimerEvent(60);
                openListener = llListen(0,"",NULL_KEY,"");
                llInstantMessage(id, "Enter the name of the person to be removed from the blacklist in the chat");
                lastQuestion = "BlacklistRemove";
            }
            
            if (message == "Yes add")
            {
                llRegionSay(object_id, "addBlack;"+lastPerson);
            }
            
            if (message == "Yes remove")
            {
                llRegionSay(object_id, "removeBlack;"+lastPerson);
            }
            
        }
        
        // All functions from here on might be black listed
        
        if (id != llGetOwner() && id != secondOwner)
        {
            integer pos3 = llListFindList(blacklist,[name]);
            if (pos3 > -1)
            {
                return;
            }
            
            pos3 = llListFindList(blacklist, ["*"]);
            if (pos3 > -1)
            {
                return;
            }
                
        }
        
        if (message == "Open")
        {
            OpenBlinds();
            llDialog(id, "Open all blinds?", ["Yes open", "No"], configchannel);
        }    
        
        if (message == "Close")
        {
            CloseBlinds();
            llDialog(id, "Close all blinds?", ["Yes close","No"], configchannel);
        }
        
        if (message == "Yes close")
        {
            llRegionSay(object_id, "CloseBlinds");
        }
        
        if (message == "Yes open")
        {
            llRegionSay(object_id, "OpenBlinds");
        }

    }
    
    timer ()
    {
        llListenRemove(openListener);
        openListener = 0;
    }
}
Répondre

Connectés sur ce fil

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