Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need: Notegiver script only for specific people.

Kismet Muromachi
teh kizzurps
Join date: 27 Mar 2005
Posts: 24
06-07-2005 00:36
I was wondering if someone could post a script that would give a note only to a specific person i specify.

Like i could leave notes in a object, and only my girl can recieve the note by clicking it.

I have a regular notcard giving script.. what do i need to add to it to make it so only specific people can get it that I specify who can..

CODE
default
{
state_entry()
{
llWhisper(0, "Note-Giver");
llAllowInventoryDrop(TRUE);
}

touch_start(integer total_number)
{
key giver;
giver = llDetectedKey(0);
string name = llDetectedName(0);

if (giver != NULL_KEY) {
integer InvNum;
string NoteName;
integer NumCards = llGetInventoryNumber(INVENTORY_NOTECARD);
for ( InvNum = 0; InvNum < NumCards; InvNum++) {
NoteName = llGetInventoryName(INVENTORY_NOTECARD, InvNum);
llGiveInventory(giver, NoteName);
}
}
}
}



Please respond quickly.. this is urgent.. I can't say why but it's imperative that I get this asap. I need to write a private note because I may not get a chance to anytime soon.
Talan Mackenzie
The Rocketeer
Join date: 15 Aug 2004
Posts: 14
06-07-2005 01:02
CODE

string GIRLFRIEND = "put her name here";
default
{
state_entry()
{
llWhisper(0, "Note-Giver");
llAllowInventoryDrop(TRUE);
}

touch_start(integer total_number)
{
key giver;
giver = llDetectedKey(0);
string name = llDetectedName(0);

if (name == GIRLFRIEND) {
integer InvNum;
string NoteName;
integer NumCards = llGetInventoryNumber(INVENTORY_NOTECARD);
for ( InvNum = 0; InvNum < NumCards; InvNum++) {
NoteName = llGetInventoryName(INVENTORY_NOTECARD, InvNum);
llGiveInventory(giver, NoteName);
}
}
}
}


Try that. Basically, now it checks the name of the toucher, and compares it to the prestored GIRLFRIEND string. If they're the same, it hands over the goods.
Talan Mackenzie
The Rocketeer
Join date: 15 Aug 2004
Posts: 14
Oh, and
06-07-2005 01:03
Its case-sensative. That means you gotta capitalize her name exactly the way it appears in game. Exactly. Good luck.
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
06-07-2005 11:49
If you don't want to have to capitalize, replace the line "if (name == GIRLFRIEND) {" with "if (llToLower(name) == llToLower(GIRLFRIEND)) {". It adds a couple extra steps, but they won't affect script execution noticably.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog