Second Life Copybot
Gravity Controller - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Avatar Augmentation Scripts (https://secondlifecopybot.com/forum-51.html)
+----- Thread: Gravity Controller (/thread-791.html)



Gravity Controller - deadpool - 02-19-2013

What is it?

A gadget to control your personal gravity, this effects how fast you fall, how high you can jump etc. This type of thing is used in RP areas often, from gliding graciously from roof tops to leaping entire regions. I’ve added an option for skydivers, enabling a quick boost into the heavens via the ‘Skydive’ option.

How-to/Info:

•Copy paste the script below into a new script inworld.
•Save it & then put the script into an object (if not there already).
•Shrink the object so it fits on your screen, wear it as a HuD attachment.
•Touch it to bring up the control menu.
•This does not have to be a HuD, you can wear it on the body.

PHP Code:
//Do not sell this; Karma knowz where you live ☠
 
key User;
key Owner;
float Force;
float Volume 1.0;
integer Channel;
integer Handle;
list 
Options = ["Moon","*Normal*","Heavy","Crush","Feather","Space","•>>","^-SkyDive-^","< <•","---","<<•>>","+++"];
Menu(){
    
Handle llListen(Channel""Owner"");
    
string Info "\n*Select your desired level of Gravity; SkyDive will send you about 1000m up.\n*The +++ & --- options will increase or decrease your \"current\" gravity by a factor of 0.5\n\nNOTE>> Use the \"Normal\" option to restore normality =)";
    
llDialog(OwnerInfoOptionsChannel);
    
llSetTimerEvent(60.0);
}
 
default{
//
    
state_entry(){
        
Owner llGetOwner();
        
Channel = (integer)llFrand(DEBUG_CHANNEL) * -1;
    }
//
    
on_rez(integer total_number){
        if (
Owner != llGetOwner()){
            
llResetScript();
        }
    }
//
    
touch_start(integer t){
        
User llDetectedKey(0);
        if(
User == Owner){
            
llMessageLinked(LINK_THIS0"GRAVITY>>MENU",llGetOwner()); 
        }
    }
//
    
link_message(integer senderinteger numstring strkey id){
        if (
str == "GRAVITY>>MENU"){
            
llSetObjectName("Gravity Control");
            
Menu();
        }     
    }
//
    
timer(){//Remove lag/listen after llSetTimerEvent
        
llSetTimerEvent(0.0);//Dont want to keep stopping.. so we end the timer.
        
llListenRemove(Handle);//& do what timer is here for; remove listen/lag.
    
}
// 
    
listen(integer channelstring namekey idstring message){
        if (
llListFindList(Options, [message]) != -1){
            
float Mass llGetMass();
            if(
message == "+++"){
                
Force += 0.25;   
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,Force>, TRUE);
                
llOwnerSay("/me >> Gravity : " + (string)Force+" :");
                
Menu();//re-open the menu
            
}
            else if(
message == "---"){
                
Force -= 0.25;   
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,Force>, TRUE);
                
llOwnerSay("/me >> Gravity : " + (string)Force+" :");
                
Menu();
            }  
            else if(
message == "Moon"){
                
Force 6.5;   
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,Force>, TRUE);
                
llOwnerSay("/me >> Gravity : " + (string)Force+" :");
                
Menu();
            }
            else if(
message == "Heavy"){
                
Force = -9.8;   
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,Force>, TRUE);
                
llOwnerSay("/me >> Gravity : " + (string)Force+" :");
                
Menu();
            }
            else if(
message == "Feather"){
                
Force 9.25;   
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,Force>, TRUE);
                
llOwnerSay("/me >> Gravity : " + (string)Force+" :");
                
Menu();
            } 
            else if(
message == "Crush"){
                
Force 2147483647.0;   
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,-Force>, TRUE);
                
llOwnerSay("/me >> Gravity : " + (string)Force+" :");
                
Menu();
            }
            else if(
message == "Space"){ 
                
Force 9.8;   
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,Force>, TRUE);
                
llOwnerSay("/me >> Gravity : " + (string)Force+" :");
                
Menu();
            }
            else if(
message == "*Normal*"){
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,0>, TRUE);
                
llOwnerSay("/me >> Gravity : Normal (<0,0,0>) :");
            }                                                               
            else if(
message == "^-SkyDive-^"){
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,2147483647.0>, TRUE);
                
llOwnerSay("/me >> Gravity : SkyDive :");
                
llSleep(5.0);
                
llTriggerSound("be0cd87b-ae95-2fb5-6250-dcdd4d2ce732",Volume);
                
llSetForce(Mass*<0,0,0>, TRUE);
                
llOwnerSay("/me >> Gravity : Restored :\n       (Parachute on?..)");
                
llResetScript();
            }
        }
    }
//