Looking for a pose preview script!
|
|
Koneko Kikuchiyo
Registered User
Join date: 14 Jul 2006
Posts: 7
|
07-14-2006 03:52
I've seen in several stores which sell poses that when you click on the ad, it gives you the opportunity to preview the pose for 10 seconds. I'm looking for a script that can do that! can anyone help?
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
07-14-2006 09:56
float demo_length = 10.0; // adjust length of demo period here
key demo_target = NULL_KEY;
play_pose( string Pose ) { if( !( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) ) { llInstantMessage( demo_target, "Failed to obtain permission to animate your avatar. Please touch me again to retry." ); return; }
list current_animations = llGetAnimationList( demo_target ); integer i; for( i = 0; i < llGetListLength(current_animations); ++i ) llStopAnimation( llList2Key( current_animations, i ) );
llStartAnimation( Pose ); }
default {
on_rez( integer Parameter ) { llResetScript(); } touch_start( integer ContactsTotal ) { if( demo_target != NULL_KEY ) { llInstantMessage( llDetectedKey(0), "Am currently busy serving another customer, please try me again in few seconds..." ); return; } demo_target = llDetectedKey(0); llSetTimerEvent( 15.0 ); // 15 sec. grace period to grant permissions llRequestPermissions( demo_target, PERMISSION_TRIGGER_ANIMATION ); } run_time_permissions( integer Permissions ) { if( demo_target == NULL_KEY ) { return; } if( Permissions & PERMISSION_TRIGGER_ANIMATION ) {
llSetTimerEvent( demo_length ); play_pose( llGetInventoryName( INVENTORY_ANIMATION, 0 ) ); } else {
llSetTimerEvent( 0.0 ); demo_target = NULL_KEY; } } timer() {
llSetTimerEvent( 0.0 ); if( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) { play_pose( "stand" ); } demo_target = NULL_KEY; } }
|
|
Koneko Kikuchiyo
Registered User
Join date: 14 Jul 2006
Posts: 7
|
07-14-2006 10:42
Thanks Joannah! But when I paste this code in a new script and try it, it animates my pose, but doesn't stop, so now the pose is stuck on me, lol.
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
07-14-2006 10:51
From: Koneko Kikuchiyo Thanks Joannah! But when I paste this code in a new script and try it, it animates my pose, but doesn't stop, so now the pose is stuck on me, lol. Hmm it should revert to default "stand" animation after time limit runs out. At least it did for me when i gave it a quick run ^^; Some preview scripts use to just stop the demo pose instead which can result in the effect you speak of... that is, demo pose keeps playing until you move your avatar. Not sure why it'd get stuck on you in this case, really o.O;
|
|
Koneko Kikuchiyo
Registered User
Join date: 14 Jul 2006
Posts: 7
|
07-14-2006 12:17
Strange... Well only when I delete the item the script is in, the pose preview stops. =/
|
|
Koneko Kikuchiyo
Registered User
Join date: 14 Jul 2006
Posts: 7
|
07-14-2006 12:23
I used a script which came with somebody else's pose (says it's made by Web Page), it's no modify so I can't see the script itself, but that one DOES stop the preview after 10 secs.
I copied your script and pasted it in a blank new script (deleted the stuff that's in it by default when creating a new script first). So maybe there's something missing in this one. I have no clue...
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
07-14-2006 13:04
OK, i checked it again... built a cube, created new script, copy&pasted the code, saved, took to inventory and re-rezzed... and it acted just like you describe. The animation never stops because for some odd reason the timer() event never fires.
what apparently fixes it is to reverse the order of commands, i.e. calling TimerEvent() first and animation call later.
llSetTimerEvent( demo_length ); play_pose( llGetInventoryName( INVENTORY_ANIMATION, 0 ) );
I have updated the original post with code so it should work properly now. No idea whatsoever why this would make a difference, though, and sorry about initial mess :/
|
|
Koneko Kikuchiyo
Registered User
Join date: 14 Jul 2006
Posts: 7
|
07-14-2006 14:27
Thanks so much Joannah! I know absolutely nothing about script code so you might as well be speaking chinese when you explain what was wrong, lol. Anyway I'm very happy because I've been looking everywhere for it. Check your bank account *wink*
|
|
Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
|
preview pose
02-19-2008 16:36
From: Joannah Cramer float demo_length = 10.0; // adjust length of demo period here
key demo_target = NULL_KEY;
play_pose( string Pose ) { if( !( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) ) { llInstantMessage( demo_target, "Failed to obtain permission to animate your avatar. Please touch me again to retry." ); return; }
list current_animations = llGetAnimationList( demo_target ); integer i; for( i = 0; i < llGetListLength(current_animations); ++i ) llStopAnimation( llList2Key( current_animations, i ) );
llStartAnimation( Pose ); }
default {
on_rez( integer Parameter ) { llResetScript(); } touch_start( integer ContactsTotal ) { if( demo_target != NULL_KEY ) { llInstantMessage( llDetectedKey(0), "Am currently busy serving another customer, please try me again in few seconds..." ); return; } demo_target = llDetectedKey(0); llSetTimerEvent( 15.0 ); // 15 sec. grace period to grant permissions llRequestPermissions( demo_target, PERMISSION_TRIGGER_ANIMATION ); } run_time_permissions( integer Permissions ) { if( demo_target == NULL_KEY ) { return; } if( Permissions & PERMISSION_TRIGGER_ANIMATION ) {
llSetTimerEvent( demo_length ); play_pose( llGetInventoryName( INVENTORY_ANIMATION, 0 ) ); } else {
llSetTimerEvent( 0.0 ); demo_target = NULL_KEY; } } timer() {
llSetTimerEvent( 0.0 ); if( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) { play_pose( "stand" ); } demo_target = NULL_KEY; } }
Is there anyway to make the above script let me sit on it and cycle threw the poses I have loaded in the pose ball with out getting dialog or asking ? I want to be able to sit on pose ball and have it start a pose that is loaded inside it and then after so many seconds switch to another loaded pose inside it? thanks
|
|
Cordax Martinek
Registered User
Join date: 7 May 2007
Posts: 14
|
another one
02-19-2008 16:49
hello don't know if this one would be any easier to mod... I did not make this script or do I know who did.. thanks to who ever did...smiles This is what I want but to auto cycle threw automatic after so many seconds instead of touch event.. vector Angle = <0,-90,0>; //Enter a vector rotation for the sit... vector SitLoc = <-1.3,0,-0.5>; //This is the sitTarget positioning... CANNOT EQUAL 0 string LoadText = "Sit"; // The text you want to show when the object loads... string Context = "Sit"; //The text you want in the context menu...
//Globals!! WOOO!! key user; list animations; integer animNum; integer nextAnim = 0;
string currentAnimation; string nextAnimation;
//This part dynamically gathers all of the animations you've placed in the object for usage later... initialize() { integer x; list oldAnim; animNum = llGetInventoryNumber(INVENTORY_ANIMATION); for (x = 0; x < animNum; x++) { string str = llGetInventoryName(INVENTORY_ANIMATION, x); animations = oldAnim + [str]; oldAnim = animations; } }
ShowAnimation() { llSetText(nextAnimation,<1.0,1.0,1.0>, 1.0); }
GetNextAnimation() { // Wrap Around the list of available animations if (animNum > 1) { if (nextAnim < (animNum - 1)) { nextAnim++; } else { nextAnim = 0; } nextAnimation = llList2String(animations,nextAnim); } }
ChangeAnimation() { llStopAnimation(currentAnimation); llStartAnimation(nextAnimation); currentAnimation = nextAnimation; }
default { state_entry() { initialize();
//For easy rotation in the llSitTarger enter the vector rotation below.. vector eul = Angle; //45 degrees around the z-axis, in Euler form.. eul *= DEG_TO_RAD; //convert to radians... rotation quat = llEuler2Rot( eul ); //convert to quaternion... //Adjust the positioning of the user while siting... //also need for llAvatarOnSit... //if this value is equal to 0, it doesn't work, so set it to make it look right for your object llSitTarget(SitLoc, quat);
// Initialise Main Variables user = NULL_KEY; currentAnimation = "sit"; nextAnimation = llList2String(animations,nextAnim);
llSay(0, LoadText); // The text you want to show when the object loads... (WHY?) llSetSitText(Context); // Text it says under the context menu... ShowAnimation(); // Display the name of the animation to play }
touch_start(integer num_detected) { // We have been touched so cycle to the next animation GetNextAnimation();
// Update target (SHOULDN'T BE REQUIRED BUT...) user = llAvatarOnSitTarget();
// If some one is sat on us if(user) { // Change the animation to the newly selected one ChangeAnimation(); } else { // Just update the text ShowAnimation(); } } changed(integer change) { //If the user sits on the object... if (change & CHANGED_LINK) { user = llAvatarOnSitTarget(); if (user) { llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION); } else { // Stop the Current Animation llStopAnimation(currentAnimation); ShowAnimation(); // Update the text currentAnimation = "sit"; // reset to sit } } else if(change & CHANGED_INVENTORY) { llResetScript(); } }
run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { // Clear Any Text llSetText("",<1.0,1.0,1.0>, 1.0); //This starts the first animation... ChangeAnimation(); } }
on_rez(integer num) { llResetScript(); } }
|