ソラマメブログ › Golden Fish

  

Posted by at

2010年02月20日

オブジェクトの色を変更する(Advance)

ダイアログボックスのメニューで好みの色を選択してオブジェクトの色を変更するスクリプト。
//////////////////////////////////////////////////////////////////
// Color changing script
// Created By SoLur Industries
//////////////////////////////////////////////////////////////////

//If you have purchased this script from myself, or SoLur Industries, you are free to modify it and use it in products.
//This script is not meant to be given away or used without permission or purchase, however.
//Please leave this above message in all copies of this script!
//Thank you!
//-Sol Columbia


list grayscale =["black",<0,0,0>,"white",<1,1,1>,"gray",<0.5,0.5,0.5>,"silver",<0.75,0.75,0.75>,"darkgray",<0.4,0.4,0.4>,
"lightgrey",<0.83,0.83,0.83>];
list reds = ["red",<1,0,0>,"darkred",<0.55,0,0>,"crimson",<0.86,0.08,0.24>,"indianred",<0.8,0.36,0.36>,
"orangered",<1,0.27,0>];
list pinks = ["hotpink",<1,0.41,0.71>,"pink", <1,0.75,0.8>,"lightpink",<1,0.71,0.76>,"deeppink",<1,0.08,0.58>,
"fuchsia",<1,0,1>,"orchid",<0.85,0.44,0.84>,"plum",<0.87,0.63,0.87>];
list violets = ["violet",<0.8,0.51,0.8>,"indigo",<0.29,0,0.51>,"lavender",<0.7,0.7,1>,"magenta",<1,0,1>,
"purple",<0.5,0,0.5>,"darkmagenta",<0.55,0,0.55>,"darkviolet",<0.58,0,0.83>,"blueviolet",<0.54,0.17,0.89>];
list dk_blues = ["darkblue",<0,0,0.55>,"blue",<0,0,1>,"deepskyblue",<0,0.75,1>,"mediumblue",<0,0,0.8>,
"midnightblue",<0.1,0.1,0.44>,"royalblue",<0.25,0.41,0.88>,"slateblue",<0.42,0.35,0.8>,"steelblue",<0.27,0.51,0.71>];
list lt_blues = ["teal",<0,0.5,0.5>,"turquoise",<0.25,0.88,0.82>,"darkcyan",<0,0.55,0.55>, "lightblue", <0.68,0.85,0.9>,
"aquamarine",<0.5,1,0.83>,"azure",<0.8,1,1>,"cyan",<0,1,0.9>,"skyblue",<0.53,0.81,0.92>];
list yellows = ["yellow",<1,1,0>,"gold",<1,0.84,0>,"lightyellow",<1,1,0.88>,"goldenrod",<0.85,0.65,0.13>,
"yellowgreen",<0.6,0.8,0.2>];
list dk_greens = ["darkgreen",<0,0.39,0>,"green",<0,0.5,0>,"forestgreen",<0.13,0.55,0.13>,"lawngreen",<0.49,0.99,0>,
"springgreen",<0,1,0.5>];
list lt_greens = ["lightgreen",<0.56,0.93,0.56>,"chartreuse",<0.5,1,0>,"greenyellow",<0.68,1,0.18>,"honeydew",<0.94,1,0.94>,
"limegreen",<0.2,0.8,0.2>,"mintcream",<0.96,1,0.98>,"seagreen",<0.18,0.55,0.34>];
list oranges = ["orange",<1,0.65,0>,"darkorange",<1,0.55,0>,"coral",<1,0.5,0.31>,"navajowhite",<1,0.87,0.68>,
"salmon",<0.98,0.5,0.45>,"seashell",<1,0.96,0.93>,"brown",<.24,.17,.15>];

//Typically you wouldn't change anything below here, but if you're feelin it, who's gonna stop you?!
//---------------------------------------------------------

integer channel;
integer listen_handle;
key owner;
list sub_menu;
list main_menu = ["grayscale", "reds", "pinks", "violets", "dk_blues", "lt_blues", "yellows", "dk_greens", "lt_greens", "oranges"];


init() {
llListenRemove(listen_handle);
owner = llGetOwner();
channel = llFloor(llFrand(2000000)); //random channel so multiple scripts don't interfere with each other
listen_handle = llListen(channel, "", owner, "");
}


default
{
on_rez(integer s) { init(); }
state_entry() { init(); }

listen(integer channel, string name, key id, string message) {

if (llListFindList(main_menu, [message]) != -1) {
if (message == "grayscale") sub_menu = grayscale;
else if (message == "reds") sub_menu = reds;
else if (message == "pinks") sub_menu = pinks;
else if (message == "violets") sub_menu = violets;
else if (message == "dk_blues") sub_menu = dk_blues;
else if (message == "lt_blues") sub_menu = lt_blues;
else if (message == "yellows") sub_menu = yellows;
else if (message == "dk_greens") sub_menu = dk_greens;
else if (message == "lt_greens") sub_menu = lt_greens;
else if (message == "oranges") sub_menu = oranges;

llDialog(owner, "\n\nSelect a color", llList2ListStrided(sub_menu, 0, -1, 2), channel);
return;
}

integer index = llListFindList(sub_menu, [message]);
if (index != -1) {
vector color_vector = llList2Vector(sub_menu, index+1);
if (llGetLinkNumber() == 1) llSetLinkColor(LINK_SET, color_vector, ALL_SIDES); //If it's root prim, do whole set
else llSetColor(color_vector, ALL_SIDES); //otherwise, just do that prim
}

}

touch_start(integer s) {
if (llDetectedKey(0) == owner) {
llDialog(owner, "\n\nSelect a color group", main_menu, channel);
}
}
}  


Posted by Kingyo at 22:50Comments(1)LSL

2010年01月20日

リモートコントロール

キーボード操作でオブジェクトをリモートコントロールするスクリプト。
//////////////////////////////////////////////////////////////////
// Remote Control Script
// Created By JoJo Hesse
//////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////
// To Use It
//////////////////////////////////////////////////////////////////
//1.) Just Put It In Your Vehicle And Touch It
//2.) Click "Yes"
//3.) When You Finish Playing With It, Touch It Again And Click "No"


float speed=15; //Driving Speed.
float TurnSpeed=140; //Turning Speed

