Annah Zamboni
Banannah Annah
Join date: 2 Jun 2004
Posts: 1,022
|
02-14-2005 15:36
I posted this in the script library thread for the free pose ball but thought I might get a quicker response here since this is the place to ask questions. I am using the free pose ball script from the library and here is what Im experiencing:
I switched to this script from the old one I used to use cause I liked the touch hide/show and wanted to switch my hide/show to another channel anyways to save on Sim. The only problem I have is I get errors from time to time and have to reset the script. The error usually looks like this:
Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set Position 2 (0, 0):
Sure I could set this msg to iggy but I dont really want to have it spamming other people. In fact I was in the same sim as my store and on the opposite corner of the sim and someone was trying on my pose balls and I got the msg spam from farrr away. I keep having to go reset every script. This was after a sim crash not sure thats why but I've seen it before.
Any ideas to keep the script from spamming this when pose balls are used?
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
02-14-2005 18:55
I'm working on a rewrite to it. The permissions code in it wasn't designed for multi sit target objects.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Annah Zamboni
Banannah Annah
Join date: 2 Jun 2004
Posts: 1,022
|
02-14-2005 19:09
Its the one from the Script Library in this thread: /54/7b/27543/1.htmlI'll add the code if you wish but its in that thread.
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
02-14-2005 20:17
Ok here is the first script at the top of the script library patched, i beleive my new logic added to it should work but I only have compiled it. You see what is happening is that when the second person on the object stands up the changed event is being triggered in all other pose balls too so it fires the stop animation code again in them. But if that users that last sat on these other balls have already left the sim, the stop animation fails; throwing an error. this code should work but i haven't had time to test it. //Pose Ball script, Revision 4.3.1 //Notecard configuration enabled, switchable link_message/touch_start/llListen support, sit_text, floating text, alpha. //Version 4.3 fixs link_set hide/show and permission sensing issues.
//By CrystalShard Foo. //Work started - October 10th (2004). //Last compile - November 7th (2004).
//Version 4.3.1 mods by Strife Onizuka //Modified to fix logic holes in permissions code when used on multi-sittarget objects. //Work started - Febuary 14th 2005. //Last compile - Febuary 14th 2005.
//This script will let you choose if you want to turn the ball visible on CLICK, or by using a SHOW/HIDE voice command. //You can also set the offset and the title of the ball, as well as the sit button text - all with a notecard.
//This script is free and comes without support. Dont contact me. Ask a local geek for help if it gets messy.
// ** This script is NOT FOR SALE ** //You can use it in commercial products as long as you give this script to anyone who asks for it. //You can use this source, distribute it and modify it freely, but leave the credits intact! //(You can add your own name to the list, ofcourse. Like, "Modified by John Doe")
vector ROTATION = <0,0,0>; //Euler in degrees (like the edit box)
string TITLE="Sit here"; //This text will appear in the floating title above the ball string ANIMATION=""; //Put the name of the pose/animation here! vector offset=<0,0,0.5>; //You can play with these numbers to adjust how far the person sits from the ball. ( <X,Y,Z> ) integer use_voice = FALSE;
string gNotecard = "Pose ball - CONFIGURATION"; integer gLine = 0;
integer listenHandle = -1; integer masterswitch = TRUE; integer visible = TRUE; float base_alpha = 1.0; key avatar; key trigger;
key dataserver_key = NULL_KEY;
show() { visible = TRUE; llSetText(TITLE, <1,1,1>,1); llSetAlpha(base_alpha, ALL_SIDES); }
hide() { visible = FALSE; llSetText("", <1,1,1>,1); llSetAlpha(0, ALL_SIDES); }
next_line() { gLine++; dataserver_key = llGetNotecardLine(gNotecard,gLine); }
use_defaults() { llSetSitText("Sit Here"); if(visible == FALSE) llSetText("",<1,1,1>,1); else llSetText(TITLE,<1,1,1>,1); }
init() {
if(llGetInventoryNumber(INVENTORY_ANIMATION) == 0) //Make sure we actually got something to pose with. { llWhisper(0,"Error: No animation found. Cannot pose."); ANIMATION = "sit"; } else ANIMATION = llGetInventoryName(INVENTORY_ANIMATION,0);
integer i; for(i=0;i<llGetInventoryNumber(INVENTORY_NOTECARD);i++) if(llGetInventoryName(INVENTORY_NOTECARD,i) == gNotecard) { gLine = 0; dataserver_key = llGetNotecardLine(gNotecard, 0); return; } //If we are here no configuration notecard was found... lets use the defaults. use_defaults(); }
default { state_entry() { llSetText("Starting up", <1,1,1>,1); llSitTarget(offset, llEuler2Rot(ROTATION * DEG_TO_RAD)); init(); }
link_message(integer sender_num, integer num, string str, key id) { if(num == 99) { if(str == "show") { masterswitch = FALSE; hide(); return; } if(str == "hide"); { masterswitch = TRUE; show(); } } } touch_start(integer detected) { if(use_voice == FALSE) { if(visible == TRUE) hide(); else show(); } else llSay(0,llDetectedName(0)+", say '/1 Hide' to hide me, or '/1 Show' to make me show. Or just right-click and sit on me to use me."); } changed(integer change) { if(change & CHANGED_LINK) { avatar = llAvatarOnSitTarget(); if(llKey2Name(avatar) != "") { hide(); llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); } else { if (llKey2Name(llGetPermissionsKey()) != "" && trigger == llGetPermissionsKey()) { llStopAnimation(ANIMATION); trigger = NULL_KEY; } if(masterswitch == TRUE) { llSetAlpha(base_alpha,ALL_SIDES); llSetText(TITLE,<1,1,1>,1); } } } if(change & CHANGED_INVENTORY) { llSetText("Reloading configuration...",<1,1,1>,1); init(); } } run_time_permissions(integer perm) { avatar = llAvatarOnSitTarget(); if(perm & PERMISSION_TRIGGER_ANIMATION && llKey2Name(avatar) != "" && avatar == llGetPermissionsKey()) { trigger = avatar; llStopAnimation("sit"); llStartAnimation(ANIMATION); if(visible == TRUE) base_alpha = llGetAlpha(ALL_SIDES); else base_alpha = 1.0; llSetAlpha(0.0,ALL_SIDES); llSetText("",<1,1,1>,1); } }
listen(integer channel, string name, key id, string message) { if(llStringLength(message)!=4) return; message = llToLower(message); if(message == "show") { show(); return; } if(message == "hide") hide(); } dataserver(key queryid, string data) { if(queryid != dataserver_key) return; if(data != EOF) { if(llGetSubString(data,0,0) != ";") { if(llGetSubString(data,0,5) == "title:") { TITLE = llGetSubString(data,7,-1); next_line(); return; } if(llGetSubString(data,0,6) == "offset:") { integer length = llStringLength(data); if(llGetSubString(data,8,8) != "<" || llGetSubString(data,length - 1,length) != ">") { llSay(0,"Error: The numbers in the offset value lack the '<' and '>' signs. (Should be something like <3,1,6> )"); offset = <0,0,0.5>; } else offset = (vector)llGetSubString(data,8,-1); if(offset == <0,0,0>) offset = <0,0,0.01>; llSitTarget(offset,ZERO_ROTATION); next_line(); return; } if(llGetSubString(data,0,5) == "voice:") { string value = llGetSubString(data,7,-1); value = llToLower(value); if(listenHandle != -1) { llListenRemove(listenHandle); listenHandle = -1; } if(value !="no" && value != "yes" && value != "true" && value != "false") use_voice = FALSE; else if(value == "no" || value == "false") use_voice = FALSE; else { use_voice = TRUE; listenHandle = llListen(1,"","",""); } next_line(); return; } if(llGetSubString(data,0,10) == "sit_button:") { llSetSitText(llGetSubString(data,12,-1)); next_line(); return; } next_line(); } } else { if(visible == FALSE) llSetText("",<1,1,1>,1); else llSetText(TITLE,<1,1,1>,1); } } }
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Annah Zamboni
Banannah Annah
Join date: 2 Jun 2004
Posts: 1,022
|
02-14-2005 21:17
Thanks! I'll test it shortly and see if it works. 
|
Annah Zamboni
Banannah Annah
Join date: 2 Jun 2004
Posts: 1,022
|
02-14-2005 23:33
Looks like that fixed it! Thanks! I tested the old script using what you said was probably causing it. And sure enough when 2nd person to sit left the sim and the first person stood up, the error then popped up. Was able to make the error happen at will using that. Then I put in your modified script and redid the test and that time no more errors!  Thanks again! Maybe we should put the fix in the thread in the script library so everyone doesnt use the old one.
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
02-14-2005 23:46
did you check it when person a stand up first, and person b stand up first?
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
02-15-2005 03:52
It doesn't matter who stands up first as long as who ever does leaves the sim. lets chart out the logic. two prim object. Prims named Prim 1 & Prim 2
Situation a Agent A has just sat down or Agent B has just stood up changed event is triggered in Prim 1 -> llAvatarOnSitTarget() == Agent A changed event is triggered in Prim 2 -> llAvatarOnSitTarget() == NULL_KEY Situation b Agent A and B both sat down at the same time or one had just sat down and the other was already seated changed event is triggered in Prim 1 -> llAvatarOnSitTarget() == Agent A changed event is triggered in Prim 2 -> llAvatarOnSitTarget() == Agent B Situation c Agent A has just stood up or Agent B has just sat down changed event is triggered in Prim 1 -> llAvatarOnSitTarget() == NULL_KEY changed event is triggered in Prim 2 -> llAvatarOnSitTarget() == Agent B Situation d Agent A and B both stood up at the same time or one stood up while the other seat was vacant. changed event is triggered in Prim 1 -> llAvatarOnSitTarget() == NULL_KEY changed event is triggered in Prim 2 -> llAvatarOnSitTarget() == NULL_KEY
A B | 1 2 D D A B U D - B D U A - U U - -
D = Down U = Up
Basicly we don't really know what has changed only what the end result is. Now lets compicate things. Say do to a sim crash, ugly sim crossing or something else the changed event doesn't get triggered in one or both of the scripts. You may think this doesn't happen, it happens all the time. The easy solution is to keep track of who we trigger animations on and then clear that marker. But that only solves the problem of the animation being stopped multiple times. It doesn't solve the problem of an animation being triggered multiple times (a secondary stand looks the same as a primary sit). The obvious solution is to not trigger animations if you marker is already set. The trouble with this is that on ugly sim crossings and sim crashes the changed event doesn't get thrown when the agents are unseated. When they sit back down the marker won't have been cleared and the animation won't be triggered (course standing up and sitting again will fix this problem). The only solution that solves this last problem is to run a timer event when the marker is set to check to make sure the agent is still in the sim; clearing the marker when they are not and deactivating the timer. It seems like a design flaw in LSL that all this work has to be done to acheive perfection. Something like CHANGED_SIT instead of CHANGED_LINK would make everyones life easier. CHANGED_SIT would only be triggered in the prim the agent is sitting on. If we had CHANGED_SIT we could write a nice clean code like this... And life would be good No more worries about cross contamination of sit events. default { changed(integer change) { if(change & CHANGED_SIT) { avatar = llAvatarOnSitTarget(); if(llKey2Name(avatar) != "") llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); else if (llKey2Name(llGetPermissionsKey()) != "") llStopAnimation(ANIMATION); } } run_time_permissions(integer perm) { avatar = llAvatarOnSitTarget(); if(perm & PERMISSION_TRIGGER_ANIMATION && llKey2Name(avatar) != "" && avatar == llGetPermissionsKey()) { llStopAnimation("sit"); llStartAnimation(ANIMATION); } } }
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Annah Zamboni
Banannah Annah
Join date: 2 Jun 2004
Posts: 1,022
|
02-16-2005 08:30
The fix appears to be working great still. I tested about 30 - 40 pose balls on furniture that was giving errors and none of them had a single error message. Thanks!
|