|
Bodhisatva Paperclip
Tip: Savor pie, bald chap
Join date: 12 Jan 2007
Posts: 970
|
06-28-2008 13:48
I've been Frankensteining around with some scripts in an attempt to get a prim to play a series of bird songs when touched and at the same time display the name of the bird above the prim. It's sort of working. The sound files are cycling just fine and are named tweet1, tweet2, etc. and correspond in order to the bird names listed below. But when I touch the prim it plays the first call with the second bird name, then the second call with the third bird name, then the third call with the fourth bird name, and finally the fourth call with no text at all. I'm guessing it's some mathematical error in defining some integer but I've reached the limit of my ability at this point and am frankly shocked I got this far! Thanks for any help or insight you can share. integer birdie = 1; integer tweetnum = 4; list birdnames =[ "Cardinal", "Cetis Warbler", "Hermit Thrush", "Song Sparrow" ];
default { touch_start(integer total_number) { if (birdie < tweetnum) { birdie++; } else birdie = 1; llPlaySound("tweet"+(string)birdie, 4); llSetText(llList2String(birdnames, birdie), <0,0,0>, 1.0); } }
_____________________
I've trademarked the apostrophe. You're in trouble but you are not. 
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
06-28-2008 13:57
I have a feeling this has to do with the fact that list indexing starts with zero, not one.
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Bodhisatva Paperclip
Tip: Savor pie, bald chap
Join date: 12 Jan 2007
Posts: 970
|
06-28-2008 14:28
Thank you!! I didn't know it started at zero. I inserted empty quotes at the top of my name list and now it works perfectly! Thanks! integer birdie = 1; integer tweetnum = 4; list birdnames =[ "", "Cardinal", "Cetis Warbler", "Hermit Thrush", "Song Sparrow" ];
default { touch_start(integer total_number) { if (birdie < tweetnum) { birdie++; } else birdie = 1; llPlaySound("tweet"+(string)birdie, 4); llSetText(llList2String(birdnames, birdie), <0,0,0>, 1.0); } }
_____________________
I've trademarked the apostrophe. You're in trouble but you are not. 
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
06-28-2008 14:30
EDIT: NVM lol what i was about to type in
|