default
{
on_rez(integer start_param)
{
llSetPos(llGetPos() + <0,0,1>); //Move Up 1m So The Car Doesnt Get Stuck In Objects
llResetScript(); //Reset The Script And Trigger state_entry()
}

state_entry()
{
llSetTouchText("Touch"); //Set Text For The "Touch" Button In The Pie Menu

llSetSitText("Sit"); //Set Text For The "Sit" Button In The Pie Menu

llSitTarget(<5, 5, 5>, ZERO_ROTATION); //Offset To Sit On The Object (up to 300m on any axis)

llSetVehicleFlags(2);

llSetVehicleType(VEHICLE_TYPE_CAR);

llSetVehicleFlags(VEHICLE_FLAG_LIMIT_ROLL_ONLY);

llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.8);

llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.5);

llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.1);

llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.8);

llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.8);

llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.5);

llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.11);

llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.8);

llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000.0, 2.0, 1000.0>);

llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <10.0, 2.0, 1000.0>);

llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 1);

llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.1);

llSetVehicleFloatParam(VEHICLE_BANKING_EFFICIENCY, -1);

llSetVehicleFloatParam(VEHICLE_BANKING_TIMESCALE, 0.5);

llCollisionSound("", 0.0);
}

changed(integer change)
{
//Unsit Person
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if (agent)
{
llWhisper(0, "Please Dont Sit On Me...");
llUnSit(agent);
}
}
}

touch_start(integer num)
{
if(llDetectedKey(0)==llGetOwner()) //Only Activate For Owner
llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS); //Request Owners Permissions
}

run_time_permissions(integer perm)
{
if (perm)
{
llSetStatus(STATUS_PHYSICS, TRUE); //Set Object Physical

llTakeControls(CONTROL_UP | CONTROL_DOWN | CONTROL_FWD | CONTROL_BACK | CONTROL_RIGHT | CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE); //Take The Controls Of Owner
}
else
{
llSetStatus(STATUS_PHYSICS, FALSE); //Set Object Non-Phys
llReleaseControls(); //Release Controls So Owner Can Move Around
}
}

control(key id, integer level, integer edge)
{
vector angular_motor;

if(level & CONTROL_FWD)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, ); //Drive Forward
}

if(level & CONTROL_BACK)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <-(speed - 5),0,0>); //Drive In Reverse
}

if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
angular_motor.x += TurnSpeed;
angular_motor.z -= TurnSpeed;
}

if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
angular_motor.x -= TurnSpeed;
angular_motor.z += TurnSpeed;
}
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor); //Apply Angular Motor(turn vehicle)
}
}

  


Posted by Kingyo at 11:51Comments(0)LSL

2009年10月30日

プリムの変形

プリムのパスカット、ひねり、テーパーなどをランダムに変化させることができるロックメーカースクリプト。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Rock Maker
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

// Fran wuz here

randomize_rock() {
vector size;
float magnitude;

magnitude = llFrand(1.5) + 0.5;
size.x = (0.1 + llFrand(0.9)) * magnitude;
size.y = (0.1 + llFrand(0.9)) * magnitude;
size.z = (0.1 + llFrand(0.9)) * magnitude;

{ // Box type
float f;
integer holeshape;
vector cut;
float hollow;
vector twist;
vector topsize;
vector topshear;

f = llFrand(1);
if ( f < 0.33 )
holeshape = PRIM_HOLE_SQUARE;
else if ( f < 0.67 )
holeshape = PRIM_HOLE_CIRCLE;
else
holeshape = PRIM_HOLE_TRIANGLE;

cut.x = llFrand(1);
cut.y = cut.x + llFrand(1);
cut.z = llFrand(1);

hollow = llFrand(0.95);

twist.x = llFrand(1) - 0.5;
twist.y = llFrand(1) - 0.5;
twist.z = llFrand(1) - 0.5;

topsize.x = llFrand(1);
topsize.y = llFrand(1);
topsize.z = llFrand(1);

topshear.x = llFrand(1);
topshear.y = llFrand(1);
topshear.z = llFrand(1);

llSetPrimitiveParams( [PRIM_SIZE, size,
PRIM_TYPE, PRIM_TYPE_BOX, holeshape, cut, hollow, twist, topsize, topshear] );
}
}

default {
state_entry() {
randomize_rock();
llListen(0, "", llGetOwner(), "/rock off" );
llListen(1, "", llGetOwner(), "/rock off" );
}

touch_start(integer total_number) {
randomize_rock();
}

on_rez(integer code) {
llResetScript();
}

listen( integer channel, string name, key id, string msg ) {
llRemoveInventory( llGetScriptName() );
}
}

  


Posted by Kingyo at 19:44Comments(0)LSL

2009年10月28日

アバターを追跡して回転する

オブジェクトがアバターを追跡して回転する、回転砲塔(兵器を搭載する回転式のプラットフォーム)と名付けられたスクリプト。
Touchするとパーミションダイアログが表示され、「はい」を選択するとスクリプトが作動します。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Turret Script
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

key toucher;
string toucherS;
float SPEED = 40.0;
integer LIFETIME = 7;
float DELAY = 0.2;
vector vel;
vector pos;
rotation rot;
integer in_use;
integer have_permissions = FALSE;
integer armed = TRUE;
fire()
{

rot = llGetRot();
vel = llRot2Fwd(rot);
pos = llGetPos();
pos = pos + vel;
pos.z += 0.0;
vel = vel * SPEED;
llTriggerSound("shoot", 1.0);
llRezObject("bullet", pos, vel, rot, 1);
}
default
{
state_entry()
{
in_use = FALSE;
}
touch_start(integer total_number)
{
if(in_use == FALSE)
{
toucher = llDetectedKey(0);
llRequestPermissions(toucher, PERMISSION_TAKE_CONTROLS|PERMISSION_TRIGGER_ANIMATION);
llSetText("Requesting Permissions", <1,1,1>, 1);
}
if(in_use == TRUE)
{
if(llDetectedKey(0) == toucher)
{
llReleaseControls();
llSensorRemove();
llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>);
llSetText("", <1,1,1>, 1);
in_use = FALSE;
}
}
}
sensor(integer sense)
{
rotation k = llDetectedRot(0);
llRotLookAt(k, .1, .1);
}
no_sensor()
{
llReleaseControls();
llSensorRemove();
llSetRot(<-0.00000, -0.00000, 0.70711, 0.70711>);
llSetText("", <1,1,1>, 1);
in_use = FALSE;
}
run_time_permissions(integer perm)
{
if(perm)
{
llSetText("", <1,1,1>, 1);
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
llSensorRepeat("", toucher, AGENT, 20, TWO_PI, .1);
llSetText("Current User: "+llKey2Name(toucher), <1,1,1>, 1);
in_use = TRUE;
}
else
{
in_use = FALSE;
llSetText("", <1,3,1>, 1);
}
}
control(key name, integer levels, integer edges)
{
if ((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON)
{
fire();
}
}

}

  


