Jump to content

Error on Script Warning/Debug


RilaVirum
 Share

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

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

Recommended Posts

I'm getting this error, how can I fix this, I think I'm missing a conversion, maybe?

 llSetPrimitiveParams error running rule #2: non-integer rule.

 

//Change Texture on Touch

default
{
   

touch_start(integer total_number)
    {
        integer x = llGetInventoryNumber(INVENTORY_TEXTURE);
        
        list Pictures = [];
        {
            
            Pictures += [PRIM_LINK_TARGET,llList2Integer(Pictures,x)];
            Pictures += [llGetInventoryName (INVENTORY_TEXTURE, x)];
        
            llSetPrimitiveParams(Pictures);
        }
        
       

       if(llDetectedTouchFace(0))
        {
            llOwnerSay("Face Touched");
            x += 1;
        }
    
        if(x == llGetListLength(Pictures))
        {
            x = 0;
        }
       
     }
}
    

Edited by RilaVirum
Link to comment
Share on other sites

The functions for prim-params require a very specific list of parameters.
http://wiki.secondlife.com/wiki/LlSetPrimitiveParams

 

Quote

[ PRIM_LINK_TARGET, integer link_target ]

PRIM_LINK_TARGET must be followed by a single integer. That part is correct in your script.

But then you include a name of the texture (string) before you've told the function that's what it is. (That's the "rule.") You're also missing a lot of other requirements after it.

Quote

[ PRIM_TEXTURE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians ]

You need to add PRIM_TEXTURE, followed by the face number, texture name/UUID (what you had), repeats, offsets, and rotation. The texture name is not enough on its own. You can find these values in the edit tools window's texture tab.

Edited by Wulfie Reanimator
  • Like 4
  • Thanks 1
Link to comment
Share on other sites

llGetInventoryNumber will return the number of the type of item specified in the object's inventory, in this case INVENTORY_TEXTURE. The individual items are indexed, and those indexes run from 0 to that number - 1. So if there's only one texture in the inventory llGetInventoryNumber will return 1, and to find that texture's name you need to use its index, 0: llGetInventoryName (INVENTORY_TEXTURE, 0). And if there were five textures you'd need to call llGetInventoryName (INVENTORY_TEXTURE, 0) for the first, through to llGetInventoryName (INVENTORY_TEXTURE, 4) for the fifth.

llList2Integer takes an item from a list and tries to return it as an integer. When the script calls it here the list Pictures is empty so the function will always return 0 for want of anything better.

I'm not sure how llSetPrimitiveParams (which originally worked only on the prim the script was in) reacts to the PRIM_LINK_TARGET rule (which came along to let you manipulate several different links in a single call to llSetLinkPrimitiveParams[Fast]), having never experimented with that, though the wiki page that covers this set of functions doesn't seem to say anything about not using it there.

llDetectedTouchFace returns the number of the face that was clicked: anything from 0 to up to 7. If the face clicked was face 0 the if test will fail, while with any other clicked face it will succeed.

There's more, too, to do with filling up the list Pictures and using an index to work though it and where to do that, but scripting can be a real pain to get started with, so I'll stop here.

Incidentally, I'm guessing that the idea is to put some textures in an object and then apply them in sequence to that object whenever it's clicked?

  • Thanks 1
Link to comment
Share on other sites

Hey Wulfie! :)  oh! The PRIM_TEXTURE, I completely forgot about that, lol.  When you say this "before you've told the function"  like what do you mean?  I'm pretty new!  >_< lol.  I'm still a beginner, what?

Edited by RilaVirum
Link to comment
Share on other sites

Hey Kingsley, Yes that's what I'm trying to do,  I'm only using one prim, so I don't need the PRIM_LINK_TARGET then, ok, I'll take that out, And yes I'm using the face 0 for it,  I think that's what you're saying Kingsley,  I should change that face to another one? And ok cool, Yeah it's a lot of script, lol I'm putting a list statement together,  I'm learning how to do it :p 

Link to comment
Share on other sites

23 minutes ago, RilaVirum said:

Hey Wulfie :)  oh! The PRIM_TEXTURE, I completely forgot about that, lol.  When you say this "before you've told the function"  like what do you mean?  I'm pretty new!  >_< lol.  I'm still a beginner, before what?

llSetPrimitiveParams needs the list of parameters to be in an order it understands.

That order goes something like: [ rule, params, rule, params, ... ]

The rule tells the function what parameters will come after it.

If you don't give it a rule, it doesn't understand the parameters and the script won't work.

If the parameters don't match the rule, the script won't work.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

If it matters which face is clicked (perhaps only one, or some but not all of them) to change the texture then yes, you'll need something like if (llDetectedTouchFace (0) == 0) in there. But if it's meant to work whatever face gets clicked you can leave that out entirely. The fact that the touch_start event has been triggered means that one of the faces has been clicked.

The 0 in that llDetectedTouchFace call is tied to the parameter total_number in the touch_start event. total_number tells you how many different clicks there are to be processed in the event, and llDetectedTouchFace(0) gets the number of the face clicked in the first of those clicks. Similarly, llDetectedKey (0) gets the key of whoever was responsible for that first click. All the other llDetectedSomething functions work in the same way. The index used in the llDetected* functions works just like that for llGetInventoryName, in that it can run from 0 to total_number - 1.

Now, as it happens, a while ago there were questions asked as to whether the touch_start event ever returned more than one click at a time. Quite a few people tried various tests but it only ever returned a single click. Nevertheless it's worth noting this if you ever start to use other events, like the sensor event, where the parameter does actually tell you how many different results there are, and you then need to use the llDetected* functions with an index other than 0.

Edited by KT Kingsley
  • Thanks 1
Link to comment
Share on other sites

Yeah it is only one face of the prim. Ok "exactly equal"  to the face got it. I'm gonna need..to write this down, lol.  n yeah Detected functions alone, you need more conditions. Just using touch_start alone that's easy. Nice! I never tried sensor(), that's awesome I have yet to try it. This is really helpful, Thank you so much. 

Edited by RilaVirum
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1285 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...