Jump to content

A not so simple script


galasya Fierenza
 Share

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

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

Recommended Posts

I am just starting to learn scripting and what I need is WAY beyond my abilities. I have a script that does part of what I need just not everything and I am unsure how to add the part it doesnt have. Here is what I am making and what I have so far:

 

I am making a typer that will have the object be invisible when I am not typeing (the part I have) and when it IS visible I want it to slowly pulse with light. The typer will be a spell ball, and I have the animation to make it be held in front of me while I wave a wand over it....Just cant figure out how to make it pulse. Here is the script I had made for me I just dont know how to make it work for what I want:

 

integer ownerTyping = 0;
key owner;
integer perm = 0;
//////////Colors///////////////
vector white = <1.0,1.0,1.0>;
vector blue = <0.0,0.3,1.0>;
vector purple = <0.5,0.0,1.0>;
vector red = <1.0,0.0,0.0>;
vector orange = <1.0,1.0,0.5>;
vector pink = <1.0,0.0,0.6>;
vector yellow = <1.0,1.0,0.0>;
vector gray = <0.35,0.35,0.35>;
vector brown = <0.5,0.3,0.15>;
vector black = <0.0,0.0,0.0>;
//////////Settings/////////////
string typingSound = "83b15820-2561-4850-71bc-6a985836fbe1";//You can replace this sound UUID with your own sound UUID or place a sound in the root prim and paste the name here
float volume = 1.0;//volume of your typing sound can be 0.0 = no volume to 1.0 = full volume
vector color = white;//default color. Choose from colors above
float alpha = 1.0;//default alpha transparency 0.0 = invisible / 1.0 = visible
float glow = 1.0;//the amount you want the prim to glow when you type (0.0 = no glow / 1.0 = full glow)
string type = "typing";//the name of the typing animation in the inventory. You can replace the animation in the inventory and place the new name here.
//////////Particle/////////////
particleEffect()
{
llLinkParticleSystem(LINK_THIS,
[//If you are using the Triple Effects Particle Machine by Animation Station, you can paste your own Particle Parameters Here and delete the parameters below.
//if you are familiar with how to change the parameter settings, you can do that below
PSYS_SRC_TEXTURE,llGetInventoryName(INVENTORY_TEXTURE,0),//drop a texture in the inventory to use with the provided particle effect
PSYS_PART_START_SCALE,<0.0,0.1,0.0>,
PSYS_PART_END_SCALE,<0.1,0.0,0.0>,
PSYS_PART_START_COLOR,<1.0,1.0,1.0>,
PSYS_PART_END_COLOR,<1.0,1.0,1.0>,
PSYS_PART_START_ALPHA,1.0,
PSYS_PART_END_ALPHA,1.0,
PSYS_SRC_BURST_PART_COUNT,2,
PSYS_SRC_BURST_RATE,0.05,
PSYS_PART_MAX_AGE,0.3,
PSYS_SRC_MAX_AGE,0.0,
PSYS_SRC_PATTERN,(integer)8,
PSYS_SRC_BURST_SPEED_MIN,0.1,
PSYS_SRC_BURST_SPEED_MAX,0.1,
PSYS_SRC_BURST_RADIUS,0.5,
PSYS_SRC_ANGLE_BEGIN,(float)0.0*PI,
PSYS_SRC_ANGLE_END,(float)1.0*PI,
PSYS_SRC_OMEGA,<0.0,0.0,0.0>,
PSYS_SRC_ACCEL,<0.0,0.0,-0.1>,
PSYS_PART_FLAGS,(0
|PSYS_PART_INTERP_COLOR_MASK
|PSYS_PART_INTERP_SCALE_MASK
|PSYS_PART_EMISSIVE_MASK)
//|PSYS_PART_FOLLOW_VELOCITY_MASK
//|PSYS_PART_WIND_MASK
//|PSYS_PART_BOUNCE_MASK
//|PSYS_PART_FOLLOW_SRC_MASK
//|PSYS_PART_TARGET_POS_MASK
//|PSYS_PART_TARGET_LINEAR_MASK
]);
}
default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,alpha]);//sets the prim color and visibility to default
owner = llGetOwner();//gets the your avatar key for later use
llPreloadSound(typingSound);
}
timer()
{

if((llGetAgentInfo(owner) & AGENT_TYPING) && !ownerTyping)
{
llStopSound();//stop the default typing sound
ownerTyping = 1;//set the flag to 1 (TRUE) so it recognizes you are typing and doesnt spam this portion of the script
llStopAnimation("type");//stop the default typing animation
llStartAnimation(type);//start your custom animation
llPlaySound(typingSound,volume);//play the typing sound at your chosen volume
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,glow]);//sets the prim glow to the default glow
//llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,alpha]);//sets the prim color and visibility to default
particleEffect();//starts the particle effect
}