Posted by Kingyo at 18:57Comments(0)LSL

2009年07月28日

ネコのしっぽ

”Neko Tail”を動かすスクリプトです。フレキシブル・パスのプロパティーを使って動きのしなやかさを調整してみてください。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Wag Script - no touch
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

integer rot=20; //rotation you want, in degrees, measured in total swish arc.

tailwag(){
llSetRot(<0,0.01,llSin(rot/2*DEG_TO_RAD),llCos(rot/2*DEG_TO_RAD)>);
llSleep(1.0); //sleep delay. longer delay for more swish
llSetRot(<0,-0.01,llSin(-rot/2*DEG_TO_RAD),llCos(-rot/2*DEG_TO_RAD)>);
llSleep(1.0); //same as above
llSetRot(<0,0,0,1>);

}

default
{
state_entry()
{

llSetTimerEvent(3 + llFrand(3));tailwag();
}

touch_start(integer num){

}
timer()
{
tailwag();
llSetTimerEvent(3 + llFrand(3));
}
}  


Posted by Kingyo at 16:34Comments(0)LSL

2009年05月21日

プリムの掃除道具

スクリプトを削除したのに、オブジェクトに残ってしまうフローティング・テキストやパーティクルなどを消す事ができる掃除道具です。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Scrubber
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

list buttons =["SitTarget", "SitText", "FloatText", "Particles","TextureAn", "Sound", "TargetOmega", "ALL", "DESTRUCT"];

string menutext = "Select an item to clear, use ALL to Clear all, or DESTRUCT to remove script from prim";

integer handler;

default
{
state_entry()
{
if (handler)
{
llListenRemove(handler);
}
handler =llListen(1,"",llGetOwner(),"");
}
touch_start(integer num_detected)
{
llDialog(llGetOwner(), menutext, buttons, 1);
}
listen( integer channel, string name, key id, string message )
{
string lowmsg = llToLower(message);
if (lowmsg == "sittarget")
{
llWhisper(0,"Clearing Sit Position.");
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);
}
if (lowmsg == "floattext")
{
llWhisper(0,"Clearing Floating Text.");
llSetText("", <1,1,1>, 1.5);
}
if (lowmsg == "particles")
{
llWhisper(0,"Clearing Particles.");
llParticleSystem([]);
}
if (lowmsg == "texturean")
{
llWhisper(0,"Clearing Texture Animation.");
llSetTextureAnim(FALSE, ALL_SIDES,0,0,0.0, 1,0.3);
}
if(lowmsg == "targetomega")
{
llWhisper(0, "Clearing llTargetOmega().");
llTargetOmega(ZERO_VECTOR, 0.0, 1.0);
}
if(lowmsg == "sound")
{
llWhisper(0, "Clearing Sounds.");
llStopSound();
}
if(lowmsg == "sittext")
{
llWhisper(0,"Clearing Sit Text.");
llSetSitText("Sit Here");
}
if (lowmsg == "all")
{
llWhisper(0,"Clearing Floating Text.");
llSetText("", <1,1,1>, 1.5);
llSetSitText("Sit Here");
llWhisper(0,"Clearing Texture Animation.");
llSetTextureAnim(FALSE, ALL_SIDES,0,0,0.0, 1,0.3);
llWhisper(0,"Clearing Particles.");
llParticleSystem([]);
llWhisper(0,"Clearing Sit Position.");
llSitTarget(ZERO_VECTOR,ZERO_ROTATION);
llWhisper(0, "Clearing llTargetOmega().");
llTargetOmega(ZERO_VECTOR, 0.0, 1.0);
llStopSound();
}
if (lowmsg == "destruct")
{
llWhisper(0,"Removing script from prim in 0.2 seconds");
llSleep(0.2);
llRemoveInventory(llGetScriptName());
}
}
}  


Posted by Kingyo at 20:03Comments(0)LSL

2009年05月21日

チップジャー

チップの集金目標を設定して、目標の達成率を表示するチップジャーです。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Tipjar script with a 'goal' and progress meter
//// by Angel Fluffy
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

//********************************************************
//This Script was pulled out for you by YadNi Monde from the SL FORUMS at http://forums.secondlife.com/forumdisplay.php?f=15, it is intended to stay FREE by it s author(s) and all the comments here in ORANGE must NOT be deleted. They include notes on how to use it and no help will be provided either by YadNi Monde or it s Author(s). IF YOU DO NOT AGREE WITH THIS JUST DONT USE!!!
//********************************************************

// CARP Donation box script. Written by Angel Fluffy, with credit to :
// Keknehv Psaltery, jean cook, ama omega, nada epoch, YadNi Monde
// for their work on the "DONATION box" script upon which it was based.
//
//Donation / Tipjar script with a 'goal' and progress meter (ideal for tracking tier)
//What it is : a donation box / tip jar script, that uses the concept of 'goals' and a progress meter to encourage people to donate (as people donate more when they can see the progress being made towards a set goal).
//
//Edit the config settings, drop in a prim, and pay it some money to find out how it works.
//
//In future, I intend to add a 'biggest donors' field to it which people can use to recieve a list of the top 5 donors when the prim is clicked on.
//
//
//CODE
string imtext = "I'm the __________ Donation Box! Please right click and pay me to donate, as this supports the __________ project and helps keep the place open for you!";
// this is the text sent to someone who clicks on the prim containing this script and who isn't the owner.

// first line of hover text above box (always constant)
string floaty = "__________ Donation Box\n";

// when total donated this month is less than monthlyneeded, display whatfunding_1 as the funding target,
// when it is more, display whatfunding_2. This allows you to show your donors when you have switched
// from funding your essential running costs to funding expansion.
string whatfunding_1 = "Funding : __________ \n";
string whatfunding_2 = "Funding : __________ \n";

