Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Easy Question

Poseidon Klinger
Registered User
Join date: 12 Aug 2006
Posts: 1
08-25-2006 19:19
I have coded before and feel retarded for asking this question. I can't even get a variable declared. I originally had a timer even based on the value of dec, but got the syntax error I am still getting even after taking out all of my changes to the script I got from the wiki. What noob mistake am I making to get a syntax error on line 2?



CODE

default {
integer dec = 42;
state_entry() {
llSetTimerEvent(1.0); // generate a timer event every 1 second
}

timer() {
llSetAlpha(0.0, ALL_SIDES);
}
}
Guido Columbia
Registered User
Join date: 25 Oct 2005
Posts: 102
08-25-2006 19:53
CODE

integer dec = 42; // Declare the variable before anything else. (global variable)

default {

state_entry() {
llSetTimerEvent(1.0); // generate a timer event every 1 second
}

timer() {
llSetAlpha(0.0, ALL_SIDES);
}
}
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
08-25-2006 19:56
aye you can only have global's or event varibles, course if you make one under the event it will only work while the script is dealing with that event ... and will be reset every time the event is called ...

CODE

default {
state_entry() {
integer dec = 42; // ONLY WORKS IN STATE ENTRY
llSetTimerEvent(dec);
}


this would be fine for a timer event, becuase the ll function gets its data and does its thing... just be wise how you use them

CODE

touch_start (integer t)
{
integer x;
++x;
if (x > 1) llDoStuff();
}


would never work out becuase x is reset to zero everyone someone touches it :)