Simple Voting Script

Expired

//  Voting script, only allows one vote per avi
//  by JB Kraft
 
 
string thankYouMessage = "Thanks for voting";
string floatText = "Vote for me!";
 
 
//  _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//  _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
integer numberOfVotes;
list listOfVoterNames;
 
update_floattext()
{
//  set white and opaque floattext
    llSetText(floatText + "\n"
        + (string)numberOfVotes + " votes", <1 .0, 1.0, 1.0>, (float)TRUE);
}
 
integer added_vote(key id)
{
//  cut list if memory shortage
    if(llGetFreeMemory() <5000)
        listOfVoterNames = llList2List(listOfVoterNames, -50, -1);
 
    string avatarLegacyName = llKey2Name(id);
 
//  TRUE if found, else FALSE
//  watch out, this is bit-wise NOT (~) not minus (-)
    integer thisAvatarHasVotedAlready = ~llListFindList(listOfVoterNames, [avatarLegacyName]);
 
    if (thisAvatarHasVotedAlready)
        return FALSE;
//  else
//  {
        listOfVoterNames += [avatarLegacyName];
        numberOfVotes = llGetListLength(listOfVoterNames);
 
        update_floattext();
 
        return TRUE;
//  }
}
 
default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
 
    state_entry()
    {
        update_floattext();
    }
 
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
 
 
        if( added_vote(id)  && thankYouMessage != "" )
            llInstantMessage(id, thankYouMessage);
    }
}

 

ABC Text

Expired

I found this on Linda Kellie Building Supply Sim. I makes a particle word banner so you only need 2 Prims!:

ABC Text

//////////////////////////////////////////////////////////////////// 
//
//  AbcText
//  by Ange Capalini
//  Originally Written  10/31/2011
//  code released to the public domain
// 
//////////////////////////////////////////////////////////////////// 
 
 
//==================================================================
//               INSTRUCTIONS
//==================================================================
//
//  - set Max Particles to 4096
//  - create white cube "board" <15 .500, 0.010, 0.800>
//  - create red cube "cursor" <0.050, 0.010, 0.030> & drop AbcText
//  - link cursor (child) to board (root)
//  - send message <= 25 char. to chanel 20
//  - that's all folk's
//
/////////////////////////////////////////////////////////////////////
 
 
//===========================================
//               CONSTANTS
//===========================================
float  Size_Point = 0.1; //pixel size
string Txt_Point = "";  //pixel texture
vector Color_Point = < 0., 0., 1. >; //pixel color
vector Size_Affich = <15 .5, .01, .8>; //display size
 
//===========================================
//           GLOBALS VARIABLES
//===========================================
list Alphabet = [   " ",
                    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
                    "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
 
                    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
                    "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
 
                    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", 
 
                    ":", "'", ",", "!", "?", "#", ".", "/", "-", "é", "è", "à"     ];
 
//char matrix 6 x 5 points
list Matrices = [ " ", 
                    "011001001010010111101001000000", //A
                    "111001001011100100101110000000",
                    "011001000010000100000110000000",
                    "111001001010010100101110000000",
                    "111001000011100100001110000000",
                    "111001000011100100001000000000",
                    "011101000010110100100111000000",
                    "100101001011110100101001000000",
                    "111000100001000010001110000000",
                    "001100001000010100100110000000",
                    "100101010011000101001001000000",
                    "100001000010000100001110000000",
                    "100011101110101100011000100000",
                    "100101101010110100101001000000",
                    "011001001010010100100110000000",
                    "111001001010010111001000000000",
                    "011001001010010100100110000010",
                    "111001001010010111001001000000",
                    "011101000001100000101110000000",
                    "111000100001000010000100000000",
                    "100101001010010100100110000000",
                    "100101001010100101000100000000",
                    "100011010110101101010101000000",
                    "100101001001100100101001000000",
                    "100101001001110000100110000000",
                    "111100001001100100001111000000", //Z
 
                    "000000110010010100100111000000", //a
                    "100001110010010100101110000000",
                    "000000110010000100000110000000",
                    "000100111010010100100111000000",
                    "000000111010010101000111000000",
                    "011001000011000100001000000000",
                    "011001001010010011100001001100",
                    "100001110010010100101001000000",
                    "100000000010000100001000000000",
                    "001000000000100001000010011000",
                    "100001001010100110101001000000",
                    "100001000010000100001000000000",
                    "000001101010101101011010100000",
                    "000001110010010100101001000000",
                    "000000110010010100100110000000",
                    "111001001010010111001000010000",
                    "011101001010010011100001000010",
                    "000001010011000100001000000000",
                    "000000111011000001101110000000",
                    "010001110001000010000100000000",
                    "000001001010010100100111000000",
                    "000001001010010100100110000000",
                    "000001010110101101010101000000",
                    "000001001001100011001001000000",
                    "100101001010010011100001001100",
                    "000001111000100010001111000000", //z
 
                    "011001001010010100100110000000", //0
                    "011000010000100001000010000000",
                    "111000001001100100001111000000",
                    "111000001001100000101110000000",
                    "001000110010100111100010000000",
                    "111101000011100000101110000000",
                    "011001000011100100100110000000",
                    "111100001000100010000100000000",
                    "011001001001100100100110000000",
                    "011001001001110000100110000000", //9
 
                    "000000000000100000000010000000", //:
                    "000100010000000000000000000000",
                    "000000000000000000100010000000",
                    "001000010000100000000010000000",
                    "001000101000010001000000000100",
                    "010101111101010111110101000000", 
                    "000000000000000000000010000000", 
                    "000010001000100010001000000000", 
                    "000000000001110000000000000000", 
                    "000100110010010101000111000000",
                    "010000111010010101000111000000",
                    "010000110010010100100111000000"  //à
                    ];
 