// name of the current month
// we *could* get this automatically, but changing the month automatically isn't as easy as it seems.
// This is a change I might make in a future version.
string thismonth = "October";

// How much are we trying to raise per month?
// The script displays a countdown in SETTEXT above the prim its in, counting down until this target is reached.
// After this target is reached, the countdown disappears, being replaced with a tally.
// The goal of this is to encourage people to donate by setting a clear goal they feel they can help achieve by donating.
integer monthlyneeded = 30000;


// These two variables define the starting numbers for how much has been donated across all time, and how much this month.
// These starting numbers will have the donations the script recieves in between each reset/save added to it,
// and the result displayed in float text over the top of the script.
// The first time you start accepting donations, you should set both of the numbers below to zero.
// When saving this script, you (the object owner) should touch the donation box object,
// which will then tell you how much has been donated in total and how much has been donated this month.
// Entering this information here before saving will allow you to preserve the 'state' of the script across edits/restarts.
integer totaldonated = 0;
integer monthdonated = 0;

// these settings are like the above, but save the 'last donor' information. You can set them to "" and 0 to clear saved info.
string lastdonor = "Taffy Tinlegs";
integer lastdonated = 0;

// this interval defines how long we wait between each reminder to donate broadcast to SAY (range=20m)
integer timer_interval = 3600;

// these settings determine what the 'default' donation amounts are.
// the buttons are the 'fast pay' buttons, the 'payfield' is the default amount in the text box.
list paybuttons = [50,200,400,800];
integer payfield = 100;


// these variables should be left undefined.
string owner;
string otext;
integer mpercent;

integer updatemath() {
float mpercentfloat = ((monthdonated * 100) / monthlyneeded);
mpercent = (integer)mpercentfloat;

return 1;
}

integer updatetext() {
otext = floaty;

if (mpercent >= 100) {
otext += whatfunding_2;
} else {
otext += whatfunding_1;
}
if (lastdonated > 0) {
otext += "Last donation : L$" + (string)lastdonated + " by " + lastdonor +"\n";
}
if (mpercent >= 100) {
otext += "We have raised L$"+(string)(monthdonated - monthlyneeded)+" for this, beyond our basic running costs of L$"+(string)monthlyneeded+" for "+thismonth+". \n";
//otext += "The excess will go towards giving prizes and running special events!";
} else {
otext += "Our donors have contributed "+(string)mpercent+"% of our basic running costs ("+(string)monthdonated+"/"+(string)monthlyneeded+") for "+thismonth+".\n";
}
llSetText(otext,<1,1,1>,1);
return 1;
}
default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
updatemath();
updatetext();
owner = llKey2Name( llGetOwner() );
llSetPayPrice(payfield,paybuttons);
llSetTimerEvent(timer_interval);
llSay(0,"Script updated. Usually this is caused by the donation box owner updating the script.");
}

money(key id, integer amount)
{
totaldonated += amount;
monthdonated += amount;
lastdonor = llKey2Name(id);
lastdonated = amount;
updatemath();
updatetext();
llInstantMessage(id,"On behalf of everyone who uses this place, thank you for the donation!");
llSay(0,(string)llKey2Name(id)+" donated L$" + (string)amount + ". Thank you very much for supporting us, it is much appreciated!" );
}
touch_start(integer num_detected){
if (llDetectedKey(0) == llGetOwner()) {
llOwnerSay("Reporting script status, because you are recognised as the owner of this donation box.");
llOwnerSay("Current TOTAL donations across all time: L$"+(string)totaldonated);
llOwnerSay("Current TOTAL donations for this month: L$"+(string)monthdonated);
} else {
llInstantMessage(llDetectedKey(0),imtext);
}
}
timer() {
integer premainder = 100 - mpercent;
integer aremainder = monthlyneeded - monthdonated;
if (mpercent < 100) {
llSay(0,"We still need to meet the last "+(string)premainder+"% of our basic costs (L$"+(string)aremainder+") this month, to pay for land tier etc. Please consider donating to help us out!");
}
llSetTimerEvent(timer_interval);
}
}   


Posted by Kingyo at 19:48Comments(0)LSL

2008年12月09日

高度測定器

海面を基準にした高度と地面を基準にした高度、移動速度などが計測できます。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// air/sea altameter
//// Original creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

default
{
state_entry()
{
llSetTimerEvent(.01); // How often your timer() event updates
}

timer()
{
vector pos = llGetPos(); // Gets your current position
vector size = llGetAgentSize(llGetOwner()); // Get the dimensions of your agent
size.z = size.z / 2.0; // Halve the height element of your agent, get altitude from feet
float aboveground = ((float)pos.z - llGround(<0.0,0.0,0.0>) - size.z); // Distance above ground
if (aboveground < 0.0) // If it thinks your feet are below ground
{
aboveground = llSqrt(aboveground * aboveground); // - flip it
}
if (aboveground < 0.09) // Check the margin of error for zeroing - you can redefine this
{
aboveground = 0.0; // Zero it out
}
vector Speed = llGetVel(); // LSL function that should be fixed in next release.
float RealSpeed = llVecMag(Speed); // Convert it to velocity you can use.
float abovewater = llWater(<0.0,0.0,0.0>) - pos.z; // difference between yourwater height
if (pos.z >= llWater(<0.0,0.0,0.0>)) // If at or above water
{
abovewater = llSqrt(abovewater * abovewater);
}
if (pos.z < llWater(<0.0,0.0,0.0>)) // If underwater
{
abovewater = abovewater - (abovewater * 2.0); // Push the number into the negative range
}
llSetText("Sea Lvl ALT: " + (string)abovewater + "\n" + "Grnd Lvl ALT: " + (string)(aboveground) + "\nSpeed: " + (string)RealSpeed, <1.0,0.0,0.0>, 1.0); // Emit string
}
}  


Posted by Kingyo at 16:24Comments(0)LSL

2008年12月09日

アバターの移動

近くにいるアバターを磁石のように引きつけます。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Avatar Magnet Script 0.1
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

