|
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
|
12-08-2008 05:13
Hi guys! I'm losing it..this is probably obvious, but I just can't see why this is happening. I click the script, and it's supposed to add the toucher's name to the string..simple, right? I thought so, but oh well. Anybody see why it's adding the name like, 3 times for each click?
string stringlist = ""; string name;
default { state_entry() { llSetText("",<1,1,1>,1); stringlist = ""; }
touch(integer num_detected) { name= llKey2Name(llDetectedKey(0)); stringlist = stringlist + "\n" + name; llSetText(stringlist,<1,1,1>,1); } }
Thanks!
|
|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
12-08-2008 05:30
Try using touch_start instead. I've noticed that touch sometimes returns multiple events.
Also instead of stringlist = stringlist + "\n" + name; use stringlist = (stringlist=[]) + stringlist + "\n" + name; It will save a lot of memory in long lists
|
|
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
|
12-08-2008 05:37
thanks Monica! That worked great..I never had that happen with touch before - I'll be more careful with it!
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
12-08-2008 05:41
From: Monica Balut use stringlist = (stringlist=[]) + stringlist + "\n" + name;It will save a lot of memory in long lists
BTW This voodoo isn't effective or necessary now if the script is compiled to Mono. /esc
_____________________
http://slurl.com/secondlife/Together
|
|
Abraxes Binder
Registered User
Join date: 23 May 2008
Posts: 205
|
12-09-2008 07:54
From: Monica Balut I've noticed that touch sometimes returns multiple events. mm.. touch is meant to return n times -its like 'mouseover&down' eg depending on cpu clock it will fire continously as long as the object in question in touched -at least, that is how i have understood this .. BR ab
_____________________
BR ab
|