Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Pose Balls Advanced_Poseball_Script  

Advanced_Poseball_Script

This script began when I wanted to write...

Category: Pose Balls
By : Lymirah Gardner
Created: 2012-08-10 Edited: 2012-08-10
Worlds: Second Life

the Zip file

Download all files for Advanced_Poseball_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Advanced_Poseball_Script_1.lsl
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // //
3 // Object Click-Sit-Animation Script by Lymirah Gardner, Version 1.7, 08 May 2012 //
4 // (First Written 06 March 2012) //
5 // //
6 // Clicking will sit on object & animate avatar. //
7 // Hover text and object hide controlled from global variables. //
8 // v1.5: Now works for a linked prim. Normal functionality retained for separate, unlinked objects. //
9 // v1.6: Now works correctly (individually) for multiple poseballs linked together. //
10 // v1.7: Bug fix for v1.6. //
11 // //
12 ////////////////////////////////////////////////////////////////////////////////////////////////////////
13 // //
14 // Please feel free to share this script. It's meant for anyone and everyone! All I ask is that you //
15 // don't sell the script on its own or as part of any package, objects or products. It's provided //
16 // for free - please keep it that way! Please also keep this title box. //
17 // //
18 ////////////////////////////////////////////////////////////////////////////////////////////////////////
19
20 //GLOBAL VARIABLES
21 string animation = "ANIMATIONNAME"; //change to animation name
22 vector sittarget = < 0.0, 0.0, 0.1>; //adjust sittarget offset
23 vector sitangle = < 0.0, -90.0, -90.0>; //adjust sittarget rotation in degrees
24
25 //WHO CAN USE THIS? ONLY OWNER?
26 integer only_owner = 0; //toggle access: 1 = only owner, 0 = anyone
27
28 //TOGGLE HOVER TEXT AND/OR OBJECT HIDE (SEPARATELY)
29 integer HOV_ON = 1; //toggle hover text: 1 = on, 0 = off
30 integer OBJHIDE_ON = 1; //toggle object hide (poseball action): 1 = on, 0 = off
31
32 //MODIFY HOVER TEXT & COLOR
33 string HOVERTEXT = "Sit here or else!"; //hover text
34 vector COLOR = < 0.0, 0.0, 0.0>; //color of hover text
35 //black: < 0.0, 0.0, 0.0>
36 //gray: < 0.5, 0.5, 0.5>
37 //white: < 1.0, 1.0, 1.0>
38 //pink: < 1.0, 0.0, 0.5>
39 //red: < 1.0, 0.0, 0.0>
40 //orange: < 1.0, 0.5, 0.0>
41 //yellow: < 1.0, 1.0, 0.0>
42 //light green: < 0.5, 1.0, 0.0>
43 //green: < 0.0, 1.0, 0.0>
44 //blue-green: < 0.0, 1.0, 0.5>
45 //cyan: < 0.0, 1.0, 1.0>
46 //med-blue: < 0.0, 0.5, 1.0>
47 //blue: < 0.0, 0.0, 1.0>
48 //purple: < 0.5, 0.0, 1.0>
49 //magenta: < 1.0, 0.0, 1.0>
50
51 //SIT MENU TEXT
52 integer SITTXT_ON = 1; //toggle sit menu text override: 1 = on, 0 = off
53 string SITTEXT = "Sit here!"; //sit menu text
54
55 //OTHER GLOBAL VARIABLE DECLARATIONS
56 rotation sitrotation;
57 key owner;
58 key sitter = NULL_KEY;
59 integer SITTING;
60 integer LN;
61 integer LS;
62
63 //USER-DEFINED FUNCTION
64 integer test_sit() {
65 if(LS == 1) {
66 if(llAvatarOnLinkSitTarget(LN) != NULL_KEY) return 1;
67 else return 0;
68 }
69 else if(LS == 0) {
70 if(llAvatarOnSitTarget() != NULL_KEY) return 1;
71 else return 0;
72 }
73 else return 0;
74 }
75
76 //START HERE
77 default {
78 state_entry() {
79 SITTING = 0;
80 if(only_owner == 1) owner = llGetOwner();
81 if(llGetNumberOfPrims() > 1) {
82 LN = llGetLinkNumber();
83 LS = 1;
84 }
85 else {
86 LN = LINK_SET;
87 LS = 0;
88 }
89 sitrotation = llEuler2Rot(sitangle * DEG_TO_RAD); //deg to rad & --> rot
90 llSitTarget(sittarget,sitrotation); //set sittarget
91 llSetClickAction(CLICK_ACTION_SIT); //click action to sit
92 if(SITTXT_ON) llSetSitText(SITTEXT); //set sit menu text
93 if(HOV_ON) llSetText(HOVERTEXT,COLOR,1.0); //show hover text
94 else llSetText("",<0.0,0.0,0.0>,1.0); //or make it null
95 if(OBJHIDE_ON) llSetLinkAlpha(LN,1.0,ALL_SIDES); //show object
96 }
97
98 on_rez(integer num) {
100 }
101
102 changed(integer change) {
103 if(change & CHANGED_LINK) { //links changed!
104 if(SITTING == 0 && LS == 1) sitter = llAvatarOnLinkSitTarget(LN);
105 if(SITTING == 0 && LS == 0) sitter = llAvatarOnSitTarget();
106 if(only_owner == 1 && sitter != owner && sitter != NULL_KEY) {
107 llUnSit(sitter);
108 llInstantMessage(sitter,"You are not permitted to sit here.");
109 sitter = NULL_KEY;
110 }
111 else if(SITTING == 0 && sitter != NULL_KEY) { //someone sitting?
112 SITTING = 1;
114 }
115 else if(SITTING == 1 && test_sit() == 0) { //I think someone stood up!
117 if(HOV_ON) llSetText(HOVERTEXT,COLOR,1.0); //show hover text
118 if(OBJHIDE_ON) llSetLinkAlpha(LN,1.0,ALL_SIDES); //show object
119 SITTING = 0;
120 sitter = NULL_KEY;
121 }
122 }
123 }
124
127 if(HOV_ON) llSetText("",COLOR,1.0); //hide hover text
128 if(OBJHIDE_ON) llSetLinkAlpha(LN,0.0,ALL_SIDES); //hide object
129 llStopAnimation("sit"); //stop normal sit
130 llStartAnimation(animation); //and use this animation
131 }
132 }
133 }

Back to the Best Free Tools in Second Life and OpenSim.