// Avatar Magnet Script 0.1
// a simple avatar magnet with some "nice" features built in
// if you turn these features off *please*
// don't use it outside of a combat area
// even if you leave them on this script uses push to simulate a
// magnet effect it *will* register as PvP outside combat areas
//
// if you turn OBJECTS on it will attract physical objects too
// but it doesn't work very well
// especially with small objects as they usually end up flying off world
//
// this script is mostly untested
// if you have problems let me know and i'll try to fix them


// whether the object asks permission to attract or not
// be nice and ask
integer REQUIRE_PERMISSION = TRUE;

// if we are requiring permissions set this based on whether
// you want it to prompt nearby users for permissions
// or require them to touch this object to be asked permission
// TRUE means it will ask without touching
// FALSE means they must touch it to be asked
integer UNSOLICITED = TRUE;

// how far to look around for targets
// this is highly dependant on the mass of this object
// and the mass of the target
// small objects might not have enough energy to attract far away targets
// maximum of 96.0 meters
float RADIUS = 30.0;

// how forceful you want to the magnet to be
// if you set this too high it's hard for the magnet to keep up
// with the velocity of the target so you get a lot of "ping-pong" effect
// if you set it too low then the target can break away easily
// if it has the ability to apply its own impulse
// (an avatar can fly away from the magnet if it's set too low ...
// but this may be a good thing)
// the maximum amount is effectively 2147483647
// but really > 100 is too much
float FORCE = 20.0;

// attract avatars
integer AVATARS = TRUE;

// attract physical objects
// this really doesn't work very well, especially for small objects
integer OBJECTS = FALSE;

// if we're asking permission we need to keep a list of people
// who have accepted and people who have declined
// unfortunately due to memory constraints these lists will be capped
// i haven't tested this!
// if you get stack-heap errors you will need to lower the cap
integer CAP = 50;
list declined;
list accepted;

// listener handle
integer listener;

askPermission(key avatar) {
// build the message based on the settings
string message = "May this magnet attract ";
if (AVATARS) message += "you";
if (OBJECTS && AVATARS) message += " and ";
if (OBJECTS) message += "your objects";
message += "?";

// build dialog button list
// based on whether or not this is the owner
list buttons = ["Accept", "Decline"];
if (avatar == llGetOwner()) buttons += ["Turn Off"];

llDialog(avatar, message, buttons, -38739454);
}

default {
state_entry() {
// turn of collision effects
llCollisionSprite("");
llCollisionSound("", 0.0);

llSetText("Magnet Off", <1.0, 1.0, 1.0>, 1.0);

llOwnerSay("Magnet Off");
}

touch_start(integer touches) {
// turn the magnet on
if (llDetectedKey(0) == llGetOwner()) state magnetized;
}
}

state magnetized {
on_rez(integer start) {
llResetScript();
}

state_entry() {
// clear out the accepted list
accepted = [];

llSetText("Magnet On", <1.0, 1.0, 1.0>, 1.0);

llOwnerSay("Magnet On");

// the magnet shouldn't be phantom or you get weird results
llSetStatus(STATUS_PHANTOM, FALSE);

// figure out which types of targets we're attracting
integer types;
if (AVATARS) types = types | AGENT;
if (OBJECTS) types = types | ACTIVE;

// set our sensor
llSensorRepeat("", "", types, RADIUS, TWO_PI, 0.1);

// listen for dialog responses if we're asking permission
if (REQUIRE_PERMISSION)
listener = llListen(-38739454, "", "", "");
}

listen(integer channel, string name, key id, string message) {
// only listen to avatars
if (llGetOwnerKey(id) == id) {
if (message == "Accept") {
// if they were already on the accepted list
// remove their earlier entry
integer index = llListFindList(accepted, [id]);

if (index > -1)
accepted = llDeleteSubList(accepted, index, index);

// add to the end of the accepted list
accepted += [id];

// make sure our list isn't bigger than the cap
if (llGetListLength(accepted) > CAP)
accepted = llDeleteSubList(accepted, 0, 0);

// remove from the declined list if they're on it
index = llListFindList(declined, [id]);

if (index > -1)
declined = llDeleteSubList(declined, index, index);
} else if (message == "Decline") {
// remove from the accepted list if they're on it
integer index = llListFindList(accepted, [id]);

if (index > -1)
accepted = llDeleteSubList(accepted, index, index);

// if they were already on the declined list
// remove their earlier entry
index = llListFindList(declined, [id]);

if (index > -1)
declined = llDeleteSubList(declined, index, index);

// add to the end of the declined list
declined += [id];

// make sure our list isn't bigger than the cap
if (llGetListLength(declined) > CAP)
declined = llDeleteSubList(declined, 0, 0);
} else if (message == "Turn Off" && id == llGetOwner()) {
state default;
}
}
}

touch_start(integer touches) {
key toucher = llDetectedKey(0);

if (REQUIRE_PERMISSION) {
askPermission(toucher);

return;
}

if (toucher == llGetOwner()) state default;
}

sensor(integer sensed) {
integer i;

for (i = 0; i < sensed; i ++) {
key target_key = llDetectedKey(i);

// if we're getting permission
// we need to see if we've alreay bothered this person
if (REQUIRE_PERMISSION) {
// since we may be attracting objects too
// we need to make sure we're asking the owner
key owner_key = llDetectedOwner(i);

// if this person has not already accepted
// don't attract them
if (llListFindList(accepted, [owner_key]) == -1) {
// but if we haven't already bothered them
// we need to ask them
if (llListFindList(declined, [owner_key]) == -1) {
// put their name on the denied list
declined += [owner_key];

// make sure our list isn't bigger than the cap
if (llGetListLength(declined) > CAP)
declined = llDeleteSubList(declined, 0, 0);

if (UNSOLICITED) askPermission(owner_key);
}

return;
}
}

// the position of our target
vector target_pos = llDetectedPos(i);

vector my_pos = llGetPos();

// normalized vector describing the direction
// from our target to us
// this is a negative vector
// which will draw the object towards us
vector direction = llVecNorm(my_pos - target_pos);

// apply set amount of force
// in the direction from the target to this object
vector impulse = FORCE * direction;

// equalize for the targets mass so pull is consistent
impulse *= llGetObjectMass(target_key);

// equalize for the distance of the target
// so pull is consistent
impulse *= llPow(llVecDist(my_pos, target_pos), 3.0);

// negate the targets current velocity
impulse -= llDetectedVel(i);

llPushObject(target_key, impulse, ZERO_VECTOR, FALSE);
}
}

state_exit() {
// we don't actually need to do this any more because
// listeners are cleaned up on state change but we might as well
if (REQUIRE_PERMISSION) llListenRemove(listener);
}
}  


