Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Door - personal message?

Cat Fratica
Miaow...
Join date: 28 Dec 2006
Posts: 153
02-19-2007 07:06
Hi SL people - I have fiddled a bit with my door script and changed a few bits but have no idea how to do this...

The door usually says: 'persons name' is at the door - I want it to say a personal message if one named person is at the door, so need a line or 2 of script that says, for example: If [person at door is 'best friend'] Say: "You're always welcome here best friend"

Get the idea? Have I explained it OK? Any help appreciated - here's the existing script:

-----

integer open(string av_name) // Opens the door.
{
if (open_sound != "";)
llTriggerSound(open_sound, 0.5);
if (open_message != "";)
llSay(0, replace(open_message,"nn",av_name));
// vv Replace this snippet with custom code to close the door vv
rotation rot = llGetRot();
rotation delta = llEuler2Rot(<0,0,-PI/4>;);
rot = delta * rot;
llSetRot(rot);
llSleep(0.25);
rot = delta * rot;
llSetRot(rot);
// ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
return TRUE;
}

-----

Thanks

Cat x
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-19-2007 08:07
Cat, Please use PHP tags when posting code. It make sit far easier for everyone to read.

I am assuming open_message is a string defined as "nn is at the door."

The 'easy' option, which is also the most limited in functionality, would be to code up something like the following:-

CODE

string BestFriendsName = "Newgate Ludd";
string IsBestFriend = "You're always welcome here ";

integer open(string av_name) // Opens the door.
{
if (open_sound != "")
llTriggerSound(open_sound, 0.5);

if(av_name == BestFriendsName)
{
llSay(0, IsBestFriend + av_name);
}
else if (open_message != "")
llSay(0, replace(open_message,"nn",av_name));

// vv Replace this snippet with custom code to close the door vv
rotation rot = llGetRot();
rotation delta = llEuler2Rot(<0,0,-PI/4>);
rot = delta * rot;
llSetRot(rot);
llSleep(0.25);
rot = delta * rot;
llSetRot(rot);
// ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
return TRUE;
}


The problem with the above code is that you woudl need to edit the script each time you changed best friends....
Daisy Rimbaud
Registered User
Join date: 12 Oct 2006
Posts: 764
02-19-2007 08:21
But I wouldn't count that as a big problem unless you change best friends twice a day. The name is right up there at the top of the script. How hard can it be to change that?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-20-2007 02:03
From: Daisy Rimbaud
But I wouldn't count that as a big problem unless you change best friends twice a day. The name is right up there at the top of the script. How hard can it be to change that?



I didnt say it was big problem Daisy, just a problem. I hate having to recompile scripts for any reason that is purely to do with configuration. I'd rather add extra code to handle a notecard.