Floating Name Script

//////////////////////////////
// Floating Name Script
//
// This script periodically updates
// the text above the object to 
// display the name of the object
//
// Written by Xylor
///////////////////////////////

vector OVERRIDE_COLOR = <0, 1, 1>;  // Cyan
integer gUseOverride = FALSE;

integer SIDE_TO_CHECK_COLOR = 0;
string gFloatingText;
integer gStringPos;
integer gStringSize;

float gLetterDelayBase = 0.1;
float gLetterDelayVar  = 1;

float gLineRepeatDelayBase = 2.5;
float gLineRepeatDelayVar  = 1;

key gOwner;

UpdateText() {
    string ObjName =  llGetObjectName();
    if (ObjName != gFloatingText) {
        gFloatingText = ObjName;
        gStringPos = 0;
        gStringSize = llStringLength(gFloatingText);
    }
}

vector GetTextColor() {
    // Override color?
    if (gUseOverride)
        return OVERRIDE_COLOR;
        
    vector RGB = llGetColor(SIDE_TO_CHECK_COLOR);
    
    // Rotate the Hue 180 degrees, and
    // invert the Luminance.
    RGB.x = 1.0 - RGB.x;
    RGB.y = 1.0 - RGB.y;
    RGB.z = 1.0 - RGB.z;
    
    
    return RGB;
}

default {
    state_entry() {
        gOwner = llGetOwner();
        UpdateText();
        llSetTimerEvent(0.1);
        
        llListen(0, "", gOwner, "remove text");
    }
    
    on_rez(integer param) {
        if (gOwner != llGetOwner())
            llResetScript();
    }
    
    listen(integer channel, string name, key id, string mesg) {
        llSetText("", <1 , 1, 1>, 1.0);
        llSetTimerEvent(0.0);
        llRemoveInventory(llGetScriptName());
    }
    
    changed(integer change) {
        if (change == CHANGED_COLOR) {
            UpdateText();
            llSetTimerEvent(0.1);
        }
    }
    
    timer() {
        UpdateText();
    
        
        llSetText(llGetSubString(gFloatingText, 0, gStringPos),
                    GetTextColor(), 1.0);
                    
        gStringPos++;
        if (gStringPos >= gStringSize) {
            gStringPos = 0;
            
            llSetTimerEvent( gLineRepeatDelayBase +
                            llFrand(gLineRepeatDelayVar));
            return;
        }
        llSetTimerEvent( gLetterDelayBase +
                        llFrand(gLetterDelayVar));
    }
}

 

Sci-Fi Combat System

The Sci-Fi Combat System (SFCS) is an RP system made to facilitate Sci-Fi Roleplay within Second Life.
Currently, it supports Star-Wars Roleplay, with future updates being added for Stargate Roleplay. (It may even allow the intermixing of the two.)

Commands:
/1 sfcs - Brings up SFCS Menu with these functions.
/1 help - Gives you this file.
/1 hud - Gives you the SFCS HUD
/1 fullreset - Resets all settings (color and title), as well as resetting health and stamina to 100%
/1 reset - Resets health and stamina to 100%
/1 color - Sets Color. Replace R, G and B with Values from 0 to 255. The brackets and commas are required
/1 title text - Sets your personal title. Replace text with your title. To clear the title, replace text with none.
/1 update - Looks for the next update.
/1 regen - Start Regeneration of Health from Stamina
/1 stopregen - Stop Regeneration of Health from Stamina (Before completion)To block (hold Up + Down simultaneously while not attacking (no holding the mouse button at the same time))

---You will also need a sleep and block animation for this Combat System to work properly.  Put the scripts in their own prim and the HUD script has its own prim and is placed inside the combat system prim:

Display Script:

key collided;
integer dead = 0;
integer health;
integer stamina;
integer blocking = 0;
string sfcs;
string title;
string owner;
string heal;
vector color;
integer tick;


