Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

giving notecard or folder to only one selected avitar

Amy Bechir
Registered User
Join date: 15 May 2008
Posts: 7
04-26-2009 04:28
Hi....I'm really new at trying to get my head around this scripting language..I already have a script to put in my objects that gives a notecard or folder to anyone who touches it. Which is great, but I want to personalise it, especially when I buy presents to pop in my gift boxes..I want it to only give to a certain avitars name and to reject other people that may click on it...Does anyone know how to do this?
Thanks in advance :-)
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-26-2009 04:58
Here is the gist. Maybe you can give out something nicer.

CODE

default
{
touch_start(integer num) {
if (llDetectedName(0) == "Viktoria Dovgal") {
llGiveInventory(llDetectedKey(0), "box of poop");
}
}

}
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
04-26-2009 06:23
From: Viktoria Dovgal
Maybe you can give out something nicer.

I bet it's the best poop in SL
Amy Bechir
Registered User
Join date: 15 May 2008
Posts: 7
04-26-2009 22:55
Great...it worked, minus the poop :P ....but now next question...how do I get it to work on giving a single object?... I tried it with placing an object in the contents..but it just popped up a pic of the script and gave nothing ...I have another script, that I use, but it gives away to anyone...


string folderName = "*SLLC birthday Box*"; // Name of the folder being created for anyone touching the box

list randomMessages = [ "♥HAPPY BIRTHDAY♥",
" Have a great day",
" All the best",
"kisses and hugs" ]; // Random message said into chat on touch

list avoidItems = ["Box Script - SLLC Gift Box","Particle Script - SLLC Gift Box","Kiss"]; // Listed items that we dont want to give away
// End customizing here!

default
{

touch_start(integer total_number)
{
key who = llDetectedKey(0);

llPlaySound("Kiss", 1.0);
llMessageLinked(LINK_SET,100,"open","";);
llInstantMessage(who, llList2String(randomMessages, 0));

integer count;
integer max = llGetInventoryNumber(INVENTORY_ALL);
list itemList;
while(count<max)
{
string itemName = llGetInventoryName(INVENTORY_ALL, count);
if(llListFindList(avoidItems, [itemName]) == -1) itemList += itemName;

++count;
}

if(itemList != [])

randomMessages = llListRandomize(randomMessages,1);

}
}
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-27-2009 02:06
I don't have all the stuff you have, but when I click on the little script icon (you can see the error messages when you do that), it's telling me "Could not find sound 'Kiss'."

Otherwise, the script works for me, except for one little detail!

if(itemList != [])

Should probably be:

CODE

if(itemList != []) {
llGiveInventoryList(who, folderName, itemList);
}


...because the inventory giving part is sort of missing.


(editing to add: this doesn't have the llDetectedName check, just the quick fix)
Amy Bechir
Registered User
Join date: 15 May 2008
Posts: 7
04-27-2009 04:54
ahh sorry it has another script ,this one that adds the particles...pluss has a "kiss sound" in it...yes this script works but will give everyone who touches the box the object I've placed in it...this I don't want to do..I want to add in or change the sript to only allow the person I name to get my object..



default
{
link_message(integer send, integer ch, string msg, key id)
{
if(msg == "open";)
{
llParticleSystem( [
// Appearance Settings
PSYS_PART_START_SCALE,(vector) <0.3,0.3,0>,// Start Size, (minimum .04, max 10.0?)
PSYS_PART_END_SCALE,(vector) <0.6,0.6,0>, // End Size, requires *_INTERP_SCALE_MASK
PSYS_PART_START_COLOR,(vector) <0.5, 0.5, 0.5>, // Start Color, (RGB, 0 to 1)
PSYS_PART_END_COLOR,(vector) <1,1,0>, // EndC olor, requires *_INTERP_COLOR_MASK
PSYS_PART_START_ALPHA,(float) 0.9, // startAlpha (0 to 1),
PSYS_PART_END_ALPHA,(float) 0.3, // endAlpha (0 to 1)
PSYS_SRC_TEXTURE,(string) "26038c11-4b34-e722-be16-a43d73f91ead", // name of a 'texture' in emitters inventory or UUID of an inventory item
// Flow Settings, keep (age/rate)*count well below 4096 !!!
PSYS_SRC_BURST_PART_COUNT,(integer) 1, // # of particles per burst
PSYS_SRC_BURST_RATE,(float) 0.5, // delay between bursts
PSYS_PART_MAX_AGE,(float) 5.0, // how long particles live
PSYS_SRC_MAX_AGE,(float) 8, // turns emitter off after 8 seconds. (0.0 = never)
// Placement Settings
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE,
// _PATTERN can be: *_EXPLODE, *_DROP, *_ANGLE, *ANGLE_CONE or *_ANGLE_CONE_EMPTY
PSYS_SRC_BURST_RADIUS,(float) 0.1, // How far from emitter new particles start,
PSYS_SRC_INNERANGLE,(float) PI/20, // aka 'spread' (0 to 2*PI),
PSYS_SRC_OUTERANGLE,(float) 0.0, // aka 'tilt' (0(up), PI(down) to 2*PI),
PSYS_SRC_OMEGA,(vector) <0,0,2 * PI>, // how much to rotate around x,y,z per burst,
// Movement Settings
PSYS_SRC_ACCEL,(vector) <0,0,-1>, // aka gravity or push, ie <0,0,-1.0> = down
PSYS_SRC_BURST_SPEED_MIN,(float) 1.2, // Minimum velocity for new particles
PSYS_SRC_BURST_SPEED_MAX,(float) 1.2, // Maximum velocity for new particles
//PSYS_SRC_TARGET_KEY,(key) llGetOwner(), // key of a target, requires *_TARGET_POS_MASK
// for *_TARGET try llGetKey(), or llGetOwner(), or llDetectedKey(0) even. :)

PSYS_PART_FLAGS, // Remove the leading // from the options you want enabled:
PSYS_PART_EMISSIVE_MASK | // particles glow
PSYS_PART_BOUNCE_MASK | // particles bounce up from emitter's 'Z' altitude
//PSYS_PART_WIND_MASK | // particles get blown around by wind
//PSYS_PART_FOLLOW_VELOCITY_MASK | // particles rotate towards where they're going
//PSYS_PART_FOLLOW_SRC_MASK | // particles move as the emitter moves
PSYS_PART_INTERP_COLOR_MASK | // particles change color depending on *_END_COLOR
PSYS_PART_INTERP_SCALE_MASK | // particles change size using *_END_SCALE
//PSYS_PART_TARGET_POS_MASK | // particles home on *_TARGET key
0 // Unless you understand binary arithmetic, leave this 0 here. :)
] );
}
}
}