Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

floating text count down

Keiko Doji
Registered User
Join date: 30 Jul 2006
Posts: 23
03-08-2008 11:38
hi all,

i have a problem that i cant seem to solve. i have a prim that displays a counter, which for testing purposes starts at 10 and works down to 0 i have it written so the prim detects the collision from a projectile, once the counter reaches 0 i have the prim alpha out and go phantom.

now my problem is, i have an integer for the actual count down within the script and the way i have it right now is this...

everytime a hit is registered the count goes down by one, and i've manually set it so (very basically)

if count = 10 then the text displayed is 10, if count = 9, the text is 9 and so on...

now my question is this, given that when i finish testing the count wil be 100 and not 10, is there a simpler way to have the floating text display?

i've tried physically displaying the count integer but obviously there's a problem. is there a way to set say a string varible of "displaytext" to equal the count integer?

any help would be apprecitate, thank you
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
03-08-2008 12:03
typecasting is your friend

(string)9
(string)8
(string)countdown_integer
ect
Keiko Doji
Registered User
Join date: 30 Jul 2006
Posts: 23
03-08-2008 12:50
can you explain in a bit more detail, the LSL entry for typecasting doesnt even seem to work, compiling the example gives me a syntax error so i dont know
Incoherendt Randt
Skank
Join date: 13 Dec 2007
Posts: 85
03-08-2008 13:02
This is a really stupid sample but it compiles!
CODE

integer counter = 10;

whine() {
llSetText("I am going to scream after " + (string) counter + " more hits.", <1,1,1>, 1);
}

default
{
state_entry()
{
whine();
}


touch_start(integer numtouches)
{
if (counter > 1) {
counter--;
whine();
}
else {
llSetText("WAHHHHHHHHHH!", <1,0,0>, 1);
}
}

}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-08-2008 13:21
be aware that setting hover text causes a full prim update, which means all it's info gets resent to every person in view range.... doing this often over time, or with many objects can contribute to lag
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Keiko Doji
Registered User
Join date: 30 Jul 2006
Posts: 23
03-08-2008 14:10
thanks for the help, got it running perfectly ^^