fullinit()
{
    color = <253 , 225, 149> / 255;
    title = "";
    init();
}
init()
{
    llMessageLinked(LINK_THIS, 0, "stopregen", NULL_KEY);  
    tick = 0;
    owner = llToLower(llKey2Name(llGetOwner()));
    heal = "heal " + llGetSubString(owner, 0, 0);
    sfcs = "SFCS " + llGetSubString(llGetObjectName(), 21, -1);
    health = 100;
    stamina = 100;
    llListen(1, "", "", "");
    llListen(532254, "", "", "");
    llListen(-690069, "", "", "");
    llListen(696969, "", "", "");
    updatehealth();
    llOwnerSay(sfcs + " Active. For Help/Commands, type /1 help. For the menu, type /1 sfcs");
}

updatehealth()
{
    string stats;
    if(health > 100)
    {
        health = 100;
    }
    else if(health <0)
    {
        health = 0;
    }
    if(stamina > 100)
    {
        stamina = 100;
    }
    else if(stamina <0)
    {
        stamina = 0;
    }
    if(health == 0)
    {
        die();
    }
    if(blocking == 0)
    {
       stats = sfcs + "\n";
    }
    else
    {
        stats = "Blocking....\n";
    }
    if(title != "")
    {
        stats += title + "\n";
    }
    stats += "Health: "+ (string)health + "% / Chakra: " + (string)stamina + "%";
    llShout(-696969, "color " + (string)color);
    llShout(-696969, (string)health + "," + (string)stamina);
    llSetText(stats, color, 1.0);
}

die()
{
    if(dead == 0)
    {
        dead = 1;
        llStartAnimation("sleep");
        llSetTimerEvent(0);
        llSay(0, llKey2Name(llGetOwner()) + " has been defeated");
    }
}
live()
{
    llStopAnimation("sleep");
    dead = 0;
    llSetTimerEvent(3);
}
block()
{
    llStartAnimation("block");
}
unblock()
{
    llStopAnimation("block");
}
healstam(integer damage)
{
    if(blocking == 1 && damage < 0)
    {
        stamina += damage;
    }
    else if(blocking == 0 && damage < 0)
    {
        health += damage;
    }
    else if(damage > 0)
    {
        if(health == 0)
        {
            live();
        }
        health += damage;
        stamina = 100;
    }
    
    updatehealth();
}
        
    

