|
Petteri Yiyuan
Registered User
Join date: 4 Mar 2007
Posts: 56
|
08-19-2007 23:28
I have done shield which i want to draw/sheath visible (other one is worn in L forea-arm) and when drawn becomes visible. Same time shield worn in back will become invisible. With sheath command everything works opposite way. I know this has to be done with llSetAlpha command. I have tried to put this script to shield default { link_message(integer sender, integer channel, string msg, key id) { if (msg == "sheath"  llSetAlpha(1, ALL_SIDES); else if (msg == "draw"  llSetAlpha(0, ALL_SIDES); } } but nothing happens when i type draw or sheath command. Any help?
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-20-2007 01:23
First, a link_message() event is triggered only by another script sending an llMessageLinked() message. You need a listen() event and an llListen filter. Second, that will only work if the sheild happens to be one prim. Instead of llSetAlpha you can use llSetLinkAlpha to set a whole link set's alpha. See attached script =^.^=
|
|
Petteri Yiyuan
Registered User
Join date: 4 Mar 2007
Posts: 56
|
08-20-2007 02:38
Thank you very much for helping. I got idea how to do it and got shield in back and hand working (making them visible depending if shield is drawn or "sheathed to back". Hmm maybe i change draw and sheath command to wear and use shield commands) Anyway i got another problem related to animation or llStopAnimation command. I use following script to make shield pose animation (holds left arm lift up and so that it keeps shield front of body) string anim ="drink"; string anim2 ="Shield pose";
default { attach(key victim) { if(victim == NULL_KEY) { llStopAnimation(anim2); llStopAnimation(anim2); llSetTimerEvent(0); } else { llRequestPermissions(victim,PERMISSION_TRIGGER_ANIMATION); } }
run_time_permissions(integer permissions) { if (PERMISSION_TRIGGER_ANIMATION & permissions) { llStartAnimation(anim2); llStartAnimation(anim2); llSetTimerEvent(15); } }
timer() { llStartAnimation(anim2); llStartAnimation(anim2); }
}
Naturally i have shield all time attached to hand so if i make it invisible animation still continues. I havent yet figured out yet how to use llStopAnimation so that when i command in channel 1 sheath shield animation script is stopped.
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-20-2007 03:19
Your best bet is to combine the functions in one script. See attached.
|
|
Petteri Yiyuan
Registered User
Join date: 4 Mar 2007
Posts: 56
|
08-20-2007 03:27
Thank you Jillian!
|
|
Petteri Yiyuan
Registered User
Join date: 4 Mar 2007
Posts: 56
|
08-20-2007 04:13
I had to change last part of the script to look like this so that i would get this working correctly .................. if (msg == "sheath"  { llSetTimerEvent(0.0); // Stop the timer so the anim does not get re-run. llSetLinkAlpha(LINK_SET,drawn, ALL_SIDES); // Make the item invisible if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(anim); // stop the animation } else if (msg == "draw"  { llSetTimerEvent(5.0); // Re-start the timer llSetLinkAlpha(LINK_SET, sheathed, ALL_SIDES); // Make item visible. if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStartAnimation(anim); // start the animation } .................... I changed to llSetLinkAlpha drawn & sheathed places. Now commends show them wrongly but it now works correctly. Otherwise when i type /1draw shield becomes visible in hand but animation stops and when i type /1sheath shield becomes invisible but animation starts. Thanks again for a help! I will send you as a thanks that shield!
|