Simple Friendship Bracelet

From Lucinda Bulloch:

someone asked me to make this script. It just sends out a string that others with the same script can pick up. Copy and paste this into a blank script and load that script into an object.  Rename the object Friendship Braclet then edit the object description with a list of words seperated by commers. When its on anyone with the same words, they will be told you are near.  Fun thing for finding people with the same interest it has help built in and is self contained.

integer on = 0;
list levelnames = ;
integer chatchannel = 7;
integer bracletchannel = -2345678;
integer level = 0;
integer scantime = 10;
list namestore = [];
list preffstore = [];
default
{
   on_rez(integer param)
    {
     llResetScript();
    }  
   state_entry()
    {
     llOwnerSay("Commands - Type /"+(string)chatchannel+" option - options are - "+llDumpList2String(levelnames," | "));  
     llOwnerSay("Set to "+llList2String(levelnames,on)+ " - Level set to "+llList2String(levelnames,level+2));
     llListen(bracletchannel,"Friendship Braclet","","");
     llListen(chatchannel,"",llGetOwner(),"");
    }
   timer()
    {
     string sendstring = llGetObjectDesc();  
     if(level == 3)llRegionSay(bracletchannel,sendstring);
     else if(level == 2)llShout(bracletchannel,sendstring);
     else if(level == 1)llSay(bracletchannel,sendstring);
     else llWhisper(bracletchannel,sendstring); 
    }
   listen(integer chan, string name, key id, string option)
    {
     if(chan == chatchannel)
      {
       integer ix  = llListFindList(levelnames,);  
       if(ix != -1)
        {
         if(ix<2 )on = ix;
         else if(ix<6)level = ix-2;
         else if(ix == 6)llOwnerSay("Commands - Type /"+(string)chatchannel+" option - options are - "+llDumpList2String(levelnames," | "));
         else if(ix == 7){namestore = [];preffstore = [];}
         else
          {
           integer x;
           for(x=0; x 2) llSetTimerEvent(on*scantime); 
         else{llOwnerSay("NO PREFFS SET - Please add your preffs seperated with commers in the description field of the object");on = 0;}
         llOwnerSay("Set to "+llList2String(levelnames,on)+ " - Level set to "+llList2String(levelnames,level+2));
        }  
      }
     if(chan == bracletchannel)
      {
       integer ix  = llListFindList(namestore,);  
       if(ix == -1)
        {  
         list matchpreffs = [];
         list preffs = llCSV2List(llGetObjectDesc());  
         list returnpreffs = llCSV2List(option);
         integer x;
         for(x=0; x

 

Add a comment

'Sploder Script

list entrantsKey = [];
integer pot = 0;
float ownersCut = 10;
integer amountLimit = 5;
float TimeLimit = 300;
integer entrantsCount = 0;
integer flag = 0;
integer i;
integer result = 0;
string Text = "";
key chave;
integer amount;
integer min_pay = 0; //minimum amount to pay ppl. Exemple, if you change this value to 2, everyone will receive at least 2 L$

string gName = "*Config";
integer gLine = 0;        // current line number
key gQueryID; // id used to identify dataserver queries
string teste = "";

integer RandInt(integer lower, integer higher) {
    integer Range = higher - lower;
    integer Result = llFloor(llFrand(Range + 1)) + lower;
    return Result;
}


MakeParticles()//This is the function that actually starts the particle system.
{     
    llParticleSystem([                                                         //KPSv1.0  
        PSYS_PART_FLAGS , 0 //Comment out any of the following masks to deactivate them
    | PSYS_PART_INTERP_COLOR_MASK       //Colors fade from start to end
    | PSYS_PART_INTERP_SCALE_MASK       //Scale fades from beginning to end
    | PSYS_PART_FOLLOW_VELOCITY_MASK    //Particles are created at the velocity of the emitter
    | PSYS_PART_EMISSIVE_MASK           //Particles are self-lit (glow)
    
    ,PSYS_SRC_PATTERN   
    ,PSYS_SRC_PATTERN_EXPLODE
    ,PSYS_SRC_TARGET_KEY,        llGetOwner()
    ,PSYS_SRC_TEXTURE,           "cifrao"     //UUID of the desired particle texture  
    ,PSYS_PART_MAX_AGE,          2.5                //Lifetime, in seconds, that a particle lasts
    ,PSYS_SRC_BURST_RATE,        .5            //How long, in seconds, between each emission
    ,PSYS_SRC_BURST_PART_COUNT,  10       //Number of particles per emission
    ,PSYS_SRC_BURST_RADIUS,      1.0                //Radius of emission
    ,PSYS_SRC_ACCEL,             <1 .0,1.0,0.0>      //Acceleration of particles each second
    ,PSYS_PART_START_ALPHA,      1.0       //Starting transparency, 1 is opaque, 0 is transparent.
    ,PSYS_PART_END_ALPHA,        0.0                //Ending transparency
    ,PSYS_PART_START_SCALE,      <.35,.35,.35>      //Starting particle size
    ,PSYS_PART_END_SCALE,        <0.35,0.35,0.35>      //Ending particle size, if INTERP_SCALE_MASK is on
    ,PSYS_SRC_OMEGA,             <1 .0,0.0,0.0>       //Rotation of ANGLE patterns, similar to llTargetOmega()
            ]);
}


start()
{
    llSetTimerEvent(0);
    entrantsKey = [];
    result = 0;
    entrantsCount = 0;
    flag = 0;
    llParticleSystem([]);
    Text = "Pay the sploder to begin the countdown! (minimun L$ "+ (string)amountLimit +")";
    llSetText(Text, <0, 1.0, 0>,  1); 
}

default
{
    
    on_rez(integer num)
    {
        llResetScript();
    }
    
    state_entry()
    {
        gQueryID = llGetNotecardLine(gName, gLine);
        //start();
        llListen(7, "", llGetOwner(), "");
        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
    }
    

    dataserver(key query_id, string data) 
    {      
        if (query_id == gQueryID) 
        {
            if (data != EOF) 
            {    // not at the end of the notecard 
                
                if (teste == "ownercut")
                ownersCut = (integer)data;
                if (teste == "minimumpay")
                amountLimit = (integer)data;
                if (teste == "timelimit")
                TimeLimit = (float)data;             
                   
                if (llToLower(data) == "[ownercut]")  
                {
                    ++gLine;
                    gQueryID = llGetNotecardLine(gName, gLine);    // request next line
                    teste = "ownercut";   
                }
                else if (llToLower(data)== "[minimumpay]") 
                {
                    ++gLine;
                    gQueryID = llGetNotecardLine(gName, gLine);    // request next line 
                    teste = "minimumpay";   
                } 
                else if (llToLower(data) == "[timelimit]") 
                {
                    ++gLine;
                    gQueryID = llGetNotecardLine(gName, gLine);    // request next line 
                    teste = "timelimit";   
                }                              
                else 
                {
                    ++gLine;                // increase line count
                    gQueryID = llGetNotecardLine(gName, gLine);    // request next line
                    teste = "";
                }
            }
            else start();
        }
    }  
    
    
    
    money(key giver, integer amount) 
    {
        if (amount = 5)
            {
                llSetText("Ready to explode!!! Current pot is L$ "+ (string)pot, <0, 1.0, 0>,  1);
                if (flag == 0)
                {
                    llSay(0, "SPLODER'S COUNTDOWN BEGINS!");
                    llSay(0, (string)(llRound(TimeLimit)) + " seconds before it explodes!!!");
                    llSetText("Ready to explode!!! Current pot is L$ "+ (string)pot, <0, 1.0, 0>,  1);
                    llSetTimerEvent(TimeLimit);
                    flag = 1;
                }
                    
            }
            else
            {
            string message = ((string)(5 - entrantsCount)) +" more participants needed to begin countdown!"; 
            llSay(0, message);
            llSetText(Text + "\n" + message, <0, 1.0, 0>,  1);
            }
        }        
        
    }
    
    timer()
    {            
        for (i=9; i > 0; i--)
        {
            llSay(0, "Exploding in "+ (string)i);
            llSleep(1.0);
        }

        list payment = [];
        integer cut_pot = 0;
        float cut = 0;        
        cut = ownersCut/100;
        cut = cut * pot;   
        cut_pot = pot - (integer)cut;            

        
        for (i=0; i 0)
        {            
            j = RandInt(0, (entrantsCount - 1));
            integer rand;
            rand = RandInt(1, cut_pot);
            value = ((integer)llList2String(payment, j));
            value += rand;            
            //llOwnerSay("value: " + (string)value + "  j:" + (string)j); //just for debugging
            payment = llListReplaceList(payment, [value], j, j);            
            cut_pot -= rand;                               
        }
            
        //pot = cut_pot;        
        pot = 0;

        
        MakeParticles(); 
        
        for (i=0; i

 

Add a comment

Hunt The Wumpus!

//////////////////////////////////////////////////////////////////////////////
//
// _ _________ _________ _______
// |\ /||\ /|( ( /|\__ __/ \__ __/|\ /|( ____ \
// | ) ( || ) ( || \ ( | ) ( ) ( | ) ( || ( \/
// | (___) || | | || \ | | | | | | | (___) || (__
// | ___ || | | || (\ \) | | | | | | ___ || __)
// | ( ) || | | || | \ | | | | | | ( ) || (
// | ) ( || (___) || ) \ | | | | | | ) ( || (____/\
// |/ \|(_______)|/ )_) )_( )_( |/ \|(_______/
//
// _______ _______ _______
// |\ /||\ /|( )( ____ )|\ /|( ____ \
// | ) ( || ) ( || () () || ( )|| ) ( || ( \/
// | | _ | || | | || || || || (____)|| | | || (_____
// | |( )| || | | || |(_)| || _____)| | | |(_____ )
// | || || || | | || | | || ( | | | | ) |
// | () () || (___) || ) ( || ) | (___) |/\____) |
// (_______)(_______)|/ \||/ (_______)\_______)
//
// Version 1.0
//
// October 13, 2007
//
// COPYRIGHT:
//
// "Hunt the Wumpus" (LSL Port)
// Copyright (C) 2007 Hugsy Penguin
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// ORIGINAL CONCEPT:
//
// By: Gregory Yob circa 1973
// Published By: People's Computer Company
// Published In: newsletter dated November 1973
//
// Republished:
//
// Magazine: Creative Computing
// Issue: September/October 1975
// Article: "Hunt the Wumpus"
// By: Gregory Yob
//
// "The Best of Creative Computing Volume 1"
// Edited by David H. Ahl
// 1976
// ISBN O-916688-01-1
//
/////////////////////////////////////////////////////////////////////////////
 
//---------------------------------------------------------------------------
// Globals
//---------------------------------------------------------------------------
integer gDEBUG = FALSE;
 
list gCave;
integer gLocPlayer;
integer gHoldPlayer;
integer gLocWumpus;
integer gHoldWumpus;
integer gLocPit1;
integer gHoldPit1;
integer gLocPit2;
integer gHoldPit2;
integer gLocBat1;
integer gHoldBat1;
integer gLocBat2;
integer gHoldBat2;
integer gNumArrows;
integer gStatus;
 
//
// Debug method(s)
//
DBGPrintLocs()
{
llSay(0, "gLocPlayer = " + (string)gLocPlayer);
llSay(0, "gLocWumpus = " + (string)gLocWumpus);
llSay(0, "gLocPit1 = " + (string)gLocPit1);
llSay(0, "gLocPit2 = " + (string)gLocPit2);
llSay(0, "gLocBat1 = " + (string)gLocBat1);
llSay(0, "gLocBat2 = " + (string)gLocBat2);
}
 
//
// Initialize the script.
//
Initialize()
{
llSetObjectName("");
 
//setup cave (dodecahedral node list)
gCave = [
2,5,8,
1,3,10,
2,4,12,
3,5,14,
1,4,6,
5,7,15,
6,8,17,
1,7,9,
8,10,18,
2,9,11,
10,12,19,
3,11,13,
12,14,20,
4,13,15,
6,14,16,
15,17,20,
7,16,18,
9,17,19,
11,18,20,
13,16,19];
 
SetupNewGame(FALSE);
}
 
SetupNewGame(integer restore)
{
gNumArrows = 5;
gStatus = 0;
 
if (restore == TRUE)
{
gLocPlayer = gHoldPlayer;
gLocWumpus = gHoldWumpus;
gLocPit1 = gHoldPit1;
gLocPit2 = gHoldPit2;
gLocBat1 = gHoldBat1;
gLocBat2 = gHoldBat2;
}
else
{
//player location
gLocPlayer = (integer)(llFrand(20) + 1);
 
//wumpus location
integer done = FALSE;
while (!done)
{
gLocWumpus = (integer)(llFrand(20) + 1);
if (gLocWumpus != gLocPlayer)
done = TRUE;
}
 
//pit 1 location
done = FALSE;
while (!done)
{
gLocPit1 = (integer)(llFrand(20) + 1);
if ((gLocPit1 != gLocPlayer) &&
(gLocPit1 != gLocWumpus))
{
done = TRUE;
}
}
 
//pit 2 location
done = FALSE;
while (!done)
{
gLocPit2 = (integer)(llFrand(20) + 1);
if ((gLocPit2 != gLocPlayer) &&
(gLocPit2 != gLocWumpus) &&
(gLocPit2 != gLocPit1))
{
done = TRUE;
}
}
 
//bat 1 location
done = FALSE;
while (!done)
{
gLocBat1 = (integer)(llFrand(20) + 1);
if ((gLocBat1!= gLocPlayer) &&
(gLocBat1!= gLocWumpus) &&
(gLocBat1!= gLocPit1) &&
(gLocBat1!= gLocPit2))
{
done = TRUE;
}
}
 
//bat 2 location
done = FALSE;
while (!done)
{
gLocBat2 = (integer)(llFrand(20) + 1);
if ((gLocBat2!= gLocPlayer) &&
(gLocBat2!= gLocWumpus) &&
(gLocBat2!= gLocPit1) &&
(gLocBat2!= gLocPit2) &&
(gLocBat2!= gLocBat1))
{
done = TRUE;
}
}
 
gHoldPlayer = gLocPlayer;
gHoldWumpus = gLocWumpus;
gHoldPit1 = gLocPit1;
gHoldPit2 = gLocPit2;
gHoldBat1 = gLocBat1;
gHoldBat2 = gLocBat2;
}
}
 
//
// Returns the room based on given values:
//
// x = room number (range: 1-20)
// y = adjacent room index (range: 1-3)
//
integer RoomAt(integer x, integer y)
{
x--;
y--;
integer index = (x * 3) + y;
return llList2Integer(gCave, index);
}
 
//
// Print player location and nearby hazards
//
PrintLocAndHaz()
{
if (gDEBUG == TRUE)
DBGPrintLocs();
 
integer i;
 
//check for wumpus
for (i = 1; i <4; i++)
{
if (RoomAt(gLocPlayer, i) == gLocWumpus)
{
llSay(0, "I SMELL A WUMPUS!");
}
}
 
//check for pit 1
for (i = 1; i < 4; i++)
{
if (RoomAt(gLocPlayer, i) == gLocPit1)
{
llSay(0, "I FEEL A DRAFT");
}
}
 
//check for pit 2
for (i = 1; i < 4; i++)
{
if (RoomAt(gLocPlayer, i) == gLocPit2)
{
llSay(0, "I FEEL A DRAFT");
}
}
 
//check for bat 1
for (i = 1; i < 4; i++)
{
if (RoomAt(gLocPlayer, i) == gLocBat1)
{
llSay(0, "BATS NEARBY!");
}
}
 
//check for bat 2
for (i = 1; i < 4; i++)
{
if (RoomAt(gLocPlayer, i) == gLocBat2)
{
llSay(0, "BATS NEARBY!");
}
}
 
llSay(0, "YOU ARE IN ROOM " + (string)gLocPlayer);
llSay(0, "TUNNELS LEAD TO " + (string)RoomAt(gLocPlayer, 1)
+ " " + (string)RoomAt(gLocPlayer, 2)
+ " " + (string)RoomAt(gLocPlayer, 3));
 
}
 
integer MoveWumpus()
{
integer dir = (integer)(llFrand(4) + 1);
 
if (dir != 4)
{
gLocWumpus = RoomAt(gLocWumpus, dir);
}
 
if (gLocPlayer == gLocWumpus)
{
llSay(0, "TSK TSK TSK- WUMPUS GOT YOU!");
return -1;
}
 
return 0;
}
 
//---------------------------------------------------------------------------
// Globals for shooting
//---------------------------------------------------------------------------
 
integer gShootingNumRooms;
integer gShootingRoom1;
integer gShootingRoom2;
integer gShootingRoom3;
integer gShootingRoom4;
integer gShootingRoom5;
integer gShootingCurRoom;
 
SetShootingRoom(integer index, integer value)
{
if (index == 1) gShootingRoom1 = value;
if (index == 2) gShootingRoom2 = value;
if (index == 3) gShootingRoom3 = value;
if (index == 4) gShootingRoom4 = value;
if (index == 5) gShootingRoom5 = value;
}
 
integer GetShootingRoom(integer index)
{
if (index == 1) return gShootingRoom1;
if (index == 2) return gShootingRoom2;
if (index == 3) return gShootingRoom3;
if (index == 4) return gShootingRoom4;
if (index == 5) return gShootingRoom5;
return 0;
}
 
ShootArrow()
{
integer loc = gLocPlayer;
integer i;
integer j;
 
for (i = 1; i <= gShootingNumRooms; i++)
{
//determine which room to check next
integer validRoom = FALSE;
for (j = 1; j <= 3; j++)
{
if (RoomAt(loc, j) == GetShootingRoom(i))
{
validRoom = TRUE;
loc = GetShootingRoom(i);
}
}
 
if (!validRoom)
{
loc = RoomAt(loc, (integer)(llFrand(3) + 1));
}
 
//check the room for wumpus or player
if (loc == gLocWumpus)
{
llSay(0, "AHA! YOU GOT THE WUMPUS!");
gStatus = 1;
}
else if (loc == gLocPlayer)
{
llSay(0, "OUCH! ARROW GOT YOU!");
gStatus = -1;
}
 
//return if in win or lose state
if (gStatus != 0)
return;
}
 
llSay(0, "MISSED");
 
//move wumpus
gStatus = MoveWumpus();
if (gStatus != 0)
return;
 
//ammo check
gNumArrows--;
if (gNumArrows == 0)
gStatus = -1;
}
 
//---------------------------------------------------------------------------
// Globals for moving
//---------------------------------------------------------------------------
 
MoveTo(integer loc)
{
gLocPlayer = loc;
 
if (gLocPlayer == gLocWumpus)
{
llSay(0, "... OOPS! BUMPED A WUMPUS!");
gStatus = MoveWumpus();
}
else if ((gLocPlayer == gLocPit1) || (gLocPlayer == gLocPit2))
{
llSay(0, "YYYIIIIEEEE . . . FELL IN PIT");
gStatus = -1;
}
else if ((gLocPlayer == gLocBat1) || (gLocPlayer == gLocBat2))
{
llSay(0, "ZAP--SUPER BAT SNATCH! ELSEWHEREVILLE FOR YOU!");
MoveTo((integer)(llFrand(20) + 1));
}
}
 
//################################################## ##########################
//
// GAME STATES
//
//################################################## ##########################
 
//----------------------------------------------------------------------------
// state default
//----------------------------------------------------------------------------
default
{
state_entry()
{
Initialize();
state instructions;
}
 
on_rez(integer start_param)
{
Initialize();
state instructions;
}
}
 
//----------------------------------------------------------------------------
// state instructions
//----------------------------------------------------------------------------
state instructions
{
state_entry()
{
llSay(0, "INSTRUCTIONS (Y-N)?");
llListen(0, "", llGetOwner(), "");
}
 
on_rez(integer start_param)
{
state default;
}
 
listen(integer channel, string name, key id, string message)
{
if (llToLower(message) != "n")
{
llSay(0, "WELCOME TO 'HUNT THE WUMPUS'");
llSay(0, " ");
llSay(0, " THE WUMPUS LIVES IN A CAVE OF 20 ROOMS. EACH ROOM");
llSay(0, "HAS 3 TUNNELS LEADING TO OTHER ROOMS. (LOOK AT A");
llSay(0, "DODECAHEDRON TO SEE HOW THIS WORKS-IF YOU DON'T KNOW");
llSay(0, "WHAT A DODECAHEDRON IS, ASK SOMEONE)");
llSay(0, " ");
llSay(0, " HAZARDS:");
llSay(0, " BOTTOMLESS PITS - TWO ROOMS HAVE BOTTOMLESS PITS IN THEM");
llSay(0, " IF YOU GO THERE, YOU FALL INTO THE PIT (&LOSE!)");
llSay(0, " SUPER BATS - TWO OTHER ROOMS HAVE SUPER BATS. IF YOU");
llSay(0, " GO THERE, A BAT GRABS YOU AND TAKES YOU TO SOME OTHER");
llSay(0, " ROOM AT RANDOM. (WHICH MIGHT BE TROUBLESOME)");
llSay(0, " ");
llSay(0, " WUMPUS:");
llSay(0, " THE WUMPUS IS NOT BOTHERED BY THE HAZARDS (HE HAS SUCKER");
llSay(0, " FEET AND IS TOO BIG FOR A BAT TO LIFT). USUALLY");
llSay(0, " HE IS ASLEEP. TWO THINGS WAKE HIM UP: YOUR ENTERING");
llSay(0, " HIS ROOM OR YOUR SHOOTING AN ARROW.");
llSay(0, " IF THE WUMPUS WAKES, HE MOVES (P=.75) ONE ROOM");
llSay(0, " OR STAYS STILL (P=.25). AFTER THAT, IF HE IS WHERE YOU");
llSay(0, " ARE, HE EATS YOU UP (& YOU LOSE!)");
llSay(0, " ");
llSay(0, " YOU:");
llSay(0, " EACH TURN YOU MAY MOVE OR SHOOT A CROOKED ARROW");
llSay(0, " MOVING: YOU CAN GO ONE ROOM (THRU ONE TUNNEL)");
llSay(0, " ARROWS: YOU HAVE 5 ARROWS. YOU LOSE WHEN YOU RUN OUT.");
llSay(0, " EACH ARROW CAN GO FROM 1 TO 5 ROOMS. YOU AIM BY TELLING");
llSay(0, " THE COMPUTER THE ROOMS YOU WANT THE ARROW TO GO TO.");
llSay(0, " IF THE ARROW CAN'T GO THAT WAY(IE NO TUNNEL) IT MOVES");
llSay(0, " AT RANDOM TO THE NEXT ROOM.");
llSay(0, " IF THE ARROW HITS THE WUMPUS, YOU WIN.");
llSay(0, " IF THE ARROW HITS YOU, YOU LOSE.");
llSay(0, " ");
llSay(0, " WARNINGS:");
llSay(0, " WHEN YOU ARE ONE ROOM AWAY FROM WUMPUS OR HAZARD,");
llSay(0, " THE COMPUTER SAYS:");
llSay(0, " WUMPUS- 'I SMELL A WUMPUS'");
llSay(0, " BAT - 'BATS NEARBY'");
llSay(0, " PIT - 'I FEEL A DRAFT'");
llSay(0, " ");
}
 
llSay(0, "HUNT THE WUMPUS");
llSay(0, " ");
state run_game;
}
}
 
//----------------------------------------------------------------------------
// state run_game
//----------------------------------------------------------------------------
state run_game
{
state_entry()
{
PrintLocAndHaz();
llSay(0, "SHOOT OR MOVE (S-M)?");
llListen(0, "", llGetOwner(), "");
}
 
on_rez(integer start_param)
{
state default;
}
 
listen(integer channel, string name, key id, string message)
{
if (llToLower(message) == "s")
{
state shooting_num_rooms;
}
else if (llToLower(message) == "m")
{
state moving_where_to;
}
else if (llToLower(message) == "debug")
{
gDEBUG = !gDEBUG;
llSay(0, "DEBUG MODE IS NOW " + (string)gDEBUG);
}
else
{
llSay(0, "SHOOT OR MOVE (S-M)?");
}
}
}
 
state end_game
{
state_entry()
{
if (gStatus == 1)
{
llSay(0, "HEE HEE HEE - THE WUMPUS'LL GETCHA NEXT TIME!!");
}
else if (gStatus == -1)
{
llSay(0, "HA HA HA - YOU LOSE!");
}
 
llSay(0, "SAME SET-UP (Y-N)?");
llListen(0, "", llGetOwner(), "");
}
 
on_rez(integer start_param)
{
state default;
}
 
listen(integer channel, string name, key id, string message)
{
llSay(0, "HUNT THE WUMPUS");
llSay(0, " ");
 
if (llToLower(message) != "y")
{
SetupNewGame(FALSE);
}
else
{
SetupNewGame(TRUE);
}
 
state run_game;
}
}
 
//################################################## ##########################
//
// SHOOTING
//
//################################################## ##########################
 
//----------------------------------------------------------------------------
// state shooting_num_rooms
//----------------------------------------------------------------------------
 
state shooting_num_rooms
{
state_entry()
{
llSay(0, "NO. OF ROOMS(1-5)?");
llListen(0, "", llGetOwner(), "");
}
 
on_rez(integer start_param)
{
state default;
}
 
listen(integer channel, string name, key id, string message)
{
gShootingNumRooms = (integer)message;
 
if ((gShootingNumRooms < 1) || (gShootingNumRooms > 5))
{
llSay(0, "NO. OF ROOMS(1-5)?");
}
else
{
state shooting_get_rooms;
}
}
}
 
//----------------------------------------------------------------------------
// state shooting_get_rooms
//----------------------------------------------------------------------------
 
state shooting_get_rooms
{
state_entry()
{
gShootingCurRoom = 1;
llSay(0, "ROOM #?");
llListen(0, "", llGetOwner(), "");
}
 
on_rez(integer start_param)
{
state default;
}
 
listen(integer channel, string name, key id, string message)
{
integer roomNum = (integer)message;
 
SetShootingRoom(gShootingCurRoom, roomNum);
 
if (gShootingCurRoom == gShootingNumRooms)
{
ShootArrow();
if (gStatus == 0)
{
state run_game;
}
state end_game;
}
 
if (gShootingCurRoom > 2)
{
if (GetShootingRoom(gShootingCurRoom) ==
GetShootingRoom(gShootingCurRoom - 2))
{
llSay(0, "ARROWS AREN'T THAT CROOKED - TRY ANOTHER ROOM");
}
}
 
gShootingCurRoom++;
llSay(0, "ROOM #?");
}
}
 
//################################################## ##########################
//
// MOVING
//
//################################################## ##########################
 
//----------------------------------------------------------------------------
// state moving_where_to
//----------------------------------------------------------------------------
 
state moving_where_to
{
state_entry()
{
llSay(0, "WHERE TO?");
llListen(0, "", llGetOwner(), "");
}
 
on_rez(integer start_param)
{
state default;
}
 
listen(integer channel, string name, key id, string message)
{
integer loc = (integer)message;
 
if ((loc <1) || (loc > 20))
{
llSay(0, "WHERE TO?");
}
else
{
integer i;
for (i = 1; i <=3; i++)
{
if (RoomAt(gLocPlayer, i) == loc)
{
MoveTo(loc);
if (gStatus == 0)
{
state run_game;
}
state end_game;
}
}
 
llSay(0, "NOT POSSIBLE -WHERE TO?");
}
}
}

 

Add a comment

Touchbox (fun)

// OPEN SOURCE!! DO NOT RESELL!!
// © 2008 by FoxSan Yosuke
 
integer second;
vector startPosition;
 
default
{
    state_entry()
    {
        llSetText("I am just a box. \n But whatever you do, do NOT touch me! D:", <1 ,1,1>, 1.5);
        startPosition = llGetPos();
    }
 
on_rez(integer start_param)
    {
       llResetScript();
    }
 
    touch_start(integer total_number)
    {
        llSay(0, "OMG! You touched me! D: RAEP! HEEELP! O.o");
        llPlaySound("Sound1", 1.0);
        llPlaySound("Sound1", 1.0);
        llSetTimerEvent( 0.5 );
    }
 
timer()
  {
      second++;
      float X_dis = llFrand( 10.0 );
      float Y_dis = llFrand( 10.0 );
      float Z_dis = llFrand( 10.0 );
      vector displacement = ;
      vector newPosition = startPosition + displacement;
      llSetPos( newPosition );
      if ( second > 15 )
      {
          while ( llVecDist( llGetPos(), startPosition ) > 0.001)
          {
              llSetPos( startPosition );
          }
          llSay( 0, "I feel SO violated! ._." );
          llPlaySound("Sound2", 1.0);
          llResetScript();
      }
  }
}

 

Add a comment

Magic Blocks

A fun toy and made by Philip Linden!  Hours of very fun, and pleasure.
Click and drag the block to position.  Block will snap into position when near other blocks.
Click and quickly release to make a new block above the old.

SOUND UUID 's
color = 8e9a7375-2a49-6e81-ec26-c6140891333d
off = bac3e333-9624-4b1a-ade2-d2b01d5960aa
on = 271e6a0f-0a76-230b-011e-f78a55e80c36
pulse = 21b2d9ef-8329-bb72-9eaf-35702e876797

NOTE: You will need to re-assemble this all and edit the scripts because I cannot include sounds in this post ;)

 

 

vector pos; 
vector found_pos;
vector start_touch_pos;
vector diff;
vector scale;
string name_detected;
 
vector PULSE_COLOR = <1 ,1,1>;
 
float GRAB_ALPHA = 0.5;
float INC = 2.0;                    // Grid spacing for snap, scale
float MAX_INC = 2.5;                // Biggest dimension
 
list colors = [<1 ,0,0>, <0,1,0>, <0,0,1>, 
                <0,1,1>, <1 ,0,1>, <1 ,1,0>];
 
//list tones = ["piano_1", "piano_3", "piano_5"];
 
vector color;
integer color_index = 0; 
 
integer CHANNEL = 3442;
integer pulse = FALSE;
integer inhibit = FALSE;
float INHIBIT_DELAY = 2.0;
float DECAY_FACTOR = 0.5;
 
send_pulse()
{
    // Change color briefly and transmit a neural 'pulse'
    inhibit = TRUE;
    llSetTimerEvent(INHIBIT_DELAY);    
    //integer tone = llRound(llFrand((float)(llGetListLength(tones) - 1)));
    //llTriggerSound(llList2String(tones, tone), 1.0);
    llSetColor(PULSE_COLOR, ALL_SIDES);
    llSetObjectName("Magic Block P");
    llWhisper(CHANNEL, "pulse");
}
 
vector vec_round(vector vec, float inc)
{
    //  Rounds vector components to the nearest units of inc
    vec *= 1.0/inc;
    vec.x = ((float)llRound(vec.x));
    vec.y = ((float)llRound(vec.y));
    vec.z = ((float)llRound(vec.z)); 
    vec *= inc;
    return vec;
}
 
set_pos()
{
   // 
   //  On finding a neighbor, snap relative to neighbor
   // 
   pos = llGetPos();
    llSetColor(color*0.5, ALL_SIDES);
    diff = pos - found_pos;
    diff = vec_round(diff, INC/2.0);   
    diff += found_pos;
    llSetPos(diff);
    llTriggerSound("on", 1.0);
    llSetColor(color, ALL_SIDES);
}
 
vector new_color()
{
    integer num_colors = llGetListLength(colors);
    color_index++; 
    if (color_index >= num_colors) color_index = 0;
    return llList2Vector(colors, color_index);
}
 
snap()
{
    //  Issues the sensor to look for nearby blocks to snap to
    float range = 3.0;
    llSensor("Magic Block", "", PASSIVE | SCRIPTED, range, 2.0*PI);
}
 
default
{
    state_entry()
    {
        scale = llGetScale();
        color = new_color();
        llSetColor(color, ALL_SIDES);
        llSetStatus(STATUS_BLOCK_GRAB, FALSE);
        llSetBuoyancy(1.0);
        llListen(CHANNEL, "", "", "pulse");
    }
 
    on_rez(integer param)
    {
        found_pos = llGetPos();
        set_pos();
        snap();
    }
 
    timer()
    {
        llSetObjectName("Magic Block");
        llSetTimerEvent(0.0);
        inhibit = FALSE;
        llSetColor(color, ALL_SIDES);
    }
 
    changed(integer change)
    {
        if (change == CHANGED_SCALE)
        {
            scale = llGetScale();
            scale = vec_round(scale, INC);
            if (scale.x == 0.0) scale.x = INC;
            if (scale.y == 0.0) scale.y = INC;
            if (scale.z == 0.0) scale.z = INC;
            if (scale.x > MAX_INC) scale.x = MAX_INC;
            if (scale.y > MAX_INC) scale.y = MAX_INC;
            if (scale.z > MAX_INC) scale.z = MAX_INC;
            llSay(0, "new scale = " + (string)scale);
            llSetScale(scale);
            // Choose a new color for the block
            snap();
        }
    }
 
    touch_start(integer total_number)
    {
        start_touch_pos = llGetPos();
        llSetAlpha(GRAB_ALPHA, ALL_SIDES);
        llTriggerSound("on", 1.0);
        llResetTime();
        llSetStatus(STATUS_PHYSICS, FALSE);
    }
    touch_end(integer total_number) 
    {
        llSetStatus(STATUS_PHYSICS, FALSE);
        llSetAlpha(1.0, ALL_SIDES);
        vector moved = llGetPos() - start_touch_pos;
 
        if (llGetTime() <0.3)
        {
            //  Cycle colors on short click
            llSetPos(start_touch_pos);
            llTriggerSound("color", 1.0); 
            color = new_color();
            llSetColor(color, ALL_SIDES); 
        }
        else if (llVecMag(moved) < (INC/10.0))
        {
            llSetPos(start_touch_pos);
            send_pulse();
        }
        else
        {
            // Try to find a block to stick to!
            llSetColor(color, ALL_SIDES);
            snap();  
        }
        llSetRot(<0,0,0,1>);
    }
 
    listen(integer channel, string name, key id, string message)
    {
        // Received neural pulse, so sense sender's distance
        if (!inhibit)
        {
            pulse = TRUE;
            llSensor("Magic Block P", id, PASSIVE | SCRIPTED, 10.0, 2.0*PI);
        }
    }
 
    no_sensor()
    {
        pulse = FALSE;
    }
    sensor(integer num_detected)
    {
        if (!pulse)
        {
            // 
            //  Rotate/snap to nearest box
            //
            //  Issue scale request to this box
            //
            found_pos = llDetectedPos(0);
            set_pos();
        }
        else
        {
            //
            //  Gauge distance to nearest box, decide whether to 'fire'
            // 
            pulse = FALSE;
            pos = llGetPos();
            found_pos = llDetectedPos(0);
            diff = pos - found_pos;
            // probability of neural firing is related to distance 
            float distance = llVecMag(diff);
            if (distance > 0.0)
            {
                if (distance 

 

 

Add a comment