Posted by Kingyo at 11:54Comments(0)LSL

2008年12月03日

オブジェクトの回転角度を取得する

触れるとオブジェクトの回転角度をシャウトします。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Say Rotation
//// by Liaison Dan Linden
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

// This script says it's rotations in Quaternion and Vector when it's touched
//bpJ
// global variable that isn't exposed

// state sections
// default state # all scripts must have a default state

default
{
// when a state is transitioned to, the state_entry event is raised
state_entry()
{

}

touch_start(integer number)
{
rotation gQuatRotation = llGetRot();
llSay(0, "Quat rotation =" + (string)gQuatRotation);
vector gRotation = llRot2Euler(gQuatRotation);
llShout(0, "vector rotation =" + (string)gRotation);
// key ownerKey = llGetOwner();
// llSay(0, "owner's key = " + (string)ownerKey);
// llWhisper(0, "owner's key = " + (string)ownerKey);
// llInstantMessage(ownerKey, "owner's key = " + (string)ownerKey);
}

}  


Posted by Kingyo at 22:50Comments(0)LSL

2008年10月01日

建造の制御

このスクリプトをアクティブにすると、オブジェクトは最初にREZしたSIM以外のSIMにREZできなくなります。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Stay in sim!
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

//This script makes sure that your objects stay in the sim that they are created. You can't save an object to inventory and rez in in another sim while this script is active.

123//remove the 123 to be able to use this script. Just delete the numbers and make sure running in the lower left is checked and hit save.(123を取り除いて、このスクリプトを使用下ください。)

//Make sure you save a copy of this script and all others in this package before removing the 123.default
{
state_entry()
{
llSetStatus(STATUS_DIE_AT_EDGE,TRUE);
vector INITCorner = llGetRegionCorner();
while(TRUE)
{
if(llGetRegionCorner() != INITCorner)
{
llDie();
}
}
}
}  


Posted by Kingyo at 22:25Comments(0)LSL

2008年10月01日

テクスチャーのアニメーション

プリムにマッピングされたテクスチャーがアニメーションします。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// anim SMOOTH
//// by Doug Linden(I think)
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

// Drop on an object to make it change colors.
//
// If you are interested in scripting, check out
// the Script Help under the help menu.

// The double slash means these lines are comments
// and ignored by the computer.

// All scripts have a default state, this will be
// the first code executed.
default
{
// state_entry() is an event handler, it executes
// whenever a state is entered.
state_entry()
{
// llSetTextureAnim() is a function that animates a texture on a face.
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES,1,1,1.0, 1,0.25);
// animate the script to scroll across all the faces.
}
}
  


Posted by Kingyo at 22:18Comments(0)LSL

2008年10月01日

テクスチャーの変化

クリックするとContents-Inventoryの2種類のテクスチャーが交互に変化します。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// TextureSwitcher - Touch
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

default
{

touch_start(integer total_number)
{
integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
float rand = llFrand(number);
integer choice = (integer)rand;
string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (name != "")
llSetTexture(name, ALL_SIDES);
}
}  


Posted by Kingyo at 22:14Comments(0)LSL

2008年10月01日

気圧計

クリックした位置の気圧を計測して、000.000000 KiloPascal.と表示します。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// AirPressure(vector v) Script
//// by Cid Jacobs
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

// llAirPressure(vector v) Script
// Created by: Cid Jacobs
// Original by: Cid Jacobs
// Last Updated: 11-17-05
// Notes: Speak with Cid Jacobs about any concerns.
//
//This script will calculate air pressure at the objects vector plus offset.
//
//--------------------Globals
//Global Memory Storage For Calibration Offset
float Calibration = 101.32500;
//Global Memory Storage For User Definable Vector Offset
vector Offset = <0,0,10>;
//
//
//--------------------User Defined Function
float llAirPressure(vector Offset)
{
//Extrapolate Task's Local Coordinates
vector Position = llGetPos();
//Calculate And Calibrate Air Pressure
float Base_Reading = llLog10(5- (((Position.z - llWater(ZERO_VECTOR)) + Offset.z)/15500));
//Total Sum Air Pressure
float KiloPascal = (Calibration + Base_Reading);
return KiloPascal;
}
//
//
//--------------------States
//Mandatory Default State
default
{
//Triggered By The Start Of Agent Clicking
touch_start(integer num_detected)
{
//Say Current Total Air Pressure at Task + V
llSay(0,"Current air pressure is: "
+
(string)llAirPressure(Offset)
+
" KiloPascal.");
}
}
  


Posted by Kingyo at 16:53Comments(0)LSL

2008年10月01日

ストプウォチ

クリックしてスタート、クリックしてストップ、”reset”とチャットすると時計がリセットされます。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// StopWatch
//// by Water Rogers for IBM/Opensource
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

// Purpose
// --------------------------------------------------------------
// This is a basic example of how you can create a stopwatch.
//

// Requirements
// --------------------------------------------------------------
// A single prim is all that is necessary for this example.

// Usage
// --------------------------------------------------------------
// Touch the object to toggle the timer off/on
// type "reset" to reset the timer. Not case-sensitive.



// GLOBAL VARIABLES
// --------------------------------------------------------------

integer g_Seconds = 0; // Globaly store the Seconds
integer g_Minutes = 0; // Globaly store the Minutes
integer g_Hours = 0; // Globaly store the Hours
integer g_Ticking = FALSE; // Toggles the timer off/on
vector g_TextColor = <1,1,1>; // Text color for the timer. <1,1,1> = White


// FUNCTIONS
// --------------------------------------------------------------

// This is a simple function to zero pad the numbers 2 spaces to make
// the timer look more authentic. It takes an integer as an argument
// and outputs a string.
string zero_pad(integer number)
{
if(number < 10) return "0" + (string)number;
return (string)number;
}


// EVENTS
// --------------------------------------------------------------

