Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

find out if someone takes a copy

Corundum Dagger
Registered User
Join date: 21 Jul 2007
Posts: 13
10-23-2007 07:46
Hey everyone!

I am unable to find out how to do this so maybe it isn't possible or maybe I just don't know. But since there is a large chance I just don't know I figured I should ask since I can't find it anywhere.

I am trying to make a counter that counts how many copies have been taken. Is it possible to find out when a user takes a copy of an object?

Thanks a bunch!
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
10-23-2007 07:56
From: Corundum Dagger

I am unable to find out how to do this so maybe it isn't possible or maybe I just don't know. But since there is a large chance I just don't know I figured I should ask since I can't find it anywhere.

I am trying to make a counter that counts how many copies have been taken. Is it possible to find out when a user takes a copy of an object?


If they are taking copies via the "Take Copy" method on the pie menu, or by "Buying" a copy for L$0, then no - these doesn't trigger any script event, and the copy they take appears in their inventory, so the scripts don't run.

The easiest way is just to make a scripted item which gives the user a copy when they left-click on it, and this can then count the number of copies given out.
Rhiannon Boronski
PRIMAL ART OWNER
Join date: 3 Feb 2007
Posts: 220
10-23-2007 07:58
There may well be a different way of doing this, but when I want to see how many and who have taken copies of say a freebie I have on offer I set it for sale at 0L$, it then shows up on my transactions listing on the website if I choose to show 0L$ transactions. Hope this helps, but will be interested to see if anyone has any other possibly easier ways of doing this.
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
10-23-2007 08:54
From: Yumi Murakami
If they are taking copies via the "Take Copy" method on the pie menu, or by "Buying" a copy for L$0, then no - these doesn't trigger any script event
Actually, yes they do. changed( CHANGED_OWNER ) is raised *in the original object* when a copy is taken or purchased. Note that this event will also be raised in the copy the first time it is rezzed by the new owner. See the notes for CHANGED_OWNER here:

lslwiki.net/lslwiki/wakka.php?wakka=changed
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
10-23-2007 13:00
Couldn't you use a fast pay script set to L$0?

This way you could raise a pay event and send an IM or email with the name or key of the person buying. I can't get in world at the moment but I have a script that does exactly that when people buy my products. I get an IM and email with their name and the product bought.

It will even check the amount you are paying and refund if the wrong amount is paid.

I will post a copy as soon as I get in world to find it or IM me for a copy.
_____________________
Tread softly upon the Earth for you walk on my face.
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
10-23-2007 15:26
You can't bring up the pay event for 0 L, it has to be at least 1 L. :/
_____________________
From: someone

Don't worry, Aniam is here!
- Noob
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-23-2007 17:24
Put this in a sign stating; "Touch me to take a copy", along with the object you want to give. You could also just use llSetText in the state_entry.

If someone else touches it then they get thier copy. If you touch it then it will tell you how many copies have been given.

CODE

integer qty_given = 0;
key owner;
key customer;

default
{
state_entry()
{
owner = llGetOwner();
}
touch_start(integer total_number)
{
customer = llDetectedKey(0);
if(customer == owner)
{
llOwnerSay("I have given out " + (string)qty_given + " copies");
}
else
{
llGiveInventory(customer,llGetInventoryName(INVENTORY_OBJECT, 0));
qty_given++;
}
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
10-23-2007 21:13
From: Jesse Barnett
Put this in a sign stating; "Touch me to take a copy", along with the object you want to give. You could also just use llSetText in the state_entry.

If someone else touches it then they get thier copy. If you touch it then it will tell you how many copies have been given.

CODE

integer qty_given = 0;
key owner;
key customer;

default
{
state_entry()
{
owner = llGetOwner();
}
touch_start(integer total_number)
{
customer = llDetectedKey(0);
if(customer == owner)
{
llOwnerSay("I have given out " + (string)qty_given + " copies");
}
else
{
llGiveInventory(customer,llGetInventoryName(INVENTORY_OBJECT, 0));
qty_given++;
}
}
}


you may want to put in this as well...

on_rez (integer foo)
{
llResetScript();
}


that way, if you give the object containing the script away to someone, it'll work for them as well.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-24-2007 03:52
From: Johan Laurasia
you may want to put in this as well...

on_rez (integer foo)
{
llResetScript();
}


that way, if you give the object containing the script away to someone, it'll work for them as well.


With new people that don't really understand scripting yet I don't put the on_rez event in there. Everyone should have at least a basic understanding before they start giving away or selling scripts on OnRez. At least there is a chance they fiddle with a script and make it really inefficient and then when they give it away it won't work for the new owner. Hopefully then they will post it here and we can help them learn to strighten it up and why and in the process point out on_rez.

Heehee. Who knows it might be twisted logic but O well.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum