Jump to content

Is there a script to view how many people have interacted with an object?


You are about to reply to a thread that has been inactive for 612 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I rented a market stall to advertise my art commissions and included a simple script box to give out a notecard with my commission information on it, I was wondering if there’s some sort of script that can see how many people have interacted with the object? Or how many people have picked up my note card? I want to see track how affective my stall is in gathering interest.

Link to post
Share on other sites

i made a simple mod of the wiki script here:  http://wiki.secondlife.com/wiki/INVENTORY_NOTECARD

//Give a notecard to anyone touching this object

integer total;

default
{
    state_entry()
    {
        // when script resets read total 
        total = (integer)llGetObjectDesc();

    }

    touch_start(integer total_number)
    {
        // get the UUID of the person touching this object
        key user = llDetectedKey(0);
        // give them the first notecard found in the object's contents
        llGiveInventory(user, llGetInventoryName(INVENTORY_NOTECARD, 0));
        
        if (user != llGetOwner()) // don't count touches by the owner
        { 
           // add 1 to the total of people who have touched the object
           total++;
           // save the new total to object description
           llSetObjectDesc((string)total);
        }
    }
}

to know how many people have touched the object, Edit or Inspect the object and read the total in the Object Description field

Link to post
Share on other sites
 
 
1
3 hours ago, Mollymews said:

i made a simple mod of the wiki script here:  http://wiki.secondlife.com/wiki/INVENTORY_NOTECARD

Edited your mod to report the number of interactions to the owner on touch:
 

//Give a notecard to anyone touching this object

integer total;

default
{
    state_entry()
    {
        // when script resets read total 
        total = (integer)llGetObjectDesc();

    }

    touch_start(integer total_number)
    {
        // get the UUID of the person touching this object
        key user = llDetectedKey(0);
        // give them the first notecard found in the object's contents
        llGiveInventory(user, llGetInventoryName(INVENTORY_NOTECARD, 0));
        
        if (user == llGetOwner()) // If owner touches the object...
        { 
           // Report how many people were given a notecard.
           llOwnerSay("So far, "+(string)total+" people were offered a notecard.");
        } else { // ... if the user is anyone other than the owner.
		   // add 1 to the total of people who have touched the object
           total++;
           // save the new total to object description
           llSetObjectDesc((string)total);
		}
    }
}

 

  • Like 1
  • Thanks 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 612 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...