Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

trouble using llSetPrimitiveParams

Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
09-28-2006 23:03
I'm using a remote to manipulate prims and am running into a "llSetPrimitiveParams error running rule #1: non-integer rule." when the command is given via llSay


Controller code:
CODE

default
{
state_entry()
{

}

touch_start(integer total_number)
{
float x=llFrand(1);
float y=llFrand(1);
float z=llFrand(1);
llSay(70, "PRIM_COLOR//ALL_SIDES//<"+(string)llFrand(1)+","+ (string)llFrand(1)+","+ (string)llFrand(1)+">//1");//Using "//" as a seperator for parsing to a list.
}
}


This should broadacast all the info needed for the llSetPrimitiveParams function

Code for the object being manipulated:
CODE

default
{
state_entry()
{
llListen(70,"",NULL_KEY,"");//70 is used for changing prim size/shape/color/texture
}

listen( integer channel, string name, key id, string message)
{
list command=llParseString2List(message, ["//"],[]);
llSay(0,(string)command);//Debugging shiz
if (llGetOwnerKey(id)==llGetOwner());//Checks to see if the owner of the control box is the owner of this light
{
llSetPrimitiveParams(command);
}
}
}

my understanding is that this should take the message being broadcast on 70, put it into a list (which is the format needed in llSetPrimitiveParams), and then execute the llSetPrimitiveParams function. it's giving me an error instead of running that function.

I tried replacing the [] in the llparse string 2 list with a [","], but it still bugs out with the same error. any idea what I'm doing wrong?
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Ben Fassbinder
Registered User
Join date: 16 Jun 2005
Posts: 13
Try this:
09-28-2006 23:22
http://rpgstats.com/wiki/index.php?title=ExampleListConversion

The list you are generating in your receiver is made up of all strings. That is why SetPrims is upset.

Ben
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
09-28-2006 23:42
From: Ben Fassbinder
http://rpgstats.com/wiki/index.php?title=ExampleListConversion

The list you are generating in your receiver is made up of all strings. That is why SetPrims is upset.

Ben


thanks for the link. I'm not understanding exactly what's going on there. direct CnP into my script gave me some errors so I think I edited the extra brackets and whatnot for it to work. from what little I'm understanding, the code you linked attaches a "type" to each element of my list. what type would ALL_SIDES fall under when it gets sent?

Here's my new Controller Code
CODE

string slc_sep = "#!$"; // funky name for clean namespaces

string list_2_string(list l) {
list result = [];
integer len = llGetListLength(l); // optimization
integer i;
for (i = 0; i < len; ++i)
{
result += [llGetListEntryType(l,i)|llGetListEntryType(l, i)] + llList2List(l, i, i);
}
return llDumpList2String(result, slc_sep);
}

default
{
state_entry()
{

}

touch_start(integer total_number)
{
list command=[PRIM_COLOR, ALL_SIDES, <llFrand(1),llFrand(1),llFrand(1)>,1]; //command to be broadcast to the lights
llSay(70,list_2_string(command));
}
}


and here's my new code for the reciever:
CODE

string slc_sep = "#!$"; // funky name for clean namespaces

list string_2_list(string s) {
list l = [];
list result = [];
l = llParseStringKeepNulls(s, [slc_sep], []);
integer len = llGetListLength(l);
integer i;
for (i = 0; i < len; ++i) {
integer type = (integer) llList2String(l, i);
++i; // CLEVERNESS WARNING...BE VERY AFRAID
if (type == TYPE_INTEGER) result += (integer)llList2String(l, i);
else if (type == TYPE_FLOAT) result += (float)llList2String(l, i);
else if (type == TYPE_KEY) result += (key)llList2String(l, i);
else if (type == TYPE_VECTOR) result += (vector)llList2String(l, i);
else if (type == TYPE_ROTATION) result += (rotation)llList2String(l, i);
else result += llList2String(l, i);
}
return result;
}



default
{
state_entry()
{
llListen(70,"",NULL_KEY,"");//70 is used for changing prim size/shape/color/texture
}

listen( integer channel, string name, key id, string message)
{
if (llGetOwnerKey(id)==llGetOwner());//Checks to see if the owner of the control box is the owner of this light
{
llSetPrimitiveParams(string_2_list(message));
}
}
}


It works and I thank you for the help.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.