|
Sephy McCaw
Registered User
Join date: 19 Sep 2007
Posts: 18
|
03-04-2009 15:34
Hello all you scripting gods/goddesses, i am in need of help with this script i have umm modified but not completely sure on how to get it to move on to the next llsay integer flag = 0;
default { state_entry() { flag = 0; } run_time_permissions(integer parm) { if(parm == PERMISSION_TRIGGER_ANIMATION) { llStartAnimation("sipping"); llStartAnimation("sip rest loop"); llSetTimerEvent(20);return; } }
attach(key id) { llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); llSetTimerEvent(0); llStopAnimation("sip rest loop"); flag = 0; } timer() { if(flag == 0) { llStartAnimation("sipping"); llSay(0, (string) llKey2Name(llGetOwner()) + " " ); return; if(flag == 0) llSay(0, (string) llKey2Name(llGetOwner()) + " " ); return;
if(flag == 0) llSay(0, (string) llKey2Name(llGetOwner()) + " " ); return; if(flag == 0) llSay(0, (string) llKey2Name(llGetOwner()) + " "); llDetachFromAvatar();
} flag = flag + 1; }
}/
I am also wondering if it is possible to have it to detach at the last command on the script
Regards Sephy McCaw
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
03-05-2009 02:56
I'm not entirely sure what sequence of events you are hoping your script will achieve. As it is it's just going to play the animation: sipping, and say the agent's name every 20 seconds... forever. Bear in mind that the 'return' keyword will exit the timer event immediately. The value for flag will never get incremented. Also, all of your 'tests' are for flag == 0 ...which doesn't make a lot of sense. Here's my attempt at making some meaning from your script: integer flag; default { run_time_permissions(integer parm) { if(parm & PERMISSION_TRIGGER_ANIMATION) { flag = 0; llStartAnimation("sipping"); llStartAnimation("sip rest loop"); llSetTimerEvent(20); } }
attach(key id) { if(id != NULL_KEY) { llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); } } timer() { llSay(0, (string) llKey2Name(llGetOwner()));
if(flag == 0) { llStartAnimation("sipping"); } else if(flag == 3) { llDetachFromAvatar(); }
flag = flag + 1; } }
Effect on attaching the object: play animation: sipping play animation: sip rest loop wait 20 seconds say name play animation: sipping wait 20 seconds say name wait 20 seconds say name wait 20 seconds say name detach object I have no idea if this is what you want to achieve. 
|
|
Sephy McCaw
Registered User
Join date: 19 Sep 2007
Posts: 18
|
03-05-2009 03:18
wow...that makes the script much smaller haha, so as you've probably guessed im not all that bright with scripting lol. I was looking for a way to make it emote what you are doing.. for example llSay(0, (string) llKey2Name(llGetOwner()) + " something would me typed in here to show what your doing"  ; also so that it plays a new emote each time the sipping animation is played
|
|
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
|
03-05-2009 04:33
From: Sephy McCaw also so that it plays a new emote each time the sipping animation is played if you take a sip every 20 seconds that is a lot of Spam in the public chat, you will not be popular in even moderately busy places. If you Must emote that often may I suggest you use llWhisper. That way at least you are only spamming the people close to you.
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
03-05-2009 05:16
This is not really an emote, as such, but I think this is the kind of thing you have in mind: float delay = 20; // seconds between sips integer endflag = 6; // number of sips before detach integer flag; list emotes = ["hiccups and giggles.", "twirls the little umbrella in their drink.", "spills their drink down their chin.", "looks at you with a glazed expression.", "offers to buy everyone another drink.", "winks and smiles."];
default { run_time_permissions(integer parm) { if(parm & PERMISSION_TRIGGER_ANIMATION) { flag = 0; llStartAnimation("sipping"); llStartAnimation("sip rest loop"); llSetTimerEvent(delay); } }
attach(key id) { if(id != NULL_KEY) { llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); } } timer() { flag = flag + 1; llStartAnimation("sipping");
if(flag < endflag) { llSay(0, (string)llKey2Name(llGetOwner()) + " " + llList2String(emotes, (integer)(llFrand(llGetListLength(emotes))))); } else { llSay(0, (string)llKey2Name(llGetOwner()) + " finishes their drink and burps."); llSetTimerEvent(0); llDetachFromAvatar(); } } }
I hope you understand this script sufficiently to amend it to your own uses. And, yes, as per Very's comment, I tend to Mute obtrusive objects. 
|