These forums are CLOSED. Please visit the new forums HERE
Floating text showing active pose |
|
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-20-2006 07:54
I have a poseball with multiple poses and a script that change the poses everytime you "touch" it. Could anyone please help me figure out how to add a floating text, showing which pose that it active, and that is hidden when posesball is in use???
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
11-20-2006 08:29
llSetText() is the command for your hover text.
Somewhere in the script it will have llStartAnimation( and something or another in the bracket. That thing will be the name of the animation it's about to play. It might well be something like llList2String(animations, i) or llGetInventoryName(INVENTORY_ANIMATION, i) or currentAnim or a variety of such things. I will, for the sake of clarity call it X. If, on the very you put in llSetText(X, <1.0, 1.0, 1.0>, 1.0); You'll get the right impact. If the script is no copy, no mod you're in a much worse place, so try that one first. _____________________
|
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-20-2006 14:31
Thank you for the help.
I dont know if I understood it correct, but i get errors compiling. I did it like this: llStartAnimation(llSetText(llGetInventoryName(INVENTORY_ANIMATION, 0)),<1.0,1.0,1.0>,1.0); curAnim = 0; Could someone please look at it and tell me what I do wrong??? |
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
11-20-2006 14:37
Could someone please look at it and tell me what I do wrong??? The functions you're trying to use do two different things (one plays animation, the other displays text) so they need to be invoked separately rather than in single line like that CODE
or perhaps to save some work: CODE
|
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-20-2006 17:12
Thank you, its show the name now, but it doesnt change when I touch it and change pose.
Could it be I have it in the wrong place in the script?? And another thing, it doesnt go away when I use sit on it. |
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
11-20-2006 17:20
Thank you, its show the name now, but it doesnt change when I touch it and change pose. Could it be I have it in the wrong place in the script?? It's possible, the way it's now the text only changes after someone is actually sitting on the stand and being animated. To have text change when you touch the stand it could be probably put instead in the touch_start() event, but without script source it's hard to tell. To get the text disappear use the llSetText() function with empty string i.e. "" put in place of text to display. |
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-20-2006 18:18
Ok, Im officially lost.
Here is the whole script, please help: 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 = 1; integer curAnim = 0; //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++) { animations = oldAnim + [x]; oldAnim = animations; } } 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... llSay(0, LoadText); //Text it says under the context menu... llSetSitText(Context); //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); } touch_start(integer num_detected) { if (user = llAvatarOnSitTarget()) { if (animNum > 1) { llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, curAnim)); llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, nextAnim)); curAnim = nextAnim; if (nextAnim < (animNum - 1)) { nextAnim++; } else { nextAnim = 0; } } } } changed(integer change) { //If the user sits on the object... if (change & CHANGED_LINK) { user = llAvatarOnSitTarget(); if (user) { llRequestPermissions(user, PERMISSION_TRIGGER_ANIMATION); } else { llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, 0)); } } } run_time_permissions(integer perm) { if (perm) { llStopAnimation("sit" ;//This starts the first animation... llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, 0)); curAnim = 0; llSetText(llGetInventoryName(INVENTORY_ANIMATION,0),<1.0,1.0,1.0>,1.0); } } } |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-20-2006 20:09
This was wrong : if(user = llAvatarOnSitTarget())
should be: if(user == llAvatarOnSitTarget()) Same thing catchs me every now and then CODE
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
11-20-2006 21:02
Since SL is down and the blog is closed, I'll just add a comment here saying that instead of this..
CODE ...it's probably better practice to do this... CODE
|
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-21-2006 04:09
Sorry Jesse, but dont think thats it. There is no change when doing like you said
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-21-2006 07:32
I hadn't tried it in world, just ran it through a compiler and found that error. By calling get inventory animations 0, you were only telling it to set the text of the first animation in inventory. It works now. When you post a script here it is much easier to read if you read the stickie on top of wiki and see how to use PHP & /PHP inside brackets to designate it as a script. Welcome to the world of late nights, frustration & fun!!!!
![]() CODE
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-21-2006 08:05
What I dont understand is why you are using the llGetInventoryName calls when you have already created a list of all the available animations during state_entry?
The current code will also allow anyone to change the pose by touch rather than just the current user, not sure if that is intentional or not. I'd probably restructure the code as well, add a check for changed inventory and reset the script. That way any new poses are automatically incorporated into the list as they are added. |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-21-2006 09:27
The code can use a lot of optimizatins and could be made smaller. I was thinking about doing that. But now the OP can see exactly where they went wrong with what they had. I am sure that they are more then willing to see how it can be optimized now.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-21-2006 10:37
thank you all for the help.
The only thing to figure out now, is how to hide the text when someone uses it |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-21-2006 11:27
thank you all for the help. The only thing to figure out now, is how to hide the text when someone uses it The way the code is currently written the text will appear when ever anyone touches the prim as it cycles through to the next animation. If you only want it to show the text when no one is sitting on the prim then you would just need to set the text to blank when they sit. However what happens if someone then touches the prim to cycle to the next animation? Should the text be blank or should it be shown? or even Both? You could use a timer and 'fade' out the text after several seconds. IF all you want to do is blank the text then :- remove the llSetText from inside the Touch handler. Add llSetText("",<1.0,1.0,1.0>, 1.0); in the permissions event where you start the first animation CODE
|
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-21-2006 13:02
The text work at first, and when sitting the text is gone, but when I stand up it doesnt come back.
And another thing is that it now forces the person touching it into the active pose, even without sitting on it. here is the code as it is now: CODE
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-21-2006 13:28
The text work at first, and when sitting the text is gone, but when I stand up it doesnt come back. Well unless you explicitly tell the text to come back it wont! Noticed as well that when ever anyone sits down the animations are reset to zero, which would appear to defeat the entire objective since you cant see the animation text while you are sat and it resets as soon as you do so.....? And another thing is that it now forces the person touching it into the active pose, even without sitting on it. Has the person now touching previously been the seated AV? |
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-21-2006 13:49
Well unless you explicitly tell the text to come back it wont! Noticed as well that when ever anyone sits down the animations are reset to zero, which would appear to defeat the entire objective since you cant see the animation text whiwel you are sat and it resets as soon as you do so.....? I want it to do the following: when touching it, it will change pose and show which is active in the text. When sitting down the text should be gone, but you should still be able to touch it to change pose. Others should be able to touch it and change pose when you are sitting on it. When standig up, the text should come back. Has the person now touching previously been the seated AV? Yes |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-21-2006 14:09
I want it to do the following: when touching it, it will change pose and show which is active in the text. When sitting down the text should be gone, but you should still be able to touch it to change pose. Others should be able to touch it and change pose when you are sitting on it. When standig up, the text should come back. The point you have missed is that, with the current incarnation of the script, as soon as you sit down the script will reset to the first one regardless of what pose you had selected. its in the run_time_permissions event CODE
|
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-21-2006 15:26
sorry, Im not good at this at all, so please help.
I would gladly pay someone to do it, if they could. |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-21-2006 15:42
sorry, Im not good at this at all, so please help. I would gladly pay someone to do it, if they could. OMG don't worry Get Bussy. You have done a great job so far. Much better then my early attempts ever were. I'll have a chance to get in world later and I'll have it another look at now that the parameters are clear. Please don't get discouraged. Believe me scripting gets a lot more frustrating then this script ![]() _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-21-2006 21:07
Well I played around and got the text right but it doesn't matter, your script has a major flaw. if(user) and if(perm) are not arguments. Once a person sits and it has thier key, they will sit and change thier pose no matter what they are doing or where they are at in the sim if someone comes by and touches the pose ball. This will continue until someone else comes and sits.
Do a search on the top right side of the forum here for poseball to see how others have dealt with the conditions. Not the search by quick links. Go out the Scripting Tips and then use "Search this forum". _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
|
11-21-2006 22:23
Thank you for the help.
Looks like I have to start over and are not very happy about that or think I have the strengh. If you have the time and are able to do it Jesse, could you make the whole script for me, and I will be happy to pay for your time. |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-22-2006 01:13
Well I played around and got the text right but it doesn't matter, your script has a major flaw. if(user) and if(perm) are not arguments. Once a person sits and it has thier key, they will sit and change thier pose no matter what they are doing or where they are at in the sim if someone comes by and touches the pose ball. This will continue until someone else comes and sits. Do a search on the top right side of the forum here for poseball to see how others have dealt with the conditions. Not the search by quick links. Go out the Scripting Tips and then use "Search this forum". It should lose the user key when they unsit because of the call to llAvatarOnSitTarget in the changed event will return NULL_KEY if there is no sat AV. CODE user = llAvatarOnSitTarget(); |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
11-22-2006 05:16
Not tried this in world, but this is how I would approach the problem
CODE vector Angle = <0,-90,0>; //Enter a vector rotation for the sit... |