animated gif |
|
// :CATEGORY:Special Effects
// :NAME:Automatic_GIF_to_SL_script
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2011-06-21 20:30:18.273
// :EDITED:2014-02-07 19:09:12
// :ID:67
// :NUM:94
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// DESCRIPTION: Automatic_GIF_to_SL_script
// :CODE:
// Put any texture converted by gif_2_SL_animation_v0.6.exe into a prim
// with this script to get it to play back automatically as a movie
integer animOn = TRUE; //Set to FALSE and call initAnim() again to stop the animation.
//Effect parameters: (can be put in list together, to make animation have all of said effects)
//LOOP - loops the animation
//SMOOTH - plays animation smoothly
//REVERSE - plays animation in reverse
//PING_PONG - plays animation in one direction, then cycles in the opposite direction
list effects = [LOOP]; // LOOP for GIF89 movies
//Movement parameters (choose one):
//ROTATE - Rotates the texture
//SCALE - Scales the texture
//Set movement to 0 to slide animation in the X direction, without any special movement.
integer movement = 0;
integer face = ALL_SIDES; //Number representing the side to activate the animation on.
integer sideX = 1; //Represents how many horizontal images (frames) are contained in your texture.
integer sideY = 1; //Same as sideX, except represents vertical images (frames).
float start = 0.0; //Frame to start animation on. (0 to start at the first frame of the texture)
float length = 0.0; //Number of frames to animate, set to 0 to animate all frames.
float speed = 10.0; //Frames per second to play.
initAnim() //Call this when you want to change something in the texture animation.
{
if(animOn)
{
integer effectBits;
integer i;
for(i = 0; i < llGetListLength(effects); i++)
{
effectBits = (effectBits | llList2Integer(effects,i));
}
integer params = (effectBits|movement);
llSetTextureAnim(ANIM_ON|params,face,sideX,sideY, start,length,speed);
}
else
{
llSetTextureAnim(0,face,sideX,sideY, start,length,speed);
}
}
fetch()
{
string texture = llGetInventoryName(INVENTORY_TEXTURE,0);
llSetTexture(texture,ALL_SIDES);
list data = llParseString2List(texture,[";"],[]);
llOwnerSay( llDumpList2String(data ,","));
string X = llList2String(data,1);
string Y = llList2String(data,2);
string Z = llList2String(data,3);
// llOwnerSay("X=" + X + " Y=" + Y + " Z = " + (string) Z);
sideX = (integer) X;
sideY = (integer) Y;
speed = (float) Z;
if (speed)
initAnim();
}
default
{
state_entry()
{
fetch();
}
changed(integer what)
{
if (what & CHANGED_INVENTORY)
{
fetch();
}
}
} |
colore+messaggio |
|
default { state_entry() { //llPlaySound("Vivaldi_9",1.0); } collision_start(integer total_number) { llSetColor(<1.0, 0, 0>,ALL_SIDES); // change color! //llSetColor(<0, 1.0, 0.0>, face); // change the face's color llSetText("Vai avanti, questa è la strada giusta per entrare al museo.", <0,0,1.0>, 1.0); // set text } collision_end(integer total_number) { llSetColor(<0, 1.0, 0>,ALL_SIDES); // change color! llSetText("", <1.0,1.0,0>, 1.0); // reset text } } |
messaggio |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 5, PI, 5);
}
sensor(integer total_number) {
llSetText("Quando l'allievo supera il maestro!", <1.0,1.0,0>, 1.0);
}
} |
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, , PI, 5);
}
sensor(integer total_number) {
llSetText("Pietro Perugino, pittore insigne. Se era stata smarrita l'arte della pittura, egli la ritrovò. Se non era stata ancora inventata, egli la portò fino a questo punto.", <0,0,0>, 1.0);
}
} |
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
default
{
touch_start(integer total_number) {
// speak out loud!
// Il canale 0 è il PUBLIC_CHANNEL. Tutti possano sentire le chat trasmesse su questo canale.
llSay(0,"Pietro pintor perugino pinse pintura per poco prezzo");
}
} |
Cambia un colore x collisione |
|
default
{
state_entry()
{
//llPlaySound("Vivaldi_9",1.0);
}
collision_start(integer total_number) {
llSetColor(<1.0, 0, 0>,ALL_SIDES); // change color!
//llSetColor(<0, 1.0, 0.0>, face); // change the face's color
llSetText("Vai avanti, questa è la strada giusta per entrare al museo.", <0,0,1.0>, 1.0); // set text
}
collision_end(integer total_number) {
llSetColor(<0, 1.0, 0>,ALL_SIDES); // change color!
llSetText("", <1.0,1.0,0>, 1.0); // reset text
}
} |
Cambia un colore |
|
|
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 0.5, PI, 5);
}
sensor(integer total_number) {
// change color!
llSetColor(<1.0, 0, 0>,ALL_SIDES);
}
} |
Cambia un colore |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
list recent_avatars;
add_avatar(string name) {
if(!seen(name)) {
recent_avatars += name;
if (llGetListLength(recent_avatars) > 25) {
recent_avatars = llDeleteSubList(recent_avatars,0,0);
}
}
}
integer seen(string name) {
if(llListFindList(recent_avatars,[name]) > -1) { return TRUE; }
return FALSE;
}
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 1, PI, 5);
}
sensor(integer total_number) {
if(!seen(llDetectedName(0))) {
// change color!
llSetColor(<0,1.0,0>,ALL_SIDES);
add_avatar(llDetectedName(0));
}
}
} |
cambia un colore in una faccia |
|
integer face = -1;
vector color = <1.0, 1.0, 1.0>;
default
{
touch_start(integer num)
{
if(~face)//quick & dirty but efficient way of testing if face is not equal to -1
llSetColor(color, face); //restore the color
face = (face + 1) % llGetNumberOfSides(); //increment and keep the face number in range
color = llGetColor(face); //save the face's color
llSetColor(<0.5, 0.0, 0.0>, face ); //change the face's color
}
} |
Color Changer |
|
|
// Color Changer Plus v1.0
// by Neo Calcutt
//
// distributed under the Creative Commons Attribution-Share Alike 3.0 United States License.
//
// please leave the script full permissions and keep this header intact
integer listenChannel = 5; // you might want to change this
default
{
state_entry()
{
llListen(listenChannel, "", NULL_KEY, "");
}
listen(integer channel, string name, key id, string message)
{
// uncomment the next line to only listen to the owner
// if (id != llGetOwner()) return;
// uncomment the next line to only listen to the owner and other objects by the owner
// if (llGetOwnerKey(id) != llGetOwner()) return;
// this would be black
vector color = ZERO_VECTOR;
if (message == "navy") color = <0.000, 0.122, 0.247>;
else if (message == "blue") color = <0.000, 0.455, 0.851>;
else if (message == "aqua") color = <0.498, 0.859, 1.000>;
else if (message == "teal") color = <0.224, 0.800, 0.800>;
else if (message == "olive") color = <0.239, 0.600, 0.439>;
else if (message == "green") color = <0.180, 0.800, 0.251>;
else if (message == "lime") color = <0.004, 1.000, 0.439>;
else if (message == "yellow") color = <1.000, 0.863, 0.000>;
else if (message == "orange") color = <1.000, 0.522, 0.106>;
else if (message == "red") color = <1.000, 0.255, 0.212>;
else if (message == "maroon") color = <0.522, 0.078, 0.294>;
else if (message == "fuchsia") color = <0.941, 0.071, 0.745>;
else if (message == "purple") color = <0.694, 0.051, 0.788>;
else if (message == "white") color = <1.000, 1.000, 1.000>;
else if (message == "silver") color = <0.867, 0.867, 0.867>;
else if (message == "gray") color = <0.667, 0.667, 0.667>;
else if (message == "random")
{
float r = llFrand(1.0);
float g = llFrand(1.0);
float b = llFrand(1.0);
color = <r, g, b>;
}
else if (llSubStringIndex(message, "<") == 0)
color = (vector)message;
llSetColor(color, ALL_SIDES);
}
} |
cambia colore |
|
|
// Cycle color each second for every 15 degress around the color wheel
// @author: JB Kraft
// ------------------------------------------------------------------------
// Jan 28, 2007 - v0.1 orig example code
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// 24 color values, one for each 15 degrees around the color wheel
list realcolors = [
<1.000000, 0.000000, 0.000000>, <1.000000, 0.200000, 0.000000>,
<1.000000, 0.400000, 0.000000>, <1.000000, 0.501961, 0.000000>,
<1.000000, 0.600000, 0.000000>, <1.000000, 0.698039, 0.000000>,
<1.000000, 0.800000, 0.000000>, <1.000000, 0.898039, 0.000000>,
<1.000000, 1.000000, 0.000000>, <0.800000, 1.000000, 0.000000>,
<0.200000, 1.000000, 0.000000>, <0.000000, 0.800000, 0.000000>,
<0.000000, 0.698039, 0.400000>, <0.000000, 0.600000, 0.600000>,
<0.000000, 0.400000, 0.698039>, <0.000000, 0.200000, 0.800000>,
<0.098039, 0.098039, 0.698039>, <0.200000, 0.000000, 0.600000>,
<0.250980, 0.000000, 0.600000>, <0.400000, 0.000000, 0.600000>,
<0.600000, 0.000000, 0.600000>, <0.800000, 0.000000, 0.600000>,
<0.898039, 0.000000, 0.400000>];
// keep time
integer g_TIMER = 0;
// the offset into the color array
integer g_NDX = 0;
// ------------------------------------------------------------------------
// D E F A U L T
// ------------------------------------------------------------------------
default
{
// --------------------------------------------------------------------
state_entry()
{
}
// --------------------------------------------------------------------
touch_start(integer total_number)
{
// turn the timer on/off
g_TIMER = !g_TIMER;
// cheeky use of flag as timer value
llSetTimerEvent( g_TIMER );
}
// --------------------------------------------------------------------
timer( )
{
if( g_NDX > llGetListLength( realcolors ) - 1) {
g_NDX = 0;
}
llSetColor( llList2Vector( realcolors, g_NDX), ALL_SIDES );
++g_NDX;
}
} |
cambio texture |
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
// Note: You will need to copy both this script and a texture into your object
default
{
touch_start(integer total_number) {
// set the texture
llSetTexture("autoritratto_giovane",ALL_SIDES);
}
} |
random color ogni 30'' |
|
//////
// OK, so randBetween is from the llFrand page
// we can use it to generate a random number from minimum to maximum.
// You will see how it works in the example below
//
// and yes, I flip around with color and colour - in my comments its colour, in code, I concede to LL
float randBetween(float min, float max)
{
return llFrand(max - min) + min;
}
//////
// Colours are expressed in vectors.
// So, below gives us a basic random colour generator
vector randColor()
{
return <llFrand(1.0), llFrand(1.0), llFrand(1.0)>; //sends back a message to whoever asks the random colour
}
//////
// Taking it one step further
// So, below gives us a basic random colour generator
vector randVector()
{
//HERE we use the randBetween we have up on top to
//make a random number from 100 to 500 - on the Z axis. Fun for a trampoline :)
return <0,0,randBetween(100, 500)>;
}
default
{
state_entry() {
llSetTimerEvent(30);
}
timer()
{
vector tempRandomColor = randColor(); //this loads temp ariable with random colur
// llSay(0, (string)tempRandomColor ); //this says the vector, just to know its working
llSetColor(tempRandomColor, ALL_SIDES); //set colour
// llPushObject( llDetectedKey(0), randVector(), ZERO_VECTOR, 0); // here we push the person who touched cube,
}
} |
Messaggio sensor |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 5, PI, 5);
}
sensor(integer total_number) {
llSetText("Ricicla qui le tue lattine...", <1.0,0,0>, 1.0);
}
no_sensor()
{
//llWhisper(PUBLIC_CHANNEL, "Ora non c'è nessuno vicino a me!");
llSetText("", <1.0,1.0,0>, 1.0); // reset text
}
} |
Descrizione |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
// Note: After you copy this script into your creation, you will also need to copy the item to give into the object
default
{
touch_start(integer total_number) {
// This line will pick out the first thing of the right type and give it to whomever triggered the event
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
}
} |
fontana |
|
|
// http://pastebin.com/xV5R6kmb# // key target = "66b758c0-b18d-49cf-b655-996e5e9bea9a"; // integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE; // PSYS_SRC_PATTERN_EXPLODE, PSYS_SRC_PATTERN_DROP, PSYS_SRC_PATTERN_ANGLE_CONE, PSYS_SRC_PATTERN_ANGLE float radius=.35; // NOT FOR DROP FIRING OFFSET to OBJECT CENTER // punto di sparo, offset rispetto al centro float bangle=PI/4-0.01; // BEGIN/END ANGLE // angolo di inizio *ONLY* for ANGLE_CONE float eangle=PI/4; integer flags = 0 | PSYS_PART_EMISSIVE_MASK // particles are luminous // particelle luminose | PSYS_PART_INTERP_COLOR_MASK // change color // cambiano colore | PSYS_PART_INTERP_SCALE_MASK // change scale // cambiano dimensioni // | PSYS_PART_WIND_MASK // follow random wind in the sim // seguono il vento casuale // | PSYS_PART_BOUNCE_MASK // bounce over the z axis // rimbalzano sull'asse z dell'oggetto // | PSYS_PART_TARGET_POS_MASK // target an avatar or object...verso un target // | PSYS_PART_TARGET_LINEAR_MASK // target LINEAR va direttamente al target ; string texture = ""; // TEXTURE UUID ""=empty float age=0; // AGE in secs of the system 0 forever // età del sistema 0=per sempre float bdelay=0.1; // DENSITY: frequency of burst .0=max density // DENSITA', frequenza di generazione 0=massima densità integer partcount=500; // NUM Particles to generate // numero particelle da generare ad ogni lancio float partage=3; // AGE of single particle // ETA di ogni particella float maxspeed=2; // FIRING SPEED 0:will stay stationary | velocità di sparo 0 rimane ferma float minspeed=1; // ACCELERATION = gravity | acceleratione = gravità vector push=<0,0,-1>; // starting color WHITE | colore di partenza BIANCO vector scolor=<1,1,1>; // colore di arrivo BLU // ending color BLUE vector ecolor=<0,0,1>; // TRASPARENZA 1=opaco, 0= trasparente // TRANSPARENCY float salpha=1; float ealpha=1; // STARTING/END SCALE // dimensioni iniziali/finali vector startSize=<0.04,0.04,0>; vector endSize=<0.4,0.4,0>; // OMEGA rotation // rotazione vector omega=<0,0,0.5>; default { state_entry() {
llParticleSystem([
PSYS_PART_FLAGS,flags, PSYS_PART_MAX_AGE,partage, PSYS_PART_START_COLOR, scolor, PSYS_PART_END_COLOR, ecolor, PSYS_PART_START_SCALE,startSize, PSYS_PART_END_SCALE,endSize, PSYS_SRC_PATTERN, pattern, PSYS_SRC_BURST_RATE,bdelay, PSYS_SRC_ACCEL, push, PSYS_SRC_BURST_PART_COUNT,partcount, PSYS_SRC_BURST_RADIUS,radius, PSYS_SRC_BURST_SPEED_MIN,minspeed, PSYS_SRC_BURST_SPEED_MAX,maxspeed, PSYS_SRC_TARGET_KEY,target, PSYS_SRC_ANGLE_BEGIN,bangle, PSYS_SRC_ANGLE_END,eangle, PSYS_SRC_OMEGA, omega, PSYS_SRC_MAX_AGE, age, PSYS_SRC_TEXTURE, texture, PSYS_PART_START_ALPHA, salpha, PSYS_PART_END_ALPHA, ealpha ]); } } |
prendi un oggetto |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
// Note: After you copy this script into your creation, you will also need to copy the item to give into the object
default
{
touch_start(integer total_number) {
// This line will pick out the first thing of the right type and give it to whomever triggered the event
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0));
}
} |
prendi da bere |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
// Note: After you copy this script into your creation, you will also need to copy the item to give into the object
default
{
touch_start(integer total_number) {
// This line will pick out the first thing of the right type and give it to whomever triggered the event
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0));
}
} |
offri da bere |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
// Note: After you copy this script into your creation, you will also need to copy the item to give into the object
list recent_avatars;
add_avatar(string name) {
if(!seen(name)) {
recent_avatars += name;
if (llGetListLength(recent_avatars) > 25) {
recent_avatars = llDeleteSubList(recent_avatars,0,0);
}
}
}
integer seen(string name) {
if(llListFindList(recent_avatars,[name]) > -1) { return TRUE; }
return FALSE;
}
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 1, PI, 5);
}
sensor(integer total_number) {
if(!seen(llDetectedName(0))) {
// This line will pick out the first thing of the right type and give it to whomever triggered the event
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0));
add_avatar(llDetectedName(0));
}
}
} |
play sound |
|
|
// This script was auto-generated by Ann Enigma's script autogenerator
// available at http://www.3greeneggs.com/autoscript/
// Note: You will need to copy both this script and a sound into your object
default
{
state_entry() {
llSensorRepeat("", NULL_KEY, AGENT, 5, PI, 5);
}
sensor(integer total_number) {
llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1);
}
} |
salta (palla) |
|
|
// The code below was generated by
// SCRATCH FOR SECOND LIFE (S4SL)
// alpha release October 19, 2007
//
// by Eric Rosenbaum (ericr@media.mit.edu)
// MIT Media Lab
// Lifelong Kindergarten group
//
// S4SL is a modified version of Scratch,
// a graphical programming language for kids
// see scratch.mit.edu
//
//
// USER VARIABLES
//
float i_uservar = 0;
float j_uservar = 0;
float max_uservar = 0;
//
// INTERNAL VARIABLES
//
vector home;
integer penState;
float penColor;
float color;
float ghost;
vector originalScale;
float sizePercent;
integer numAvatarsNearby;
vector nearestAvPosition;
key ownerKey;
vector ownerPosition;
//
// INTERNAL FUNCTIONS
//
// move(steps)
// move object a number of steps (meters) along its current heading
// forward is along the positive x axis
// if the pen is down, create a line segment along the path traveled
// the line is positioned by its center, which is placed halfway back along the path
move(float steps)
{
vector fwd = llRot2Fwd(llGetRot()) * steps;
llSetPos(llGetPos() + fwd);
if (penState == TRUE) {
if (llGetInventoryType("lineSegment") == INVENTORY_NONE) {
llSay(0, "Oops! To draw a line, my inventory needs a lineSegment. You can get one from the Scratch Inventory Box.");
} else {
integer randomID = llRound(llFrand(99999999));
llRezObject("lineSegment", llGetPos()-fwd/2, <0,0,0>, llGetRot(), randomID);
llSay(1, (string)randomID + ":set length:"+ (string)llFabs(steps));
llSay(1, (string)randomID + ":set color:" + (string)penColor);
}
}
}
// turnRight(float angle)
// turn angle degrees clockwise around the local z axis
turnRight(float angle)
{
angle *= -1;
rotation newRot = llEuler2Rot(<0,0,angle> * DEG_TO_RAD);
llSetRot(newRot*llGetRot());
}
// turnLeft(float angle)
// turn angle degrees counterclockwise around the local z axis
turnLeft(float angle)
{
rotation newRot = llEuler2Rot(<0,0,angle> * DEG_TO_RAD);
llSetRot(newRot*llGetRot());
}
//up(float steps)
//move up along the global z axis by steps meters
//does not leave a line segment
up(float steps)
{
llSetPos(llGetPos()+<0,0,steps>);
}
//down(float steps)
//move down along the global z axis by steps meters
//does not leave a line segment
down(float steps)
{
llSetPos(llGetPos()+<0,0,-1*steps>);
}
// turnPitch(float angle)
// turn angle degrees upward around the local y axis
turnPitch(float angle)
{
angle *= -1;
rotation newRot = llEuler2Rot(<0,angle,0> * DEG_TO_RAD);
llSetRot(newRot*llGetRot());
}
// float getHeading()
// return the current heading in the xy plane in degrees
float getHeading() {
return llRot2Angle(llGetRot())*RAD_TO_DEG;
}
// setHeading(float angle)
// set the heading in the xy plane in degrees
setHeading(float angle) {
vector newVec = <0, 0, angle*DEG_TO_RAD>;
rotation newRot = llEuler2Rot(newVec);
llSetRot(newRot);
}
// turnRoll(float angle)
// turn angle degrees clockwise around the local x axis
turnRoll(float angle)
{
rotation newRot = llEuler2Rot(<angle,0,0> * DEG_TO_RAD);
llSetRot(newRot*llGetRot());
}
// changePenColorBy(float num)
// change the pen color by an amount
changePenColorBy(float num)
{
penColor += num;
setPenColorTo(penColor);
}
// setPenColorTo(float num)
// set the pen to a particular color
setPenColorTo(float num)
{
penColor = (integer)num % 100;
}
// penDown()
// put the pen down, so that when the object moves it will draw
penDown() {
penState = TRUE;
}
// penUp()
// put the pen up, so that the object will not draw when it moves
penUp() {
penState = FALSE;
}
// clear()
// broadcast a message to nearby line segments that will cause them to
// delete themselves
clear() {
llSay(1, "clearLineSegments");
}
// pointTowardNearestAv()
// turn to point toward the nearest avatar
pointTowardNearestAv()
{
vector myPos = llGetPos();
float xdiff = myPos.x - nearestAvPosition.x;
float ydiff = myPos.y - nearestAvPosition.y;
float angle = llAtan2(xdiff, ydiff) * RAD_TO_DEG;
setHeading(270 - angle);
}
// pointTowardOwner()
// turn to point toward the owner
pointTowardOwner()
{
vector myPos = llGetPos();
float xdiff = myPos.x - ownerPosition.x;
float ydiff = myPos.y - ownerPosition.y;
float angle = llAtan2(xdiff, ydiff) * RAD_TO_DEG;
setHeading(270 - angle);
}
// float distanceToNearestAv()
// returns the distance in meters to the nearest avatar
float distanceToNearestAv()
{
return llVecDist(llGetPos(), nearestAvPosition);
}
// float distanceToOwner()
// returns the distance in meters to the owner
float distanceToOwner()
{
return llVecDist(llGetPos(), ownerPosition);
}
// float randomMinToMax(float min, float max)
// returns a random number between min and max
integer randomMinToMax(float min, float max)
{
return llRound(llFrand(max - min) + min);
}
// say(string text)
// say the text on the public chat channel 0 so all nearby avatars and objects will hear it
say(string text)
{
llSay(0, text);
}
// broadcast(string message)
// say the message on channel 1. No avatars will hear it.
// all nearby objects will hear it.
broadcast(string message)
{
llSay(1, message);
}
// setText(string text)
// create opaque white floating text above the object
setText(string text)
{
llSetText(text, <1,1,1>, 1);
}
// vector hueToRGB(float h)
// take a color represented as a hue value between 1 and 100 and
// return an RGB vector representing the same color.
vector hueToRGB(float h)
{
integer i;
float f;
float p;
float q;
float t;
float r;
float g;
float b;
float s = 1;
float v = 1;
h *= 5; // sector 0 to 5
i = llFloor(h);
f = h - i; // factorial part of h
p = v * ( 1 - s );
q = v * ( 1 - s * f );
t = v * ( 1 - s * ( 1 - f ) );
if (i == 0) {
r = v;
g = t;
b = p;
} else if (i == 1) {
r = q;
g = v;
b = p;
} else if (i == 2) {
r = p;
g = v;
b = t;
} else if (i == 3) {
r = p;
g = q;
b = v;
} else if (i == 4) {
r = t;
g = p;
b = v;
} else {
r = v;
g = p;
b = q;
}
return <r,g,b>;
}
// setColor(float num)
// set the color of the object using a number between 1 and 100 representing a hue
setColor(float num)
{
color = (integer)num % 100;
llSetColor(hueToRGB(color / 100), ALL_SIDES);
if (llGetObjectName() == "Scratch Bug") {
llSetLinkColor(2, hueToRGB(color / 100), ALL_SIDES);
} else {
//llSetLinkColor(LINK_SET, hueToRGB(color / 100), ALL_SIDES);
}
}
// changeColorBy(float num)
// change the hue of the object by a number
changeColorBy(float num)
{
float newColor = color + num;
if (newColor < 0) {
newColor = 0;
}
if (newColor > 100) {
newColor = 100;
}
setColor(newColor);
}
// setGhost(float num)
// set the ghost effect of the object to a value between 0 (opaque) and 100 (transparent)
setGhost(float num)
{
ghost = (integer)num % 101;
llSetAlpha(((100 - ghost) / 100), ALL_SIDES);
llSetLinkAlpha(LINK_SET, ((100 - ghost) / 100), ALL_SIDES);
}
// changeGhostBy(float num)
// change the ghost effect on an object by a number
changeGhostBy(float num)
{
setGhost(ghost + num);
}
// setSize(float newSize)
// set the size of the object to a percentage of its original size
setSize(float newSize)
{
sizePercent = newSize;
vector newScale = originalScale*(sizePercent/100);
llSetScale(newScale);
}
// changeSizeBy(float change)
// change the size of an object by a percentage of its original size
changeSizeBy(float change)
{
sizePercent += change;
vector newScale = originalScale*(sizePercent/100);
llSetScale(newScale);
}
// playSound(string snd)
// play a sound at full volume
// snd can be the name of a sound in the inventory of the object, or the
// UUID of a sound which exists somewhere else
playSound(string snd)
{
llPlaySound(snd, 1);
}
// playSoundNamed(string snd)
// play a sound at full volume
// snd can be the name of a sound in the inventory of the object, or the
// UUID of a sound which exists somewhere else
// this is the version for text input of the name of a sound in a scratch block
// so it checks the inventory and gives an error if the sound is missing
playSoundNamed(string snd)
{
if (llGetInventoryType(snd) == INVENTORY_NONE) {
llSay(0, "Oops! My inventory does not contain the sound " + snd);
} else {
llPlaySound(snd, 1);
}
}
// wait(float secs)
// pause all execution of this script for some number of seconds
wait(float secs)
{
llSleep(secs);
}
// levelOut()
// remove the x and y rotation components, so that the object is
// level with respect to the ground
levelOut()
{
vector myVec = llRot2Euler(llGetRot());
vector newVec = <0, 0, myVec.z>;
rotation newRot = llEuler2Rot(newVec);
llSetRot(newRot);
}
// goHome()
// move the object back to its home position
// home is set the the position of the object when it is created,
// and can be set to a new position using setHomeHere()
goHome()
{
llSetPos(home);
//levelOut();
}
// setHomeHere()
// set the home position to the current position
setHomeHere()
{
home = llGetPos();
}
// startListening()
// listen for messages on both channel 0, the public channel,
// and channel 1, where broadcasts are sent
startListening()
{
llListen(0, "", "", "");
llListen(1, "", "", "");
}
// initInternal()
// do some setup for internal functions
// this includes setting various variables to their defaults
// clearing text on the object, and turning on
// the repeating sensor and timer events
initInternal()
{
setHomeHere();
penState = FALSE;
penColor = 0;
color = 0;
ghost = 0;
sizePercent = 100;
originalScale = llGetScale();
ownerKey = llGetOwner();
llSetText("", <1,1,1>, 0);
llSensorRepeat("", "", AGENT, 96, PI, .1);
llSetTimerEvent(.1);
startListening();
}
initAll() {
initInternal();
}
listen1(string msg){
if (msg == "salta") {
max_uservar = 10;
i_uservar = 0;
j_uservar = max_uservar;
integer i1;
for (i1=0; i1<max_uservar;i1++) {
i_uservar += 1;
playSound("989eef2f-8170-3acb-5706-8fc78f540dc6");
up(i_uservar);
j_uservar = (max_uservar - i_uservar);
wait((i_uservar / max_uservar));
down(i_uservar);
}
}
}
default
{
state_entry()
{
initAll();
}
on_rez(integer start_param)
{
initAll();
}
sensor(integer n)
{
numAvatarsNearby = n;
nearestAvPosition = llDetectedPos(0);
integer i;
for (i=0; i<n; i++) {
if (llDetectedKey(i) == ownerKey) {
ownerPosition = llDetectedPos(i);
}
}
}
touch_start(integer n) {
}
collision_start(integer n) {
}
listen(integer channel, string name, key id, string msg) {
listen1(msg);
}
timer() {
}
}
|
Private Youtube Video Player v6.0 |
|
key theVideoTexture = "42073da2-45da-4ecd-982e-08062c3c5cc7";
string VideoBaseUrl = "http://www.youtube.com/embed/IzHaK-muHH4?rel=0&autoplay=1;fs=0;autohide=0;hd=0;";
string type = "text/html";
PlayVideo( key theAvatar ) {
llParcelMediaCommandList([
PARCEL_MEDIA_COMMAND_AGENT, theAvatar,
PARCEL_MEDIA_COMMAND_TEXTURE, theVideoTexture,
PARCEL_MEDIA_COMMAND_URL, VideoBaseUrl,
PARCEL_MEDIA_COMMAND_TYPE, type,
PARCEL_MEDIA_COMMAND_LOOP
]);
}
default {
touch_start( integer numTouchers ) {
integer i;
for (i = 0; i < numTouchers; ++i) {
PlayVideo( llDetectedKey( i ));
}
}
} |
Timed Presentation Display v1.1 |
|
float gap = 15.0;
float counter = 0.0;
integer numberPicture = 0;
integer totalPictures = 0;
string nameObject = "blank";
//integer scan = 0;
string message = "";
// Scan to be counter number of displays
forward()
{
numberPicture++;
if (numberPicture >= totalPictures) numberPicture = 0;
nameObject = llGetInventoryName(INVENTORY_TEXTURE, numberPicture);
llSetTexture(nameObject, 2);
llSetText("Page " + (string)(numberPicture + 1) + " of " + totalPictures, < 1, 1, 1 >, 1.0 );
}
default
{
state_entry()
{
totalPictures = llGetInventoryNumber(INVENTORY_TEXTURE);
//llListen(0, "", "", "" );
llListen(14142, "", "", "" );
numberPicture = 0;
//llSay(0, (string)numberPicture);
nameObject = llGetInventoryName(INVENTORY_TEXTURE, numberPicture);
llSetTexture(nameObject, 2);
llSetText("Page " + (string)(numberPicture + 1) + " of " + totalPictures, < 1, 1, 1 >, 1.0 );
llSetTimerEvent(gap);
}
on_rez(integer startParam)
{
llResetScript();
//numberPicture = 0;
}
timer()
{
counter = counter + gap;
forward();
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
totalPictures = llGetInventoryNumber(INVENTORY_TEXTURE);
}
}// END //
|
Prim Face Identifier |
|
// This is an extremely simple script to identify the number of the face clicked.
// Useful primarily for taking the numbers and using them with scripts that
// affect faces on a prim (for example texture modifiers).
//
// - Xugu Madison
default
{
on_rez(integer param)
{
llResetScript();
}
state_entry()
{
llOwnerSay("Touch me to identify the number of each face on this prim.");
}
touch_start(integer touchCount)
{
integer touchIdx;
for (touchIdx = 0; touchIdx < touchCount; touchIdx++)
{
if (llDetectedKey(touchIdx) != llGetOwner())
{
return;
}
llOwnerSay("You touched face #"
+ (string)llDetectedTouchFace(touchIdx) + ".");
}
}
} |
random color |
|
//////
// OK, so randBetween is from the llFrand page
// we can use it to generate a random number from minimum to maximum.
// You will see how it works in the example below
//// and yes, I flip around with color and colour - in my comments its colour, in code, I concede to LL
float randBetween(float min, float max)
{
return llFrand(max - min) + min;
}
//////
// Colours are expressed in vectors.
// So, below gives us a basic random colour generator
vector randColor()
{
return <llFrand(1.0), llFrand(1.0), llFrand(1.0)>; //sends back a message to whoever asks the random colour
}
//////
// Taking it one step further
// So, below gives us a basic random colour generator
vector randVector()
{
//HERE we use the randBetween we have up on top to
//make a random number from 100 to 500 - on the Z axis. Fun for a trampoline :)
return <0,0,randBetween(100, 500)>;
}
default
{
touch_start(integer total_number)
{
vector tempRandomColor = randColor(); //this loads temp ariable with random colur
llSay(0, (string)tempRandomColor ); //this says the vector, just to know its working
llSetColor(tempRandomColor, ALL_SIDES); //set colour
///here we push the person who touched cube,
llPushObject( llDetectedKey(0), randVector(), ZERO_VECTOR, 0);
}
} |
create an animate-on-touch attachment with permission system |
|
integer playing;
default
{
state_entry()
{
playing = FALSE;
}
touch_start(integer start_param)
{
if(playing == FALSE)
{
llRequestPermissions(llDetectedKey(0),PERMISSION_TRIGGER_ANIMATION);
}
else if(playing == TRUE)
{
llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
playing = FALSE;
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
playing = TRUE;
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
}
}
}
|