else if(!(llGetAgentInfo(owner) & AGENT_TYPING) && ownerTyping)
{
ownerTyping = 0;//set the flag to 0 (FALSE) so it recognizes you stopped typing and doesnt spam this portion of the script
llStopAnimation(type);//stop your custom typing animation
llStopSound();//stop your typing sound
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,0.0]);//sets the prim glow off (0.0)
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,0.0]);//sets the prim color and the visibility to invisible (0.0)
llLinkParticleSystem(LINK_THIS,[]);//turns the particle effect off
}
}
changed(integer change)
{
if(change & CHANGED_OWNER)//owner has changed so reset the script and get a new owner
{
llResetScript();
}
}
attach(key id)
{
if(id != NULL_KEY)//you just attached this item so it goes invisible and no glow and no particle
{
llSetTimerEvent(0.25);//starts the timer to check whether you are typing or not now that the object is attached
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,0.0]);//sets the prim glow off (0.0)
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,0.0]);//sets the prim color and the visibility to invisible (0.0)
llLinkParticleSystem(LINK_THIS,[]);//turns the particle effect off
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}
else//you just detached this item so it goes visible so you can see it if you dropped it on the ground
//it sets the color and makes the prim visible, but turns the glow off and the particle off
{
if(perm)
{
perm = 0;//permissions to animate your avatar have been removed
llStopAnimation(type);//stop the animation if in case you were typing when this was detached
}
llSetTimerEvent(0.0);//stop the timer so it doesnt respond while detached
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_GLOW,ALL_SIDES,0.0]);//sets the prim glow off (0.0)
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,ALL_SIDES,color,alpha]);//sets the prim color and visibility to default
llLinkParticleSystem(LINK_THIS,[]);//turns the particle effect off
}
}
run_time_permissions(integer perm)//the script has asked if it can animate your avatr when you attached this object to your avatar
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
perm = 1;//permission granted
}
else
{
perm = 0;//permission denied
}
}
}

Link to comment
Share on other sites

you could do that with glow and a timer?

(although that would blink, you might need to fade it ...)

integer tog;

timer()

{   tog = !tog;

    {  llSetLinkPrimitiveParamsFast(LINK_THIS,  [  PRIM_GLOW, ALL_SIDES,  0.05*tog ]);

    }

}

 

Link to comment
Share on other sites

Try this.  It glows, it pulses, it's magical  (sort of) ...

default{    state_entry()    {        llSetColor(<1.0,1.0,0.0>,ALL_SIDES);        llParticleSystem([           PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0),           PSYS_PART_START_SCALE, <0.02, 0.02, FALSE>,            PSYS_PART_END_SCALE, <3.0, 3.0, FALSE>,            PSYS_PART_START_COLOR, <1.00,1.00,0.00>,           PSYS_PART_END_COLOR, <1.00,1.00,0.00>,            PSYS_PART_START_ALPHA, 0.5,           PSYS_PART_END_ALPHA, 0.0,                PSYS_SRC_BURST_PART_COUNT, 1,            PSYS_SRC_BURST_RATE, 0.05,             PSYS_PART_MAX_AGE, 0.75,            PSYS_SRC_PATTERN, 1,            PSYS_PART_FLAGS,( 0                                     | PSYS_PART_INTERP_COLOR_MASK                                   | PSYS_PART_INTERP_SCALE_MASK                                   | PSYS_PART_EMISSIVE_MASK                                   | PSYS_PART_FOLLOW_SRC_MASK                                     | PSYS_PART_TARGET_POS_MASK                                 )]);    }}

 

 

Link to comment
Share on other sites

Formatted this way (hint: try post editor's tool with "C clipboard" icon), it's too difficult to really study the code (and I'm too lazy), but it seems as if ithe script is already trying to do PRIM_GLOW and has some sort of particle system. Maybe there's a bug keeping it from working right, but I'd also suggest trying PRIM_POINT_LIGHT along with the PRIM_GLOW. Granted, lots of people have turned off attached lights to avoid the horrors of facelights, but otherwise it might be part of the effect you're seeking.

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...