Jump to content

Object properties from the point of view scripts


AlexandreLois1
 Share

You are about to reply to a thread that has been inactive for 2457 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

The object is not deleted. It becomes invisible. Here's a script

 

Skript‚ rainbow

// :CATEGORY:Rainbow
// :NAME:L94arainbowroy
// :AUTHOR:Dana Moore
// :CREATED:2010-01-10 05:20:56.000
// :EDITED:2013-09-18 15:38:56
// :ID:444
// :NUM:600
// :REV:1.0
// :WORLD:Second Life
// :DESCRIPTION:
// L9.4a-rainbow-roy.lsl
// :CODE:

// Copyright © 2008, Scripting Your World
// All rights reserved.
//
// Scripting Your World
// By Dana Moore, Michael Thome, and Dr. Karen Zita Haigh
// http://syw.fabulo.us
// http://www.amazon.com/Scripting-Your-World-Official-Second/dp/0470339837/
//
// You are permitted to use, share, and adapt this code under the
// terms of the Creative Commons Public License described in full
// at http://creativecommons.org/licenses/by/3.0/legalcode.
// That means you must keep the credits, do nothing to damage our
// reputation, and do not suggest that we endorse you or your work.

integer NUM_PARTICLES_PER_RADIAN = 50;
float RAINBOW_ARC = PI_BY_TWO;

startRainbowROY()
{
integer numParticles = (integer)(RAINBOW_ARC *
NUM_PARTICLES_PER_RADIAN);
float age = 10.0; // you can also use these in the call
float burstRate = 0.2; // to llParticleSystem()
float total = (age * numParticles) / burstRate;
llOwnerSay("This emitter manages "+(string)total +" particles");

// Based on Listing B.1. Unchanged values removed to save trees
llParticleSystem( [
PSYS_PART_FLAGS, PSYS_PART_INTERP_COLOR_MASK | // change colour
PSYS_PART_INTERP_SCALE_MASK | // let it grow
PSYS_PART_FOLLOW_VELOCITY_MASK,
//Appearance
PSYS_PART_START_SCALE, <2.0, 0.3, 0.0>, // <1,1,0>,
PSYS_PART_END_SCALE, <2.5, 0.3, 0.0>, // <1,1,0>,
PSYS_PART_START_COLOR, <1.0, 1.0, 0.0>, // <1,1,1>,
PSYS_PART_END_COLOR, <1.0, 0.2, 0.0>, // <1,1,1>,
PSYS_PART_START_ALPHA, 0.8, // 1.00,
PSYS_PART_END_ALPHA, 0.8, // 1.00,
//Flow
PSYS_PART_MAX_AGE, age, // 10.00,
PSYS_SRC_BURST_RATE, burstRate, // 0.10,
PSYS_SRC_BURST_PART_COUNT, numParticles, // 1,

//Placement
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE, // DROP,
PSYS_SRC_BURST_RADIUS, 15.0, // 0.00,
PSYS_SRC_ANGLE_BEGIN, 0.0, // 0.00,
PSYS_SRC_ANGLE_END, RAINBOW_ARC, // 0.00,
//Movement
PSYS_SRC_BURST_SPEED_MIN, 0.1, // 1.00,
PSYS_SRC_BURST_SPEED_MAX, 0.1 // 1.00,
]);
}

default {
state_entry() {
llSetAlpha(ALL_SIDES,0);
startRainbowROY();
}
on_rez(integer _n) {
llResetScript();
}
}
// END //

Link to comment
Share on other sites

The script will make the PRIM and NOT THE OBJECT where it is put in invisible and start the particles effect.

If it doesnt work in some cases you

- confuse prims and objects (objects can be simple prims or a group of linked prims - your script will end in the root prim if you select the whole object)
- put a script in which was set to non running state
- tried it at a place where scripts don't run.

 

Link to comment
Share on other sites

Your script is quite simple.  It  says:

state_entry() {    llSetAlpha(ALL_SIDES,0);    startRainbowROY();}

That means "When the script starts, make the prim that contains this script transparent and start a particle display called ROY."  As Nova says, the llSetAlpha command applied to the prim that the script is in, NOT to other prims in the linkset.  If you want to make all prims in a linkset transparent, you will have to do it with llSetLinkAlpha.  So, Nova gave you a list of the reasons why this script might make some objects transparent but not others.  If you have an object with more than one prim, this script will not turn all prims transparent.  If you rez your object in a no-script zone, it won't do anything.

