Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Counters on Avatars

Jessica Ingmann
Lv. 23 Batcase
Join date: 8 Oct 2005
Posts: 35
10-08-2005 16:18
Yo.

I was wondering. . . Is there a way to make and update a counter on an avatar? For example, instead of taking up a million spaces of inventory, I want to make it so when someone picks up an item, it gets counted in a little counter only they have. Even if it's just through a No Modify note or something, I just need to know if this works. In case you're wondering, it's basically similar to the idea of coins in Super Mario Bros. games, or even Second Life's own Lindens(L$) system.(No, I'm not going to try and circulate a new currency. This is just for the Hell of it.)
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
10-08-2005 17:30
Only if they're wearing a scripted object for that purpose.
_____________________
</sarcasm>
Jessica Ingmann
Lv. 23 Batcase
Join date: 8 Oct 2005
Posts: 35
10-08-2005 18:07
Can you possibly give me a quick tutorial on making such things? That'd work perfectly, and I figure it'd help me get aquainted with "if"/"else if" commands, too.
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
10-08-2005 23:07
Create a listen event on a seperate channel, use the device you want to add numbers to people to speak on that channel and say a command and the name of the person you want added to. Parse that message in the wearable script.

For more on LSL, check this out.
_____________________
</sarcasm>
Jessica Ingmann
Lv. 23 Batcase
Join date: 8 Oct 2005
Posts: 35
10-09-2005 05:05
Alright, not to sound utterly stupid, but. . .I honestly did not understand what you meant, Satyr. I mean, I did, and yet did not. Can you give a bit more of an explaination by chance? Specific commands if you want, would be real nice and save me some hunting time.(I'm new to LSL, but I pick stuff up quickly.)
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
10-09-2005 07:10
CODE

list Stuff = [];
integer counter = 0;

default
{

state_entry()
{
llListen(5,"","","");
}
listen(integer channel, string name, key id, string message)
{
Stuff = llParseString2List(message,[" "],[]);
if((llList2String(Stuff,0) == "add") && (llList2String(Stuff,1) + " " + llList2String(Stuff,2)) == llKey2Name(llGetOwner()))
{
counter += 1;
}
}
touch_start(integer num_detected)
{
llSay(0,(string)counter);
}
}


CODE

default
{
touch_start(integer total_number)
{
llSay(5, "add " + llDetectedName(0));
}
}
_____________________
</sarcasm>
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
10-09-2005 12:27
I'd also suggest using a negative chat channel, that way people can't "cheat" by saying it on the channel, I mean they could use scripts to "cheat" but at least it's a bit harder ;)
Jessica Ingmann
Lv. 23 Batcase
Join date: 8 Oct 2005
Posts: 35
10-10-2005 04:25
That's pretty much the same code my friend gave to me. Unfortunately, I forgot to reply back to this post and state that my question had been answered. Sorry. ^_^; Still, thanks a lot for your help! I really appreciate it and hope to recieve more later on when I have more Scripting questions.