default
{
    state_entry()
    {
        fullinit();
    }
    run_time_permissions(integer perms)
    {
        if(perms & PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(CONTROL_ML_LBUTTON | CONTROL_LBUTTON | CONTROL_UP | CONTROL_FWD | CONTROL_BACK | CONTROL_ROT_LEFT | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_RIGHT | CONTROL_DOWN, TRUE, TRUE);
            init();
        }
        if(perms & PERMISSION_TRIGGER_ANIMATION)
        {
            live();
        }
    }
    attach(key attached)
    {
        if(attached != NULL_KEY)
        {
            llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
        }
    }
    collision_start(integer total)
    {
        if(llDetectedKey(0) != collided)
        {
            collided = llDetectedKey(0);
            if(llDetectedName(0) == "Fireball")
            {
                healstam(-10);
            }
            else if(llDetectedName(0) == "Pull")
            {
            }
            else if(llDetectedType(0) & ACTIVE && !(llDetectedType(0) & AGENT))
            {
                healstam(-2);
            }
        }
        
    }
    sensor(integer total)
    {
        integer i;
        for(i = 0; i  0)
                {
                    blocking = 1;
                    block();
                }
                else
                {
                    if(blocking == 1)
                    {
                        unblock();
                    }
                    blocking = 0;
                }
                updatehealth();
            }
//            else if((change & ~held & CONTROL_BACK) && (change & ~held & CONTROL_FWD))
            else
            {
                if(blocking == 1)
                {
                    unblock();
                }
                blocking = 0;
                updatehealth();
            }
        }
    }
    link_message(integer sender, integer num, string msg, key id)
    {
        if(msg == "regen")
        {
            if(health <100 && stamina > 0 && health > 0)
            {
                stamina -= 2;
                health += 2;
            }
            if(health >= 100 || stamina == 0 || health == 0)
            {
                llMessageLinked(LINK_THIS, 0, "stopregen", NULL_KEY);  
            }
                
            updatehealth();
        }
    }
    listen(integer chan, string name, key id, string msg)
    {
        string mesg;
        mesg = llToLower(msg);
        if(chan == 1)
        {
            if(llGetOwnerKey(id) == llGetOwner())
            {
                if(mesg == "reset")
                {
                    live();
                    init();
                }
                else if(mesg == "fullreset")
                {
                    live();
                    fullinit();
                }
                else if(mesg == "regen")
                {
                    llMessageLinked(LINK_THIS, 0, "startregen", NULL_KEY);
                }
                else if(mesg == "stopregen")
                {
                    llMessageLinked(LINK_THIS, 0, "stopregen", NULL_KEY);
                }
                else if(mesg == "help")
                {
                    llGiveInventory(llGetOwner(), "SFCS Help");
                }
                else if(llGetSubString(mesg, 0, 5) == "color ")
                {
                    color = (vector)llGetSubString(msg, 6, -1);
                    color /= 255;
                    updatehealth();
                }
                else if(llGetSubString(mesg, 0, 5) == "title ")
                {
                    title = llGetSubString(msg, 6, -1);
                    if(llToLower(title) == "none")
                    {
                        title = "";
                    }
                    updatehealth();
                }
            }
            
            if(llGetSubString(mesg, 0, 5) == heal)
            {
                if(health <100)
                {
                    healstam(10);
                }
                updatehealth();
            }
        }
        else if(chan == 532254 && llGetSubString(name, 0, 4) == "Force")
        {
            if(msg == (string)llGetOwner())
            {
                healstam(-2);
            }
            else if(msg == (string)llGetOwner() + "+")
            {
                healstam(5);
            }
        }
        else if(chan == 696969)
        {
            if(msg == (string)llGetOwner())
            {
                healstam(-5);
            }
            else if(msg == (string)llGetOwner() + "+")
            {
                healstam(5);
            }
            else if(llGetSubString(msg, 0, 35) == (string)llGetOwner())
            {
                healstam((integer)llGetSubString(msg, 36, -1));
            }
        }
        else if(chan == -690069)
        {
            if(msg == (string)llGetOwner())
            {
                healstam(-2);
            }
            else if(msg == "updatehp" && llGetOwnerKey(id) == llGetOwner())
            {
                updatehealth();
            }
        }
    }
        
}

Function Script:

default
{
    link_message(integer sender, integer num, string msg, key id)
    {
        if(msg == "startregen")
        {
            llSetTimerEvent(0.75);
        }
        else if(msg == "stopregen")
        {
            llSetTimerEvent(0.0);
        }
    }
    timer()
    {
        llMessageLinked(LINK_THIS, 0, "regen", NULL_KEY);
    }
}

Menu Script:
list menulist = ["Help", "HUD", "Update", "Regen", "Stopregen", "Reset", "FullReset"];

init()
{
    llListen(1, "", "", "");
}


default
{
    state_entry()
    {
        init();
    }
    attach(key attached)
    {
        if(attached != NULL_KEY)
        {
            init();
        }
    }
    listen(integer chan, string name, key id, string msg)
    {
        if(id == llGetOwner() && llToLower(msg) == "sfcs")
        {
            llDialog(llGetOwner(), "SFCS Menu", menulist, 1);
        }
        else if(id == llGetOwner() && llToLower(msg) == "hud")
        {
            llGiveInventory(llGetOwner(), "SFCS HUD");
        }
    }
}

Update Server Script:

string updateserver = "This email address is being protected from spambots. You need JavaScript enabled to view it.";
string password = "stargate-sg1x";
string version;
init()
{
    version = llGetSubString(llGetObjectName(), 21, -1);
    llListen(1, "", "", "");
    llOwnerSay("Performing Automatic Update Check");
    llEmail(updateserver, password, (string)llGetOwner() + version);
}
default
{
    attach(key attached)
    {
        if(attached != NULL_KEY)
        {
            init();
        }
    }
    listen(integer chan, string name, key id, string mesg)
    {
        string msg = llToLower(mesg);
        if(id == llGetOwner() && msg == "update")
        {
            llEmail(updateserver, password, (string)llGetOwner() + version);
        }
    }
}

 

SCFS HudScript (This goes in ites own prim):

