Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Torus and llSetPrimParams

Jesu Forager
Registered User
Join date: 17 Oct 2007
Posts: 25
12-17-2007 16:37
Ok took em hours to get this even to run without errors, but now for some reason it sets all params to 0 and I have no idea why, it outputs the variables as correct int he checker llownersay command, any ideas mates? Thanks in advance

integer channel = 68;
integer switch = 0;
list origsize;

integer holeshape;
vector cut;
float hollow;
vector twist;
vector holesize;
vector holesizeN;
vector topshear;
vector profilecut;
vector taper_a;
float revolutions;
float radiusoffset;
float skew;

default
{
state_entry()
{
llListen(channel, "", llGetOwner(), "";);
}

listen(integer channel, string name, key id, string message)
{
if(message == "throb";)
{
llOwnerSay("I hear you";);
integer i;
string check;

if(switch == 0)
{
llSay(0, llKey2Name(llGetOwner())+"'s tail is throbbing";);
origsize = llGetPrimitiveParams([PRIM_TYPE]);


integer holeshape = (integer)llList2String(origsize, 1);
vector cut = (vector)llList2String(origsize, 2);
float hollow = (float)llList2String(origsize, 3);
vector twist = (vector)llList2String(origsize, 4);
vector holesize = (vector)llList2String(origsize, 5);
vector holesizeN = <holesize.x+0.1, holesize.y+0.05, holesize.z>;
vector topshear = (vector)llList2String(origsize, 6);
vector profilecut = (vector)llList2String(origsize, 7);
vector taper_a = (vector)llList2String(origsize, 8);
float revolutions = (float)llList2String(origsize, 9);
float radiusoffset = (float)llList2String(origsize, 10);
float skew = (float)llList2String(origsize, 11);

switch = 1;

llOwnerSay( (string)holeshape+"," +(string)cut+"," +(string)hollow+"," +(string)twist+"," +(string)holesizeN+"," +(string)topshear+"," +(string)profilecut+"," +(string)taper_a+"," +(string)revolutions+"," +(string)radiusoffset+"," +(string)skew);
llSleep(1);
llSetTimerEvent(0.5);
}
else
{
llSay(0, llKey2Name(llGetOwner())+"'s tail is calm";);
switch = 0;
llSetTimerEvent(0);
llSetPrimitiveParams([ PRIM_TYPE, PRIM_TYPE_TORUS, holeshape, cut, hollow, twist, holesize, topshear, profilecut, taper_a,revolutions, radiusoffset, skew]);
}
}
}
timer()
{
//llSetPrimitiveParams([ PRIM_SIZE, (vector)llDumpList2String(llGetPrimitiveParams([PRIM_SIZE]),"";)+<0.03, 0, 0.03>]);
//llSleep(0.25);
llOwnerSay("changing";);
llSleep(1);
llSetPrimitiveParams([ PRIM_TYPE, PRIM_TYPE_TORUS, holeshape, cut, hollow, twist, holesizeN, topshear, profilecut, taper_a, revolutions, radiusoffset, skew ]);
llSleep(5);
//llSetPrimitiveParams([ PRIM_TYPE, PRIM_TYPE_TORUS, holeshape, cut, hollow, twist, holesize, topshear, profilecut, taper_a, revolutions, radiusoffset, skew]);
}
on_rez(integer sp)
{
llResetScript();
}
}
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
12-17-2007 18:47
The problem is scoping of the variables corresponding to the prim parameters. You have them defined as global at the top, which is what is intended, but then you declare them again local to the listen event, so you're setting those local variables, not the global ones. So when the timer event happens, it looks at those global variables.

So, in the listen, you want to assign, not declare the variables. That is, instead of

integer holeshape = (integer)llList2String(origsize, 1);

you just want

holeshape = (integer)llList2String(origsize,1);

and similar for the others.
Jesu Forager
Registered User
Join date: 17 Oct 2007
Posts: 25
12-17-2007 18:53
-slams head against the wall repeatedly-


ugggggh
I can't believe when I did the copy paste down I forgot to remove those >.<
thanks dude, I knew it was porlly something I just wasn't seeing beacuse I'd been starin at ti for hours and it all melts together, cuz I was looking at logic not syntax

THANKS man!