Ouverture de porte

Répondre
Partager Rechercher
Bonjour
J'ai ma maison sur mon terrain et systématiquement quand j'y passe je trouve la porte ouverte, le volets fermés, etc...
Existe-t-il une façon de verrouiller la porte ou faire en sorte que seul moi puisse l'ouvrir ?
C'est une porte basic avec un script de Linden.
D'avance merci
Bonsoir Olivier,

Si ta porte est modifiable et le script aussi, alors oui. Mais ça n'empéchera pas les squatteurs de s'y téléporter.
Si tu désires le modifier, mets le sur le forum création, de bonnes âmes t'aideront à l'améliorer (en plus c'est pas très difficile).
Voici le script :

// If door is locked, the name of the avatar who locked it.
// If door is not locked, the empty string ("").
string gLockedBy = "Olivier Beresford";

// This number must match the channel number of the lock
// and unlock objects you want to use. If multiple doors
// have the same channel, then a single lock can lock all of
// them at once.
integer gLockChannel = 243;

default
{
state_entry()
{
llSay(0, "Door 1.0");
llListen(gLockChannel, "", NULL_KEY, "");
state closed;
}
}

state closed
{
listen(integer channel, string name, key id, string message)
{
if (channel == gLockChannel)
{
if (message == "")
{
gLockedBy = "";
//llTriggerSound("door unlock", 10.0);
llSay(0, "unlocked");
}
else
{
gLockedBy = message;
//llTriggerSound("door lock", 10.0);
llSay(0, "locked");
}
}
}

touch_start(integer total_number)
{
string name = llDetectedName(0);
if (name == gLockedBy || gLockedBy == "")
{
// llTriggerSound("Door open", 0.5);

rotation rot = llGetRot();
rotation delta = llEuler2Rot(<0,0,PI/3>);
rot = delta * rot;
llSetRot(rot);
llSleep(0.25);
rot = delta * rot;
llSetRot(rot);
state open;
}
else
{
// llTriggerSound("Door knock", 0.5);
}
}
}

state open
{
touch_start(integer num)
{
// llTriggerSound("Door close", 0.5);

rotation rot = llGetRot();
rotation delta = llEuler2Rot(<0,0,-PI/3>);
rot = delta * rot;
llSetRot(rot);

llSleep(0.25);
rot = delta * rot;
llSetRot(rot);

state closed;
}
}
J'ai le même script et il fonctionne parfaitement...

Je colle le code ci-dessous, au cas où...

Bon courage

Code:
 // If door is locked, the name of the avatar who locked it.
 // If door is not locked, the empty string ("").
 string gLockedBy = "Sophie Pascale";
 
 // This number must match the channel number of the lock
 // and unlock objects you want to use.  If multiple doors
 // have the same channel, then a single lock can lock all of
 // them at once.
 integer gLockChannel = 243;
 
 default
 {
 	state_entry()
 	{
 		llSay(0, "Door 1.0");
 		llListen(gLockChannel, "", NULL_KEY, "");
 		state closed;
 	}
 }
 
 state closed
 {
 	listen(integer channel, string name, key id, string message)
 	{
 		if (channel == gLockChannel)
 		{
 			if (message == "")
 			{
 				gLockedBy = "";
 				//llTriggerSound("door unlock", 10.0);
 				llSay(0, "unlocked");
 			}
 			else
 			{
 				gLockedBy = message;
 				//llTriggerSound("door lock", 10.0);
 				llSay(0, "locked");
 			}
 		}
 	}
 	
 	touch_start(integer total_number)
 	{
 		string name = llDetectedName(0);
 		if (name == gLockedBy || gLockedBy == "")
 		{
 			llTriggerSound("Door open", 10.0);
 	   
 			rotation rot = llGetRot();
 			rotation delta = llEuler2Rot(<0,0,PI/4>);
 			rot = delta * rot;
 			llSetRot(rot);
 			llSleep(0.25);
 			rot = delta * rot;
 			llSetRot(rot);
 			state open;
 		}
 		else
 		{
 			llTriggerSound("Door knock", 10.0);
 		}
 	}
 }
 
 state open
 {
 	touch_start(integer num)
 	{
 		llTriggerSound("Door close", 10.0);
 			  
 		rotation rot = llGetRot();
 		rotation delta = llEuler2Rot(<0,0,-PI/4>);
 		rot = delta * rot;
 		llSetRot(rot);
 		
 		llSleep(0.25); 
 		rot = delta * rot;
 		llSetRot(rot);
 		
 		state closed;
 	}
 }
A ce propos, j'ai trouvé et intégré un script de porte standard qui fait qu'une porte pivote à 90° sur un axe central quand on fait 'touch'...

Le pb, c'est que personne ne pense à faire à nouveau 'touch' pour les fermer, donc less portes sont tj en position perpendiculaire par rapport à leur axe de fermeture. C'est drôle mais bon...

si j'ai bien compris en intégrant llset pos au script, elles se refermeraient ?

Le truc, c'est que (j'avoue...) je ne sais pas comment ni où intégrer cette ligne, et surtout comment faire pour ajouter un délai de 30 s par exemple avant la fermeture ?

Merci par avance, les champions, si vous avez des réponses là dessus !

Répondre

Connectés sur ce fil

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