Difference between revisions of "User:Toady Nakamura/Landmark Giver and Counter"

From Second Life Wiki
Jump to navigation Jump to search
m (added landmark giver & counter script)
 
m (fill in template)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
//Put one Landmark in Inventory
*Put one Landmark in Prim Contents, then put this script inside.
//Gives the landmark to anyone not owner
*If you do it the other way, hit "reset script" to be sure it finds the landmark
//Tells owner how many landmarks have been gifted.
*Gives the landmark to anyone not owner
*Tells owner how many landmarks have been gifted.


<lsl>
 
integer gifts = 0; // sets initial value in this case to zero
<source lang="lsl2">
integer gifts = 0; // sets initial value to zero


default
default
Line 32: Line 34:
     }
     }
}
}
</lsl>
</source>
Visit my LSL wiki page for my library of simple scripts !  [[User:Toady Nakamura|Toady Nakamura]]

Latest revision as of 13:36, 11 January 2016

  • Put one Landmark in Prim Contents, then put this script inside.
  • If you do it the other way, hit "reset script" to be sure it finds the landmark
  • Gives the landmark to anyone not owner
  • Tells owner how many landmarks have been gifted.


integer gifts = 0; // sets initial value to zero

default
{
    on_rez(integer start_param)
    {
        llResetScript(); // this resets whenever the prim is brought from inventory
    }
    
    state_entry()
    { 
        llSetText( "Touch for a Landmark", <1.0, 1.0, 1.0>, 1.0);
        //sets the hover text "message", color (here white), and intensity (can be zero to 1.0)
    }

    touch_start(integer total_number)
    {
        if ( llDetectedKey(0) != llGetOwner() )// if the toucher is NOT the owner (!=)
        {
            gifts = gifts++; // count up one from previous value
            llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_LANDMARK, 0));
        }
        else if ( llDetectedKey(0) == llGetOwner() ) // if the toucher IS the owner (==)
        {
            llOwnerSay((string)gifts + " people have gotten landmarks from me!");
        }
    }
}

Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura