|
Kain Commons
Registered User
Join date: 27 Apr 2006
Posts: 1
|
05-01-2006 21:27
I need help. i wanna be able to change a color via a command like
color 1,1,1
to change something to white..
or color 1,1,0
to yellow.. get my drift?
specificly i have 23 prims linked.. each one i wanan change on command
so say prim 12 and 14 are left arm and right arm.. i wanan change them both to red
so id go.. leftarm 1,0,0 or even arms 1,0,0
can someone please help me with this?
for the most part i dont know how to get it to listen to the 3 digits and apply them to llSetLinkColor....
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
05-01-2006 22:30
|
|
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
|
05-01-2006 22:30
Well, listen will return what's said as a string, so you'll want to break that up using llParseString2List. Then you can grab the individual units out of the list and cast them back to whatever type you need.  Here's a quick and dirty example that doesn't do any sort of error checking at all: parsemessage( string msg ) { // Chop up the incoming string into a list, // splitting at (and discarding) spaces. list commandlist = llParseString2List( msg, [" "], [""] ) ; string command1 = llList2String( commandlist, 0 ) ; string command2 = llList2String( commandlist, 1 ) ; // Check the first word spoken to see if it's the right command. if( command1 == "color" ) { // Take the second item spoken, and make it look like a vector. // It starts out looking like "1,0,0", so we add < > around it. command2 = "<" + command2 + ">" ; // Cast that into a vector. vector newcolor = (vector)command2 ; // Apply it! llSetColor( newcolor, ALL_SIDES ) ; } }
default { state_entry() { llListen( 3, "", llGetOwner(), "" ) ; } listen( integer chan, string name, key id, string msg ) { parsemessage( msg ) ; } }
_____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
|