Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with StarParam!

Paradigm Brodsky
Hmmm, How do I set this?
Join date: 28 Apr 2004
Posts: 206
08-08-2004 02:56
I need help. why is lsl telling me that a == b, and b == c, but a != c ?

Supposedly the Start Parameter sent by Rez_Object and llGetStartParameter are good for something.

I have dire need of it for making amunition. Editing objects that die in 4 to 6 seconds or move on their own is very difficult. I need parts of the script to run only if it was rezzed from another object, like a gun. that way if I rez it form inventory I don't have to worry about it going away before I can edit the script..

However for some reason this morning the Start_Parameter isn't working in any sort of sincible fasion.

I ran a test sending the number 2 from an object to the object it was spawning via rez_object , and found that indeed printing the declared parameter variable gives the correct value. as in:

------------------------------------
on_rez(integer start_param)
{
llSay(0,(string)start_param);
}


output -->

object: 2

-------------------------------------

however assigning the value of start_param to a global variable doesn't work. When I tried it the new variable remained "null 0" while start_param was equal to 2. illus:


------------------------------------
on_rez(integer start_param)
{
param == start_param;
llSay(0,(string)start_param);
llSay(0,(string)param);

}

output ------->

object: 2
object: 0

-------------------------------------

This is frustrating beyond words. The way I see it, if param == start_param, and start_param == 2, then param should also equal 2. But apparently lsl didn't pass this part of the IQ test.

ARRRGGHHGHGGGHHHHH!!!!
Is their something I'm missing?

Also, I tried using llGetStartParameter();, and it also returned 0. :-( when rez_object sent 2. What's going on????
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
08-08-2004 03:06
CODE
on_rez(integer start_param)
{
param == start_param;
llSay(0,(string)start_param);
llSay(0,(string)param);
}


If that's your actual code, the problem is that you're doing param == start_param; instead of param = start_param;.

So because you've (presumably) declared an integer named param, and are only assigning it a value in your on_rez event, it will remain 0, because you're not actually assigning the value, you're basically checking to see if it's the same as start_param, which it of course is not. It's just a quirk of C-style syntax, and one that bugs pretty much every programmer on a pretty regular basis. It's a pretty easy thing to typo, and it's not something that the compiler will catch and return an error on.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Paradigm Brodsky
Hmmm, How do I set this?
Join date: 28 Apr 2004
Posts: 206
08-08-2004 03:10
GAH!!! You are right!! I feel so stupid now!!! YOU ARE LIKE MY HERO!!!! THis just proves that I should be sleeping at 6:00 AM and not doing LSL. I'm going to bed now. In shame.