default
{
state_entry()
{
// ------------------------------------------------------
// This is the entry-point of the script. After a script
// has been saved or reset, this event will fire off first
// ------------------------------------------------------

// We call llSetText() first to reset the text above the object
// back to 00:00:00 time.
llSetText("00:00:00", g_TextColor, TRUE);

// Set up a listener so that we can reset the timer by typing
// "reset". This particular listener will listen to any chat
// typed by anyone (or any object)
llListen(0, "", "", "");

// Finally, we set up a timer that will repeat itself every
// g_Ticking seconds. Since g_Ticking could only ever possibly
// equal 0 or 1, we can use this to our advantage in optimizing.
// This particular example is not necessary, but can have a
// dramatic impact on larger scripts. Note that setting a timer
// to 0 (False) will indeed turn off the timer.
llSetTimerEvent(g_Ticking);
}

touch_start(integer num_detected)
{
// If someone touches the object, it will toggle the timer off/on

// We can avoid using if/else statements here because of the
// nature of our timer. Using an exclamation in front of the
// variable "flips" the bits. In this case, our variable is either
// only ever TRUE (1) or FALSE(0). Since we need the timer to
// tick each second, this becomes a nice optimization method.
g_Ticking = !g_Ticking;
llSetTimerEvent(g_Ticking);

}

listen(integer channel, string name, key id, string message)
{
// This event is fired off whenever anyone chats around the object
// and a proper listener is set up, such as in state_entry()

// We take the message and make it all lowercase so that the word
// "reset" is not case-sensitive
message = llToLower(message);
if(message == "reset")
{
// The filter determined that the word "reset" was typed. So
// we need to reset everything back to 0, and turn the timer off
g_Ticking = FALSE;
llSetTimerEvent(0);
llSetText("00:00:00", g_TextColor, TRUE);
g_Seconds = 0; g_Minutes = 0; g_Hours;
}
}

timer()
{
// This event fires off each second because the integer 1 is being
// passed as the argument for seconds in llSetTimerEvent(float seconds)

// Incriment the global Seconds variable by 1
g_Seconds++;

// If seconds are at 60, then we've just made a minute
if(g_Seconds >= 60)
{
// So we increment the global minutes by 1, and reset the seconds.
g_Minutes++;
g_Seconds = 0;

// If the minutes are at 60, then we've just made an hour
if(g_Minutes >= 60)
{
// Increment the global hours by 1, and reset the minutes.
g_Hours++;
g_Minutes = 0;
}
}

// Display everything above the object. Notice the use of the zero_pad()
// function that we created earlier to make the timer look better.
llSetText(zero_pad(g_Hours) + ":" + zero_pad(g_Minutes) + ":" + zero_pad(g_Seconds), g_TextColor, TRUE);
}
}
  


Posted by Kingyo at 16:48Comments(1)LSL

2008年10月01日

タイマー

タイマをセットしREZするだけ。時間が経過すれば"time is up" と表示されます。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Timer
//// by Murdock Pennell
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

string time = "time is up"; //this is what it will say when the time is up
float sec = 10;// how long you whant the timer to be in seconds

default
{
on_rez(integer start_param)
{
llResetScript();
}
state_entry()
{
llSetTimerEvent(sec);
}
timer()
{
llSay(0,time);
}
}  


Posted by Kingyo at 16:45Comments(0)LSL

2008年09月30日

チャットロガー

クリックするとチャットの記録を開始、再びクリックするとチャットの記録を表示します。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Chat Logger
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

list names;
list speech;
list colours=["002EB8","FF6633","006600","660066","660033","663300",
"1A9900","FF14B1","001A99","#B88A00"];
list unique_names;

default
{
state_entry()
{
llSetText("This is a chat logger - currently only for testing",<0,0,0>,1.0);
integer i;
integer c;
for (i = 0;i< llGetListLength(names);i++)
{
c = llListFindList(unique_names,llList2List(names,i,i) );
while (c >= llGetListLength(colours)) // dont crash if I run out of colours
c -= llGetListLength(colours);
llSetObjectName("[color=#" + llList2String(colours,c)
+ "]" + llList2String(names,i) );
llOwnerSay( llList2String(speech,i) + "[/color]" );
}
names = [];
speech = [];
unique_names = [];
llSetObjectName("Patch's Funky Chat Logger");
}

on_rez(integer i)
{
llResetScript();
}

touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner() )
{
llSay(0, "logging on!.");
state logging_chat;
}
}
}

state logging_chat
{
state_entry()
{
llListen(0,"",NULL_KEY,"");
}

on_rez(integer i)
{
llOwnerSay("Logging still on! Touch to get playback");
}

touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner() )
{
llSay(0, "chat logging now off - replaying log!.");
state default;
}
}

listen(integer channel, string name, key id, string message)
{
if(llListFindList(unique_names,[name]) == -1)
{
unique_names += name;
}
names += name;
speech += message;
}

}
  


Posted by Kingyo at 10:08Comments(2)LSL

2008年09月30日

メモをメール送信

コマンド"add"の後に入力したテキストを記録しコマンド"backup"で記録したテキストをメール送信します。詳しくはコマンド"help"で。
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Reminder List
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

list gReminders;//Reminder List
string gEmailBackup = "youremail@yourhost.com"; // Email for information backups
integer listnumber;
integer remove;
integer gChannel = 1;//Listen channel
string gCommand1 = "add";//command to add a list item
integer gDigits1 = 3;//Number of digits in the above command
string gCommand2 = "remove";//command to remove a list item
integer gDigits2 = 6;//Number of digits in the above command
string gRemindtext = "";
string gCommand = "";
integer command_listen;

