Angela Heideman
Registered User
Join date: 25 Jan 2007
Posts: 32
|
06-03-2008 02:57
Hey,
I have a free script to kiss (kiss of death) my partner, when he accepted I kiss him and he falls down on the ground and lies for 60 seconds. My question is can I stop the script after the kiss and give a command (or what else) to get the script running again on the same point where I stopped the script or on another animation?
Angela
|
Oscuro Khandr
Registered User
Join date: 25 May 2008
Posts: 1
|
06-03-2008 03:36
From: Angela Heideman Hey,
I have a free script to kiss (kiss of death) my partner, when he accepted I kiss him and he falls down on the ground and lies for 60 seconds. My question is can I stop the script after the kiss and give a command (or what else) to get the script running again on the same point where I stopped the script or on another animation?
Angela Not 100% sure what you mean here... Do you want to stop/restart the KoD script, or in the case of running some other script, interrupt doing KoD, and then pick up the first script where you left off? Without seeing the script in question, I would have to guess that the KoD is an animation on you (the kiss) followed by an Animation Override on your partner (plays dead). At the point the AO has been delivered, it seems like that would be the end of the KoD script.
|
Angela Heideman
Registered User
Join date: 25 Jan 2007
Posts: 32
|
06-03-2008 03:56
Script part 1 // Constants integer sensorDistance = 10; list hug_cmd = [ "kiss", "/kiss" ]; integer linkChannel = 598242; string linkStringRequest = "HUG_TARGET_=^..^=REQUEST"; string linkStringStart = "HUG_TARGET_=^..^=START"; string linkStringAnim = "HUG_TARGET_=^..^=ANIM"; string linkStringReset = "HUG_TARGET_=^..^=RESET"; string animName = "long-kiss-femanine"; integer animTime = 15; vector posOffset1 = <0.3, 0, 0>; vector posOffset2 = <0, 0, 0>; // Not Constants string avTarget = ""; vector avPos = ZERO_VECTOR; key avKey = NULL_KEY; rotation avRot = ZERO_ROTATION; string avName = ""; integer avFindName = TRUE; string checkMatch( string str, list prefixes ) { integer numElements = llGetListLength( prefixes ); integer i; integer lastChar; string curPrefix; string curStr = llToLower( str ); for( i=0; i<numElements; i++ ) { curPrefix = llList2String(prefixes, i); lastChar = llStringLength( curPrefix ); lastChar -= 1; if ( llGetSubString(curStr, 0, lastChar) == curPrefix ) return curPrefix; } return ""; } integer setAvTarget( string message, string match ) { integer mesgLen = llStringLength( message ); integer matchLen = llStringLength( match ); if ( mesgLen <= matchLen + 1 ) { avTarget = ""; return FALSE; } else { mesgLen -= 1; avTarget = llGetSubString( message, matchLen+1, mesgLen ); avTarget = llToLower( avTarget ); return TRUE; } } usageMessage() { llInstantMessage( llGetOwner(), "Usage: Face your target and Say '/kiss [person's name]' or '/1kiss [person's name]'" ); } default { state_entry() { if ( llGetAttached() ) llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); usageMessage(); } on_rez( integer startcode ) { llResetScript(); } attach( key k ) { if ( k != NULL_KEY ) llResetScript(); } run_time_permissions(integer parm) { if( parm & PERMISSION_TRIGGER_ANIMATION ) { llListen( 0, "", llGetOwner(), "" ); llListen( 1, "", llGetOwner(), "" ); } } sensor(integer total_number) { if ( avFindName ) { integer i; for ( i = 0; i < total_number; i++ ) { vector pos; rotation rot; if ( llSubStringIndex(llToLower(llDetectedName(i)), avTarget) >= 0 && llDetectedKey(i) != llGetOwner() ) { avName = llDetectedName(i); llInstantMessage( llGetOwner(), "You have offered to kiss " + avName + "." ); llMessageLinked( LINK_SET, linkChannel, linkStringRequest, llDetectedKey(i) ); avPos = llDetectedPos(i); avRot = llDetectedRot(i); avName = llList2String( llParseString2List( avName, [" "], [] ), 0 ); avKey = llDetectedKey(i); return; } } } else { vector pos; vector size = llGetAgentSize( llGetOwner() ); float mass = size.x * size.y * size.z; avPos = llDetectedPos(0); avRot = llDetectedRot(0); //mass = mass * 1000; pos = avPos + posOffset1 * avRot; llMoveToTarget( pos, .5 ); llSleep(.6); pos = avPos + posOffset2 * avRot; llMoveToTarget( pos, .5 ); llSleep(.6); llMoveToTarget( pos, 1 ); //llLookAt( avPos, mass/2, mass/20 ); //llApplyRotationalImpulse( mass*<1,1,1>, FALSE ); //llSleep(3); //llStopLookAt(); //return; // Okay, first say a nice message string origName = llGetObjectName(); string owner; owner = llKey2Name( llGetOwner() ); owner = llList2String( llParseString2List( owner, [" "], [] ), 0 ); llSetObjectName( owner ); llSay( 0, "/me gives " + avName + " a big kiss." ); llSetObjectName( origName ); // And then, do the anim llMessageLinked( LINK_SET, linkChannel, linkStringAnim, NULL_KEY ); llStartAnimation( animName ); llSleep( animTime ); llStopAnimation( animName ); llStopMoveToTarget(); } } no_sensor() { llInstantMessage( llGetOwner(), "Couldn't find kiss target, '" + avTarget + "'" ); llMessageLinked( LINK_SET, linkChannel, linkStringReset, NULL_KEY ); } link_message( integer sender, integer i, string s, key k ) { if ( i == linkChannel && s == linkStringStart ) { avFindName = FALSE; llSensor( "", avKey, AGENT, sensorDistance, PI ); } } listen(integer channel,string name,key id,string message) { string match; match = checkMatch( message, hug_cmd ); if( match != "" ) { if ( !setAvTarget( message, match ) ) usageMessage(); else { avFindName = TRUE; llSensor( "", NULL_KEY, AGENT, sensorDistance, PI ); } } } }
part 2 // Constants integer linkChannel = 598242; string linkStringRequest = "HUG_TARGET_=^..^=REQUEST"; string linkStringStart = "HUG_TARGET_=^..^=START"; string linkStringAnim = "HUG_TARGET_=^..^=ANIM"; string linkStringReset = "HUG_TARGET_=^..^=RESET"; string animName = "long-kiss-masculine"; integer animTime = 15; string animName2 = "Stunned"; integer animTime2 = 60; // Not Constants vector avPos = ZERO_VECTOR; key avKey = NULL_KEY; rotation avRot = ZERO_ROTATION; default { state_entry() { } on_rez( integer startcode ) { llResetScript(); } attach( key k ) { llResetScript(); } run_time_permissions(integer parm) { if( parm == PERMISSION_TRIGGER_ANIMATION ) { llMessageLinked( LINK_SET, linkChannel, linkStringStart, NULL_KEY ); } else { string avName = llKey2Name( avKey ); avName = llList2String( llParseString2List( avName, [" "], [] ), 0 ); llInstantMessage( llGetOwner(), avName + " has declined your kiss." ); } } link_message( integer sender, integer i, string s, key k ) { if ( i == linkChannel ) { if ( s == linkStringAnim ) { string avName = llKey2Name( avKey ); llStartAnimation( animName ); llSleep(animTime); llStopAnimation( animName ); llSleep(animTime); llSay(0, avName + " starts to feel dizzy after the kiss, the poison on her lips taking effect."); llSleep(animTime); llSay(0, avName + " falls to the ground, unconscious from the poison. ((two minute timer started))."); llStartAnimation( animName2 ); llSleep(animTime2); llSay(0, avName + " starts to stir, the poison wearing off."); llSleep(animTime2); llSay(0, avName + " comes to, awakening from the poison. Although still a bit groggy from the encounter."); llStopAnimation ( animName2 ); llResetScript(); } else if ( s == linkStringRequest ) { string owner; owner = llKey2Name( llGetOwner() ); owner = llList2String( llParseString2List( owner, [" "], [] ), 0 ); llRequestPermissions( k ,PERMISSION_TRIGGER_ANIMATION ); llInstantMessage( k, owner + " would like give you a kiss. Say [Yes] to accept." ); llSetTimerEvent( 60 ); avKey = k; } else if ( s == linkStringReset ) { llResetScript(); } } } timer() { llResetScript(); } }
All I want is that the script stops after animname and wait for a reaction of me (command or what else) to get the script running again on the same point where it stopped or starts another animation?
|