HOWEVER, there's one other thing that will make it unreliable, and I think it's the real reason you are having trouble.  Your syntax is wrong.  You should not write

llSetAlpha(ALL_SIDES,0);

You should write

llSetAlpha(0.0,ALL_SIDES);

The way you wrote it will make the top face (face 0) have the alpha value = -1, which will be interpreted as 0.0 = transparent.  If you put this script in an object and then don't look at face 0, you won't see it do anything.

 

Link to comment
Share on other sites


Nova Convair wrote:

The script will always make the prim invisible. Always.

If you put it in an object hat is made of 10 prims for example it will make the root prim invisible. The other 9 prims will stay as they are.

This is not quite true. I have created an object from one prim and he did not become invisible when placed script


If y
ou have an object with more than one prim, this script will not turn all prims transparent.  If you rez your object in a no-script zone, it won't do anything.

this does not explain
the phenomenon.


 

 

Link to comment
Share on other sites


AlexandreLois1 wrote:


Nova Convair wrote:

The script will always make the prim invisible. Always.

If you put it in an object hat is made of 10 prims for example it will make the root prim invisible. The other 9 prims will stay as they are.

This is not
quite true.
I have created
an object from
one
prim
and
he
did not become
invisible
when placed
script

[ .... ]

 

It is true, but now you know why your script doesn't work. Just fix that llSetAlpha statement.  And if you have a multi-prim object, you'll have to rewrite the script to use llSetLinkAlpha so that more than one prim becomes transparent.

Link to comment
Share on other sites

 

 

It
is
true, but now you know why your script doesn't work. Just fix that
llSetAlpha
statement.  And if you have a multi-prim object, you'll have to rewrite the script to use
llSetLinkAlpha
so that more than one prim becomes transparent.

 

My script works, but it works strange. For me, the problem does not make the object transparent, and find out why it strange works.

Link to comment
Share on other sites

Yes, you do need to change the script. That's the whole point. That statement is written incorrectly.  If you leave it the way it is written, it will only make one face of the prim that it is in transparent instead of making the whole prim transparent.

Link to comment
Share on other sites


AlexandreLois1 wrote:

 

I have
an object that
disappears when
I
put
a certain script
.
Other objects
do not disappear
when
I put
in
these objects
this script
.
What is the difference between
objects
?


Single Prim Objects with only face 0 vanish.  Objects with multiple prims or single prims with faces other than 0 will not.

Face 0 of the prim containing the script will vanish.  It's possible to have a single prim mesh object which has only face 0 and has multiple faces. 

Which explains it all.  Interesting puzzle you sculpted for us.

I assume you aren't trying to fix anything.  If you were you should pay attention to the people who tried to help you  fix what looks like an obvious error.

 

  • Like 1
Link to comment
Share on other sites

QK, I <3 UR reply!

@ Alexandre: From the answers that have been given already, you can find the answer to your question. You will know the number of face 0 because that is the face that will be transparent.

Or you can use google and look for "lsl cube faces" and find this text:

 

Finding the value of a face

If you are unsure about which face number to use, following these steps will give you the face number to use.

  • Enable the Develop menu by pressing Ctrl+Alt+Q. (On version 1.x viewers, instead enable the Advanced menu by pressing Ctrl+Alt+D.)
  • Select the Face Using the "Select Texture" Tool
  • Pick Develop > Rendering > Selected Texture Info from the menu, or press Ctrl+Alt+Shift ⇧+T

The face number will be shown in your local chat window or as a notification.

http://wiki.secondlife.com/wiki/Face

  • Like 1
Link to comment
Share on other sites


Emma Krokus wrote:

The particle rainbow is a half-circle - I think your prim is turned 90 degrees and the rest of the rainbow is underground.

 

That's a good guess, Emma.  It's sort of an ugly cartoon texture but almost certainly meant to be a full half-circle.  Rotating the emitting prim will fix that.

Link to comment
Share on other sites

Emma is certainly correct about needing to rotate the emitter, but the picture got me wondering about the three-colour rainbow.   I can see red, orange and yellow bands, but what, I asked myself, can have happened to the green, blue, indigo and violet bands?

I consulted my copy of Scripting Your World and, sure enough, it requires two emitters.  In my copy of the book, it  gives the full listing for the green, blue, indigo and violet bands in chapter 9 (listing 9.4) with some notes on what to change to achieve the red, orange and yellow bands in this script.  

If I can find the time, I'll go and make a rainbow according the the book's instructions and see what it looks like.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2457 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...