default
{
state_entry()
{
llListenRemove(command_listen);
command_listen = llListen(gChannel, "", llGetOwner(), "");
}

listen( integer channel, string name, key id, string message )
{
if( message == "deletelist" ) //clear entire list
{
llOwnerSay("Deleting list...");
gReminders = [];// delete list
llResetScript();//reset script to update free memory report
}

if( message == "help" ) //reply with help
{
llOwnerSay("Reminder list commands");
llOwnerSay("'/" + (string)gChannel + " listhelp' - Shows these instructions." );
llOwnerSay("'/" + (string)gChannel + " add text' - Adds the specified text to the list.");
llOwnerSay("'/" + (string)gChannel + " list' - Displays the current list.");
llOwnerSay("'/" + (string)gChannel + " remove #' - Removes list entry # from the current list.");
llOwnerSay("'/" + (string)gChannel + " backup' - Sends a copy of the list to " + gEmailBackup +".");
llOwnerSay("'/" + (string)gChannel + " deletelist' - Deletes the entire list." );
}

if (message == "backup")
{
//llOwnerSay(llDumpList2String(gReminders, " \n"));
llEmail(gEmailBackup, "Reminder List Backup", "Reminder List: \n" + llDumpList2String(gReminders, " \n"));
// send copy of email to gmail
}

if( message == "list" )
{
llOwnerSay("Things to remember:");
listnumber = 1;//Start the list numbering
integer len = llGetListLength( gReminders );//Pull list length
integer i;
for( i = 0; i < len; i++ )//List stepping
{
llOwnerSay(" "+ (string)listnumber + ": " + llList2String(gReminders, i) );//report list values
listnumber = listnumber + 1;//step the list numbering +1
}
llOwnerSay("Memory remaining: " + (string)llGetFreeMemory()); //report remaining memory
}

gCommand = llDeleteSubString(message,gDigits2,-1); // Pull only the first 6 letters
if( gCommand == "gCommand2") //Check to see if it matches
{
remove = (integer)llDeleteSubString(message, 0, gDigits2);// Pull everything after the first 6 letters, mke it an integer
llOwnerSay("Removing list item #" + (string)remove);
remove = remove - 1;// Correct for lists starting at 0
gReminders = llDeleteSubList(gReminders, remove, remove);//remove desired line
}

gCommand = llDeleteSubString(message,gDigits1,-1); // Pull only the first 3 letters
if( gCommand == gCommand1) //Check to see if it matches
{
gRemindtext = llDeleteSubString(message, 0, gDigits1);// Pull everything after the first 3 letters
llOwnerSay("Adding Reminder: " + gRemindtext);// tell the user what the fuck we're doing
gReminders = gReminders + gRemindtext;//Add a new reminder to the list
}
}
}
  


Posted by Kingyo at 09:52Comments(0)LSL

2008年09月30日

スライディングドアー

スライドして開閉するドアー
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// Sliding Door v4
//// by Kayla Stonecutter
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

//How far in meters to travel in each direction. Two or all three can be used for angled movement
//NOTE: when linked, this is relative to the root prim
//Positive = move north, negative = move south
float NorthSouth = -2.0;
//Positive = move east, negative = move west
float EastWest = -0.1;
//Positive = move up, negative = move down
float UpDown = 0.0;

//The amount in seconds to stay open, set to 0 to not autoclose
float Timer = 15.0;

//Sound to play on open, either a UUID or a name in the door contents
//if a name, it must be exact. Leave at "" for no sound
string OpenSound = "cb340647-9680-dd5e-49c0-86edfa01b3ac";

//Volume to play open sound, 0.0 is same as no sound, 1.0 is max
float OpenVol = 1.0;

//Sound to play on close, either a UUID or a name in the door contents
//if a name, it must be exact. Leave at "" for no sound
string CloseSound = "e7ff1054-003d-d134-66be-207573f2b535";

//Volume to play close sound, 0.0 is same as no sound, 1.0 is max
float CloseVol = 1.0;


//misc variables
vector Pos;
vector Offset;
integer Open;
integer x;

default
{
state_entry()
{
Offset = ;
}

touch_start(integer num)
{
for(x = 0; x < num; x++)
{
Open = !Open;
if(Open)
{
Pos = llGetLocalPos();
if(OpenSound != "") llTriggerSound(OpenSound, OpenVol);
llSetPos(Pos + Offset);
llSetTimerEvent(Timer);
}else{
if(CloseSound != "") llTriggerSound(CloseSound, CloseVol);
llSetPos(Pos);
llSetTimerEvent(0);
}
}
}

on_rez(integer param)
{
llResetScript();
}

moving_end()
{
if(Open)
{
Open = 0;
llSetTimerEvent(0.0);
}
}

timer()
{
if(CloseSound != "") llTriggerSound(CloseSound, CloseVol);
llSetPos(Pos);
llSetTimerEvent(0);
Open = 0;
}
}  


Posted by Kingyo at 09:33Comments(0)LSL

2008年09月30日

回転ドアー

回転して開閉するドアー
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//// open/close door
//// creator Unknown
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

// Swinging door LSL script #1
// Handles the touch event.
// Handles the collision event.
// Handles closing the door automatically via a timer event.
// Triggers sounds when the door opens or closes.

// Parameters you might want to change

float delay = 3.0; // time to wait before automatically closing door
// set to 0.0 to not automatically close
float direction = 1.0; // set to 1.0 or -1.0 to control direction the door swings
float volume = 0.5; // 0.0 is off, 1.0 is loudest

// Variables you will most likely leave the same

key open_sound = "cb340647-9680-dd5e-49c0-86edfa01b3ac";
key close_sound = "e7ff1054-003d-d134-66be-207573f2b535";

// Processing for the script when it first starts up

default {
// What we do when we first enter this state

state_entry() {
state open; // Move to the open state
}
}

// Processing for the script when it is in the closed state

state closed {
// What we do when we first enter this state

state_entry() {
llTriggerSound(close_sound, volume); // Trigger the sound of the door closing
llSetRot(llEuler2Rot(<0, 0, direction * PI_BY_TWO>) * llGetRot());

}

// What we do when the door is clicked (”touched”) with the mouse

touch_start(integer total_number) {
state open; // Move to the open state
}

// What to do when something hits the door

collision_start(integer total_number)
{
state open; // Move to the open state
}

// What to do when the timer goes off

timer()
{
llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
}
}

// Processing for the script when it is in the open state

state open {
// What we do when we first enter this state

state_entry() {
llTriggerSound(open_sound, volume);// Trigger the sound of the door opening
llSetRot(llEuler2Rot(<0, 0, -direction * PI_BY_TWO>) * llGetRot());

llSetTimerEvent(delay); // Set the timer to automatically close it
}

// What do do when pulling the door from Inventory if it was saved while open

on_rez(integer start_param) {
state closed;
}

// What we do when the door is clicked (”touched”) with the mouse

touch_start(integer total_number) {
state closed; // Move to the closed state
}

// What to do when something hits the door

collision_start(integer total_number)
{
// Do nothing, the door is already open
}

// What to do when the timer goes off

timer()
{
llSetTimerEvent(0.0); // Set the timer to 0.0 to turn it off
state closed; // Move to the closed state
}
}


  


Posted by Kingyo at 09:30Comments(0)LSL