|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
06-19-2008 17:32
i havent used this funtion before and im having alittle stupidity problems with using it, im trying to make a type of hud that will play animations that are in the inventory of the object but i keep having errors after it, you do the command !zap! (avatar name) and it will requestion permision to use the animation and if it dose it will play the animation to that avatar string name; default { state_entry() { llListen(0,"",llGetOwner(),""); } listen( integer channel, string name, key id, string message ) { list command = llParseString2List(message, [" "], []); if(llList2String(command, 0) == "!zap!") { name = llList2String(command, 1); llSensor("", NULL_KEY, AGENT, 96, PI); } } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { integer animationz = llGetInventoryType(INVENTORY_ANIMATION);// errors llStartAnimation(animationz); } } sensor(integer num) { integer x; integer good = FALSE; for(x=0;x<num;x++) { string detectname = llToLower(llDetectedName(x)); if(llSubStringIndex(detectname, name) == 0) { llWhisper(0,llKey2Name(llGetOwner()) + " Zaps "+ llKey2Name(llDetectedKey(0))); llRequestPermissions(name, PERMISSION_TRIGGER_ANIMATION); good = TRUE; } } if(!good) { } } }
|
|
Anthony Hocken
Registered User
Join date: 16 Apr 2006
Posts: 121
|
06-19-2008 17:45
Looks like you're passing the wrong parameter to llGetInventoryType(). It's expecting the name of the inventory item.
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
06-19-2008 17:53
If you're trying to find an animation without knowing the name ahead of time, something like llGetInventoryName(INVENTORY_ANIMATION, 0) is what you're looking for.
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
06-19-2008 19:10
that worked, but i got about 8 animations that are gonig to be playing if i read on wiki right with that 0 it will only do the first one, would i need to add it over and over 1 threw 7?
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
06-19-2008 19:16
You would use llGetInventoryNumber(INVENTORY_ANIMATION) to find out how many, then loop through (0 to that number - 1) to get the names.
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
06-20-2008 02:11
When you request animation permission this way you are goint to run into error messages.
Unless the requesting object is attached to the player in question, asking for animation permissions will *NOT* be granted automagically.
use the run_time_permissions() event to determine if you are allowed to animate the avatar in question and only start your animation in that event if you have been granted permission.
|