User:Fred Gandt/Scripts
All the below scripts are basic and to be cleaned up and annotetated later (next few days prolly)
Basic Light Switch
<lsl>integer on;
vector color = <1.0,1.0,1.0>; // RGB values
float intensity = 1.0; // 0.0 to 1.0 (1.0 = full brightness)
float radius = 20.0; // 0.1 to 20.0 (20.0 = full sphere)
float falloff = 0.01; // 0.01 to 2.0 (2.0 = least spread)
Switch() {
on = (!on); llSetPrimitiveParams([PRIM_POINT_LIGHT, on, color, intensity, radius, falloff]);
}
default {
touch_end(integer nd) { Switch(); }
}</lsl>
Script that gives a set amount of L$ to whoever touches the object this script is in
TAKE CARE WITH THIS ONE. IT WILL DEDUCT L$ FROM YOUR ACCOUNT ONCE YOU GRANT PERMISSIONS
I WAS ASKED TO MAKE IT THIS WAY. IT WAS DESIGNED TO BE REZZED FOR SHORT PERIODS OF TIME
IF TOO MANY AGENTS USE IT THE MEMORY WILL RUN OUT AND IT WILL FAIL
<lsl>key owner;
integer perms;
integer count;
list visitors; // This stores the keys of all the agents who take the gift. They will be allowed only one gift.
integer ammount = 1; // Change this figure to the required ammount to give away (e.g. 5). Then set running and drop in your prim.
default {
on_rez(integer param) { llResetScript(); } changed(integer change) { if(change & CHANGED_OWNER) llResetScript(); } state_entry() { owner = llGetOwner(); llRequestPermissions(owner, PERMISSION_DEBIT); // THIS MEANS IT WILL TAKE YOUR MONEY. } run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) perms = TRUE; else llRequestPermissions(owner, PERMISSION_DEBIT); } touch_end(integer nd) { do { key toucher = llDetectedKey(count); if(llListFindList(visitors, [toucher]) == -1) { if(perms) { llGiveMoney(toucher, ammount); visitors += toucher; } } } while((++count) < nd); count = 0; }
}</lsl>
Script to make the Mouselook button show at the bottom of your screen
<lsl>key owner;
default {
on_rez(integer param) { llResetScript(); } state_entry() { owner = llGetOwner(); llRequestPermissions(owner, PERMISSION_TAKE_CONTROLS); } run_time_permissions(integer perm) { if(perm & PERMISSION_TAKE_CONTROLS) llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE); else llRequestPermissions(owner, PERMISSION_TAKE_CONTROLS); } control(key id, integer this, integer that) { // Do stuff when clicking the left mouse button while in mouselook. Like for guns etc. }
}</lsl>
Script that makes the object it is in float on water
<lsl>// Floating on water script
float offset = 0.0; // add the offset here
default {
on_rez(integer param) { float float_height = (llWater(ZERO_VECTOR) + offset); vector pos = llGetPos(); llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(<pos.x, pos.y, float_height>, 0.5); }
}</lsl>
Very Basic Alpha (transparency) ON/OFF script
<lsl>integer on;
key owner;
string command = "switch"; // place command here to say. Same command will switch on and off.
integer channel = 1; // place channel to use here (must be a positive if an avatar is chatting on it)
Switch(integer i) {
llSetLinkAlpha(LINK_SET, ((float)i), ALL_SIDES);
}
default {
state_entry() { owner = llGetOwner(); llListen(channel, "", owner, command); } touch_end(integer nd) { on = (!on); Switch(on); } listen(integer chan, string name, key id, string msg) { on = (!on); Switch(on); }
}</lsl>