Jump to content

Question about Scripts and Variables, which is better?


Tristus Patton
 Share

You are about to reply to a thread that has been inactive for 4117 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello, thanks for clicking in.

Im scripting something that has multi positions, and I use llSetLinkPrimitiveParamsFast, to change the position, size and rotation of child prims. There are 19 poitions, which have 3 prims that need to be moved. I use llSetLinkPrimitiveParamsFast, 19 times, but I was thinking that I can make it so I only have it once in the script itself, but for each of the 19 positions, it sets different variables which relate to the position, size and rotation of each prim, then it gets that one llSetlinkPrimitiveParamsFast to change everything. Ive done it I know its possible, my question though is what is better, like less lag?


19 llSetLinkPrimitiveParamsFast or one llSetLinkPrimitiveParamsFast, with 9 variables that change per position?

I hope I explained this clearly, thanks for any help you can provide.

Link to comment
Share on other sites

If I've properly understood it, in both cases, for each position you'd be calling llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_LINK_TARGET, ...]) and moving all 3 prims in the one call.    So the question is, whether it's better to hardcode the position, size and rotation each time or fetch them from a list.

That being the case, I would have thought (though I'm open to correction) that hardcoding them will involve less script activity, at the price of using more script memory.  

 

Link to comment
Share on other sites

I guess all you can do is keep calling llGetFreeMemory and see how things are shaping up.   Bear in mind that you're going to need some spare memory (at least temporarily) while the script is fetching the variables and building the parameter list, so the savings by using variables might not be as great as would first appear.

I'm really not sure, though, that it's going to make a huge amount of difference either way to sim performance how you do it, unless the thing is running constantly on a fast timer (in which case, probably simply slowing downg the timer would do considerably more good than changing how you do llSetLinkPPFast).

My inclination would be to use variables, but I think that's just because it's how I'm used to doing it.  I find it easier to read the different values into a list and process them at run time than I do to write lots of llSetLinkPPFast calls, and it makes my code look cleaner, neither of which are particularly good reasons, of course.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4117 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...