Jump to content

two issues. sending prim params also acts on the sending prim...


carley Greymoon
 Share

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

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

Recommended Posts

i've cobbled together a script that sends prim parameters to another prim setting that prim's specular values, but the spec values of the prim doing the sending is also changing.

i can't figure out how to stop that.

also i need to add to the code a way for the user to step the values up or down after they are set. what kind of code is used for that?

 

thank you for any help.

Link to comment
Share on other sites

Without seeing any code snippets all I can suggest is that you check the value of the first parameter in the llSetLinkPrimitiveParams call, it's possible to get this wrong and use a value the will work on the link_set rather than just a particular child number.

For user-adjustment you will need to look at using dialogs to allow the user to change values in a specific direction, or else use touches to alter the values in a cyclical manner so they click away until they like what they see.

Link to comment
Share on other sites

2 hours ago, Profaitchikenz Haiku said:

Without seeing any code snippets all I can suggest is that you check the value of the first parameter in the llSetLinkPrimitiveParams call, it's possible to get this wrong and use a value the will work on the link_set rather than just a particular child number.

For user-adjustment you will need to look at using dialogs to allow the user to change values in a specific direction, or else use touches to alter the values in a cyclical manner so they click away until they like what they see.

 

the first issue has solved itself..........perhaps it was my imagination or something because it's not happening anymore.

 

i have a vague idea about touch scripts, is that where coordinates are figured out that allows some code to tell where the cursor touched the prim and then there is a value associated with that coordinate? i was hoping to stay away from that. i was thinking since the script is already setting the values, maybe it could just run again when the button is pressed only it sets the previous values + 1. 

would this be possible or easier?

Edited by carley Greymoon
Link to comment
Share on other sites

If you are capable of making up a texture with several different areas to correspond to different options then llDetectedTouchUV combined with a test of which face on which prim in the linkset has been touched is the simplest approach, requiring no dialogs or listens. Have a look in the wiki at the touch functions available to you. By using a global variable to record the last block touched it is even possible to implement a "touch again to confirm" action.

Link to comment
Share on other sites

The most complicated part of it all is mapping the x-y pairs of coordinated that will be returned by the llDetectedTouch UV onto the coordinates of the texture. My suggestion is to write a simple script that chats out the X and Y values, then subdivide the texture up into a series of rectangles, each rectangle enclosing an area that corresponds to a button. Work through these rectangles learning the X-Y coordinates for the top-left and bottom right of each button.

In the actual script you then need a function to determine if the touchUV X-Y value lies between the top-left and bottom-right pairs that correspond to a button, if so, you have a button press, if not, check the next possible button.

 

The most efficient way to do this to allow for code re-use is to generate a strided list consisting of a pair of vectors and a button ID, either string or integer. (I think that storing two vectors is less memory-intensive than storing four floats, but I'll soon be corrected if I'm wrong :)

 

 

Link to comment
Share on other sites

and this is the "simplest" way huh.......smiles...............it's over my head, at least for now, i'll never be able to learn that in time to finish my project. but thank you for the pointers. i will eventually figure that out.

having said that, if anyone can help out on how i can step up and down the values with mouse clicks, i would be grateful. i saw a script that moved a prim attached to the screen incrementally with each click.......i tried to adapt that to increase the specular values incrementally but i've failed so far.

Edited by carley Greymoon
Link to comment
Share on other sites

touch_start(integer num)
{
    vector MyPos = llGetLocalPos();  // Fuind where the object is now
    if (MyPos.y > 1.0)    // Reset Y coordinate if you've already moved too far
    {
        MyPos.y = -0.05;   // So the next movement will place the object at  MyPos.y = 0.0
    }
    llSetPos( MyPos + (<0.0, 0.05, 0.0> * llGetLocalRot()));   // Move the object 0.05 units to the right
}

Since you are scripting a HUD, you should probably take a look at http://wiki.secondlife.com/wiki/Creating_HUDs

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

13 minutes ago, Rolig Loon said:

touch_start(integer num)
{
    vector MyPos = llGetLocalPos();  // Fuind where the object is now
    if (MyPos.y > 1.0)    // Reset Y coordinate if you've already moved too far
    {
        MyPos.y = -0.05;   // So the next movement will place the object at  MyPos.y = 0.0
    }
    llSetPos( MyPos + (<0.0, 0.05, 0.0> * llGetLocalRot()));   // Move the object 0.05 units to the right
}

Since you are scripting a HUD, you should probably take a look at http://wiki.secondlife.com/wiki/Creating_HUDs

thank you Rolig, but i only mentioned the move script the moves the hud incrementally to say that i tried to modify that code to make it increase or decrease specular values instead of positions.

isn't there a way to set a value like 51 and then run the script again it set it to 52 and so on until it reaches a preset limit and then cycles back again? it's exactly what the position script does.

 

 

Edited by carley Greymoon
Link to comment
Share on other sites

12 minutes ago, carley Greymoon said:

isn't there a way to set a value like 51 and then run the script again it set it to 52 and so on until it reaches a preset limit and then cycles back again? it's exactly what the position script does.

It doesn't make any difference what you are actually changing.  The logic is precisely the same.  Make a global integer counter, MyCounter = 51, then

touch_start(integer num)
{
    if (MyCounter > 65 )   //Reset MyCounter if it gets bigger than 65
    {
        MyCounter = 50;    // Start over at 50, which will become 51 in a second ...
    }
    ++MyCounter;    // Increment MyCounter by +1
    // Now do something important with MyCounter
}

    

Edited by Rolig Loon
typos, of course
Link to comment
Share on other sites

1 hour ago, Rolig Loon said:

It doesn't make any difference what you are actually changing.  The logic is precisely the same.  Make a global integer counter, MyCounter = 51, then


touch_start(integer num)
{
    if (MyCounter > 65 )   //Reset MyCounter if it gets bigger than 65
    {
        MyCounter = 50;    // Start over at 50, which will become 51 in a second ...
    }
    ++MyCounter;    // Increment MyCounter by +1
    // Now do something important with MyCounter
}

    

do you have any links i can read up on MyCounter? i can't find anything at the wiki or on the net period. i don't know how to fit this into my script.

Edited by carley Greymoon
Link to comment
Share on other sites

Read up?  Everything you need to know is right there in that little example.  The logic is the same as if you were incrementing numbers with a pencil and paper:

Step 1:  Pick a starting number

Step 2:  Add +1 to it.

Step 3: Do something with the new number if you really want to

Step 4: Add +1 to it again, and go back to Step 3

and so on.  Every time you add +1, just check to be sure that the new number isn't too big.  If it is, go back to Step 1 again.  That's all there is to it.  No magic.

Link to comment
Share on other sites

13 minutes ago, Rolig Loon said:

Read up?  Everything you need to know is right there in that little example.  The logic is the same as if you were incrementing numbers with a pencil and paper:

Step 1:  Pick a starting number

Step 2:  Add +1 to it.

Step 3: Do something with the new number if you really want to

Step 4: Add +1 to it again, and go back to Step 3

and so on.  Every time you add +1, just check to be sure that the new number isn't too big.  If it is, go back to Step 1 again.  That's all there is to it.  No magic.

i understand the logic, i just don;t know how to actually use the correct format(i don't know where or how "MyCounter" goes into my script) to make it work. i don't know how to make that snippet know what values to change...........if i see examples of how Mycounter actually looks like in a working script, i maybe could figure it out.

i'm not a scripter, i just cobble things together as i need them.

Edited by carley Greymoon
Link to comment
Share on other sites

If you are new to scripting, probably the best thing you can do for yourself is to spend a few hours with basic tutorials >>> http://wiki.secondlife.com/wiki/LSL_Tutorial .  Scripting is not really about syntax.  It's about logic.  To begin in any new language, you need to first get a feel for the basic flow of logic in it -- in this case, LSL's system of using events and states to define blocks in which specific segments of your task will take place, and the way it distinguishes between local variables and global ones.  Once you understand that, the rest is a matter of looking up the individual functions that you need to use to express the logic of your task.  All of the LSL functions are in the wiki >>>  http://wiki.secondlife.com/wiki/Category:LSL_Functions .  Once you have practiced for a while, you won't have to look up the more common functions any more.  Even when you become a seasoned scripter, you'll still need to check the wiki for functions that you only use occasionally. 

Edited by Rolig Loon
Link to comment
Share on other sites

It looks like this (cobbled together outside of SL so can't be sure it doesn't have syntax werrors)

 

// test of global integer for touch

integer myCounter;
key owner;

default
{
    state_entry()
    {
        owner = llGetOwner();
        myCounter = 0;
    }
    touch_start(integer touches)
    {
        if( myCounter < 10) myCounter += 1;
        else myCounter = 0;
        llOwnerSay("myCounter is " + (string) myCounter);

    }

}

beware the jabbertyperwocky :)

 

Rolig's answer is the best advice that can be given you, but, I too work much the way you say you do, I came, I saw, I cobbled...

 

Edited by Profaitchikenz Haiku
  • Like 1
Link to comment
Share on other sites

22 hours ago, Profaitchikenz Haiku said:

It looks like this (cobbled together outside of SL so can't be sure it doesn't have syntax werrors)

 


// test of global integer for touch

integer myCounter;
key owner;

default
{
    state_entry()
    {
        owner = llGetOwner();
        myCounter = 0;
    }
    touch_start(integer touches)
    {
        if( myCounter < 10) myCounter += 1;
        else myCounter = 0;
        llOwnerSay("myCounter is " + (string) myCounter);

    }

}

beware the jabbertyperwocky :)

 

Rolig's answer is the best advice that can be given you, but, I too work much the way you say you do, I came, I saw, I cobbled...

 

thank you very much Prof......your script helped me figure it out. i now have a increase/decrease specular script.:) and thank you Rolig for bringing up MyCounter, it started the path to a solution.

Link to comment
Share on other sites

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