Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Any Help??

Trish Barbasz
Registered User
Join date: 29 Dec 2007
Posts: 17
09-19-2008 10:41
I'm trying to make something gain glow gradualy in a timer only if something is said and if the glow isn't full, if the glow is full the glow disapears. I'm modifying a script I have that does the same for alpha. This is the original;

default
{
state_entry()
{
llSetStatus(STATUS_PHANTOM, FALSE);
llListen(0,"","","";);
llSetTimerEvent(.1);
}

listen( integer channel, string name, key id, string message )
{
if(message == "open";)
{
state two;

}}
timer()
{
llSetLinkAlpha(LINK_SET,llGetAlpha(0)+.05,ALL_SIDES);
llSleep(.1);
llResetTime();
}}
state two
{
state_entry()
{
llSetStatus(STATUS_PHANTOM, TRUE);
llListen(0,"","","";);
llSetTimerEvent(.1);
}

listen( integer channel, string name, key id, string message )
{
if(message == "close";)
{
llResetScript();
}}
timer()
{
llSetLinkAlpha(LINK_SET,llGetAlpha(0)-.05,ALL_SIDES);
llSleep(.1);
llResetTime();
}
}



This is what I've made so far;


integer glow = PRIM_GLOW;
integer max = 1;
default
{
state_entry()
{
llListen(2,"","","";);
}

listen( integer channel, string name, key id, string message )
{
if(message == "test";)
{
llSetTimerEvent(.1);
}
}

timer()
{
llGetPrimitiveParams([ PRIM_GLOW, ALL_SIDES]);
if(glow = max)
{
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, 0 ])
llResetTime();
}

else if(glow = max)
{
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, llGetPrimitiveParams([ PRIM_GLOW, ALL_SIDES]) + .05 ]);
llSleep(.1);
}
}
}

I could really use some help because it's not reading the if or else function and I don't even know if what I have there is right, also I don't know if what I have for the gradual glow gain is right. Can someone help? Either post something helpful here on contact me in game would be great! Thanks! :*
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
09-19-2008 10:50
thats right

if A == A

else if A==A

the else if will not be tested becuase its already getting a TRUE returned from the if statement

....

for a (half hearted) solution use a second if instead of else if, which should let you see the flaw of testing for the same condition twice
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-19-2008 10:52
You're using = instead of ==..

if (a = b) will not test that a equals b. It will assign the value of b to a then the if will work if b is non-zero..
Trish Barbasz
Registered User
Join date: 29 Dec 2007
Posts: 17
09-19-2008 11:00
From: Osgeld Barmy
thats right


for a (half hearted) solution use a second if instead of else if, which should let you see the flaw of testing for the same condition twice


Alright but I want it to check for anything below 1, what would be the if for that? DO you know?
Trish Barbasz
Registered User
Join date: 29 Dec 2007
Posts: 17
09-19-2008 11:01
From: Sindy Tsure
You're using = instead of ==..

if (a = b) will not test that a equals b. It will assign the value of b to a then the if will work if b is non-zero..


OK that should help a bit. THanks!
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-19-2008 11:50
maybe this? the first if test if the glow equals max, the else if test if it doesn't equal max

From: Trish Barbasz

timer()
{
llGetPrimitiveParams([ PRIM_GLOW, ALL_SIDES]);
if(glow == max)
{
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, 0 ])
llResetTime();
}

else if(glow != max)
{
llSetPrimitiveParams([ PRIM_GLOW, ALL_SIDES, llGetPrimitiveParams([ PRIM_GLOW, ALL_SIDES]) + .05 ]);
llSleep(.1);
}
}
}

I could really use some help because it's not reading the if or else function and I don't even know if what I have there is right, also I don't know if what I have for the gradual glow gain is right. Can someone help? Either post something helpful here on contact me in game would be great! Thanks! :*
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
09-19-2008 12:18
How about just 'else'?
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-19-2008 12:45
From: Hewee Zetkin
How about just 'else'?


that's true lol, i've just been doing alot of menu scripts lately so i've been using alot of "else if" for different functions.
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369