string updateserver = "This email address is being protected from spambots. You need JavaScript enabled to view it.";
string password = "stargate-sg1x";
string version;
init()
{
    version = llGetSubString(llGetObjectName(), 21, -1);
    llListen(1, "", "", "");
    llOwnerSay("Performing Automatic Update Check");
    llEmail(updateserver, password, (string)llGetOwner() + version);
}
default
{
    attach(key attached)
    {
        if(attached != NULL_KEY)
        {
            init();
        }
    }
    listen(integer chan, string name, key id, string mesg)
    {
        string msg = llToLower(mesg);
        if(id == llGetOwner() && msg == "update")
        {
            llEmail(updateserver, password, (string)llGetOwner() + version);
        }
    }
}

 

 

 

 

Flip Title Script

//Just somthing useful I grabbed off the net!  Cheers!
//1.    Create a box. You will need a place to build – e.g. a sandbox.
//a.    Drag a box to ground with your mouse
//b.    In the editing pane, type a descriptive name (like “mytitle”) in the name textbox in the general tab – this //is the pane shown on the right of this figure.
//c.    Now squeeze up the box into a vertical bar:
//i.    Click on box, edit
//ii.    Hold down shift and ctrl, with mouse move red and green knobs until the box is vertical bar.
//iii.    Click on the texture tab in the editing pane. Change transparency box to 90% -- uh, oh – what happened, now you can’t see it. To see it hold down ctrl and alt and press T – it shows hidden objects. Look where the vertical bar is – you can now see it.
//d.    Now, click on the Content Tab, click on New Script button, click on the “New Script”, replacing the code that is already the “New Script as a place holder.with the code at the end of this article.
//e.    Try out – type in the text box – title red yourname …..(e.g. title red john) – as shown in the figure.
//f.    Now return the title to your inventory. Click on it, and select “take” – it will appear under objects in your inventory.
//g.    Open your inventory and right click on the object – title – and right click and then “attach to” and “skull” – this works fine, but you may want to put it elsewhere. – Note, if you attach to your arm, your name will float and move around continuously. With it attached to your skull, it will simply float over your head.
//h.    Notice it may be too high (probably will be), click on the vertical bar (which you will have to have selected ctrl-alt-T to be able to see, right click edit and move the name down to just above your head.
//i.    Voila- you are done. When you don’t want to have your name, just detect it, or type title off in the text box.
//j.    You can change what the title says at any time – e.g. “title blue John Bourne, Ph.D
//k.    Note that the object will continue to retain this information until you change it.



string command = "";
string person = "";
key owner;

default
{
state_entry()
{
owner = llGetOwner();
llListen(0,"",owner,"");
}

attach(key attached)
{
if (attached != NULL_KEY)
{
llInstantMessage(owner,"To set a title: title ");
llInstantMessage(owner,"To remove title: title off");
llInstantMessage(owner," can be: white, black, red, green, blue, pink, cyan, purple, yellow, orange");
llResetScript();
}
}

listen(integer channel, string name, key id, string message)
{
list strings = llParseString2List(message,[" "],[]);
string command=llList2String(strings,0);
string string1=llList2String(strings,1);
if(command=="title")
{
vector color=<0,0,0>;
if(string1=="blue")
{
color=<0,0,1>;
}
else if(string1=="orange")
{
color=<1 ,0.5,0>;
}
else if(string1=="cyan")
{
color=<0,1,1>;
}
else if(string1=="pink")
{
color=<1 ,0,1>;
}
else if(string1=="green")
{
color=<0,1,0>;
}
else if(string1=="red")
{
color=<1 ,0,0>;
}
else if(string1=="white")
{
color=<1 ,1,1>;
}
else if(string1=="yellow")
{
color=<1 ,1,0.1>;
}
else if(string1=="purple")
{
color=<0.7,0,0.7>;
}
else if(string1=="gblue")
{
color=<0,0.5,1>;
}
else
{
color=<0,0,0>;
}
string title = "";
integer i;
for(i=2; i<=12; i++)
{
if(llStringLength(llList2String(strings,i)))
{
title = title + llList2String(strings,i) + " ";
}
}
if(title == "off")
{
llSetText("",<0,0,0>,1.0);
} else {
llSetText(title, color, 1.0);
}
}
}
}