Jump to content

Is there a script that does this?


Prokofy Neva
 Share

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

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

Recommended Posts

Records how many times you touch the prim it is in.

I don't mean a visitor recorder that captures avatars.

Or a script that records that an avatar touched it and gives you that avatar's name.

I mean a script that an avatar uses to keep a record of number of times, like an MTA administrator counting buses that go by with a clicker.

So the avatar clicks on the prim once, 10 more times, 3 more times, and the script will be able to tell you "touched 14 times". Perhaps daily.

Even better, if the avatar could type in chat "$10" or "$25" and the script could calculate this and keep a running tab, so it would work as a simple ledger, so you type "10" then "25" then "15" and it keeps adding, showing a total of "$50".

Is there any script that does this, and are these functions that LSL can even do?

Link to comment
Share on other sites

integer gCounter;default{    touch_start(integer num)    {        ++gCount;        llRegionSayTo(llDetectedKey(0),"This object has been touched " + (string)gCounter + " times.");    {}

About as simple as they get.  You can add bells and whistles to make it fancier, but this is your MTA traffic counter's clicker.

 

 

Link to comment
Share on other sites

Just a note of thanks to another scripter, Scaler Rexen, who put together the two ideas of both recording the number of touches AND of enabling the chatting of numbers that then add up. He contacted me inworld and went through several iterations.

Here is the script:

key owner;integer moneySpent;string salt = "$"; // prefix before datainteger count;init(){    owner = llGetOwner();    llOwnerSay("Click and type an amount first with a dollar sign like this $10 to record your item purchase!");    llListen(0,"",owner,"");    }track(string text){    if(llGetSubString(text,0,llStringLength(salt)-1) == salt)    {        integer add = (integer)llGetSubString(text,1,-1);        llOwnerSay("You spent L$"+(string)add+" on a item.");        moneySpent += add;    }}default{    on_rez(integer p)    {        if(llGetObjectDesc() == "" || llGetObjectDesc() != (string)llGetOwner())        {            llSetObjectDesc((string)llGetOwner());            llOwnerSay("New resident detected..");            llResetScript();        }    }    state_entry()    {        init();    }    touch_start(integer t)    {        key id = llDetectedKey(0);        if(id == owner)        {            ++count;            llOwnerSay("You've added another item to your purchase count. [Lifetime: You've spent L$"+(string)moneySpent+" on a total of "+(string)count+" items!]");        }    }    listen(integer channel, string name, key id, string msg)    {        track(msg);    }}

 

I'm making a thing with this -- it's a long story, but when I'm done I'll post it. 

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...