TauniKingston Posted April 7, 2021 Share Posted April 7, 2021 Hello... I need to create a TYPER that will make the object appear, play the animation (and loop till typing is stopped) then vanish the item... I have a script that the item appears then vanishes when typing but cannot for the life of me figure out how to make an animation play as well. Do I need a separate script for this? And if so, could someone help me with that script please? here is what I have so far: default { state_entry() { llSetTimerEvent(0.1); } timer() { if (llGetAgentInfo(llGetOwner()) & AGENT_TYPING) { llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); } else { llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); } } } Thank you in advance for your assistance. Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 7, 2021 Share Posted April 7, 2021 (edited) Create a global integer flag(call it iType maybe) to keep track of whether typing has already started. In your first if test in the timer event, start the looping anim and set the flag to TRUE when typing starts. Otherwise leave it FALSE. Set iType to FALSE in the second if test and stop the anim when you sense that the agent has stopped typing. On successive passes through the timer event, that first if test will always tell you whether the anim needs to be restarted or can be left unstarted. Edited April 7, 2021 by Rolig Loon Cleaner wording 2 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted April 7, 2021 Share Posted April 7, 2021 (edited) Animation is a bit trickier because you need to ask the avatar for permission to animate them (which in the case of a worn object like a typer would be automatically granted, but you still need to ask for it) integer on=FALSE; default { state_entry() { llSetTimerEvent(0.1); } attach(key ID) { if(ID) { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } } timer() { if (!on && llGetAgentInfo(llGetOwner()) & AGENT_TYPING) { llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); on=TRUE; if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); } else if(on) { llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); on=FALSE; if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); } } } That should work, I added a global variable 'on' as well to avoid triggering the animation multiple times. Edited April 7, 2021 by Quistessa Woops, realized the permissions should probbaly be asked for every time you attach the object, not just when the script starts. 3 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted April 8, 2021 Share Posted April 8, 2021 doing a double take, I think my logic might have been a bit flawed. you probably need something more like: timer() { integer typing = llGetAgentInfo(llGetOwner()) & AGENT_TYPING; if(typing+on !=1) return; // do nothing if the typer is in the correct state. on = !on; llSetLinkAlpha(LINK_SET, (float)on, ALL_SIDES); if(on) { if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); } else { if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 8, 2021 Share Posted April 8, 2021 Or timer() { integer typing = llGetAgentInfo(llGetOwner() & AGENT_TYPING); if (typing) { if (!on) { on = TRUE; if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); } } } else { if (on) { on = FALSE; if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); } } } } assuming that on is a global integer variable. 2 Link to comment Share on other sites More sharing options...
Late Billig Posted May 6, 2021 Share Posted May 6, 2021 Hey, I made a script like that in world, if you want I can toss it your way. Just hit me up in world, as I rarely check forums and responses unless I'm hiring for something. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now