list    Particle_Parameters=[];
vector  Origine;
string  Texte;
integer id_Phrase;
integer len_Phrase;
integer id_Lettre;
string  Lettre;
string  matrice_Lettre;
vector  point_zero;
integer x;
integer z;
 
//===========================================
//        SET PARTICLES
//===========================================
 
init_particles(){
 
    Particle_Parameters = [  
           PSYS_SRC_TEXTURE, Txt_Point, 
           PSYS_PART_START_SCALE, , 
           PSYS_PART_END_SCALE,   , 
           PSYS_PART_START_COLOR, Color_Point,    
           PSYS_PART_END_COLOR,   Color_Point, 
 
           PSYS_SRC_BURST_PART_COUNT, (integer)1, 
           PSYS_SRC_BURST_RATE, (float) 0.0,  
           PSYS_PART_MAX_AGE, (float) 30.0, 
 
           PSYS_SRC_PATTERN, (integer) 1,
 
           PSYS_PART_FLAGS,
           PSYS_PART_EMISSIVE_MASK
           ];
}
 
//===========================================
//          SET DISPLAY
//===========================================
affichage (string phrase) {
 
    integer len_Phrase = llStringLength(phrase)-1;  
    for(id_Phrase = 0; id_Phrase <= len_Phrase;++id_Phrase){ 
        Lettre = llGetSubString(phrase, id_Phrase, id_Phrase);
        id_Lettre = llListFindList(Alphabet, [Lettre]);
        matrice_Lettre = llList2String(Matrices, id_Lettre); 
        z=0; 
        do{ 
            x=0;
            do{
                if( (integer)llGetSubString(matrice_Lettre, x + 5*z, x + 5*z) ) {
                    llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, point_zero + < x*Size_Point, 0.0, -z*Size_Point > ]);
                    llParticleSystem( Particle_Parameters );
                    llSleep(0.12);
                    llParticleSystem( [] );
                }
            } while( ++x <= 4);
        } while( ++z <= 5);
 
        point_zero += < 6. * Size_Point, 0.0, 0.0 >; //locate next char
    }
}
/////////////////////////////////////
///////////////////////////////////// 
/////////////////////////////////////
/////////////////////////////////////
 
 
default {
 
    state_entry() {
 
        llListen(20, "", llGetOwner(), "");
        init_particles(); 
        Origine = <(-0.48 * Size_Affich.x) , (-1.25 * Size_Point) , (0.3 * Size_Affich.z)  >; //raz cursor
    }
 
    listen( integer channel, string name, key id, string msg ) {
 
        Texte = msg;
        point_zero = Origine;    //raz cursor         
        llSetTimerEvent(30.);
        affichage(Texte);
    } 
 
    timer(){
 
        point_zero = Origine;  //raz cursor
        affichage(Texte);
    }
 
    on_rez(integer param) {llResetScript();}
    changed(integer mask) {if(mask & CHANGED_OWNER) {llResetScript();}} 
 
}

 

Information Kiosk

Expired

integer    t;
integer    hours;
integer    minutes;
integer    seconds;

default

{
    touch_start(integer param)
    {
        t = (integer)llGetWallclock(); // seconds since midnight

        // one hour has 3600 seconds
        hours = t / 3600; // get hours (integer division chops off the decimals)

        // the modulo operator % gets the remainder of a divison
        // in this case, the remaining seconds after removing the full hours
        minutes = (t % 3600) / 60; // divide by 60 because we want minutes, chops off decimals again
        seconds = t % 60; // get the seconds that didn't fit into full minutes

        llInstantMessage(llGetOwner(), "Touched on " + llGetDate() + " at " + (string)hours + ":" +(string)minutes + " by " + llDetectedName(0));
        //Above line Messages the object owner with the date/time/name of who touched the object.
        
        llGiveInventory(llDetectedKey(0),"NAME_OF_OBJECT_TO_GIVE"); //What is given when the object is touched.
    }
    

//    on_rez(integer start_param)
//    {
//        llSetText(llGetObjectName(), <1 ,1,1>, 1.5); //Pulls the name of the object when rezzed and makes it floating text.
//          // Normally you would use state_entry to show floating text, but with llGetObjectName you want it on_rez so it updates.
//    }  

}

 

Blaze's Tip Jar

Expired

integer totaldonated;
string owner;

default
{
    on_rez( integer sparam )
    {
        llResetScript();
    }
    state_entry()
    {
        owner = llKey2Name( llGetOwner() );
        llSetText( owner + "'s Tip Jar.\nFuzion Technologies \n$L0 Donated so far",<.25,1,.65>,1);
    }

    money(key id, integer amount)
    {
        totaldonated += amount;
        llSetText( owner + "'s Tip Jar.\nFuzion Technologies;)\n$L" + (string)amount + " Was donated last!\n" + "$L" + (string)totaldonated + " Donated so far",<.25,1,.65>,1);
        llInstantMessage(id,"Thanks for the donation!");
        llInstantMessage(llGetOwner(),(string)llKey2Name(id)+" donated $" + (string)amount);
    }
}