|
Quarrel Kukulcan
Registered User
Join date: 21 Feb 2006
Posts: 48
|
03-03-2006 17:19
I haven't been able to declare new varaibles local to one state without a syntax error. Can they only be made local to a function or sub-function code block? Here's the relevant section: float cJUST_A_CLICK_DISTANCE = 0.1; vector gClickPos;
state live { // float clickPos; <--This doesn't work, had to define global gClickPos instead.
touch_start(integer total_number) { gClickPos = llGetPos(); // Where I was at mouse-down. }
touch_end(integer total_number) { // If I barely moved since mouse-down, handle single-click event, // otherwise it's a drag and just let that happen. if (llVecDist(gClickPos, llGetPos()) < cJUST_A_CLICK_DISTANCE) { state inert; } } }
|
|
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
|
03-03-2006 17:24
From: someone Can they only be made local to a function or sub-function code block?
Yes. http://secondlife.com/badgeo/wakka.php?wakka=localvariables
|
|
Quarrel Kukulcan
Registered User
Join date: 21 Feb 2006
Posts: 48
|
03-03-2006 17:54
Thanks. I'd seen that already. Silly me was mislead by the oversimplified, non-technical definition of "code block" there. ("Between an opening and closing brace -- { }." 
|