Jump to content

w1zard

Resident
  • Posts

    37
  • Joined

  • Last visited

Posts posted by w1zard

  1. Hello SL'ers,

    When I set the name of a prim, to a string containing unicode characters, "™".ie, the prim name is successfully set, but these characters are replaced by "???" - Can anyone think of a way that I can strip unicode chars from a string to make it plain ascii, to prevent these awefull ?????????????????'s from appearing.

    Cheers, w1zard :-) 

  2. What's the best way to ensure a prim can move to a position before it goes there?

    I want a prim to be free to move through parcels where it is allowed to, but if its not allowed to cross over to a position inside a different parcel I want to know so that moving it there wont silently fail.

    Is there a better method than just checking to see if it's position changed after trying to move there, so that I can know ahead of time if its not going to be possible to reach that destination?

    Cheers, w1z

  3. Hi, I am really struggling with rotation functions/math :(

    This is where I need to get to, I am hoping someone can help point me in the right direction :matte-motes-wink:

    rotation.png

    The prim is currently facing a random direction. I know this direction by obtaining the rotation from llGetPos.

    I also know the point where I need the prim to turn around to.

    The first thing I need help figuring out from these two values, is if it is quicker to turn left, or right. Rotation direction A in the example above would be the quickest direction to turn.

    I have a hard time understanding the examples and documentation. on the wiki. I have had many mixed results for this and have realised how far I am out my depth here. 

    The second thing I need to do,  is turn the prim (via the shortest direction ie. left or right) to the target rotation, in intervals, of for example 1 degree.

    I have had problems here ensuring it does actually go the right direction, and also doesnt overshoot the target.

    I cannot use llTargetOmega and I must use rotate in intervals, because the prim is phantom the strength of the rotation is not applied.

    I am really hopefull someone is willing to take the time and help me understand the math involved here!

    Many thanks,
    w1zard 

  4. @NatM - I think we are all eager to see the screen shots that you have.

    If this is true that there is a hole, then it wouldnt take much for a clever hacker to exploit a SMB vul using metasploit 

    It would most likley have to be this specific vulnerability as it affected a wide range of windows os's, which is quite old though..

    Microsoft Security Bulletin MS08-067 – Critical

    Vulnerability in Server Service Could Allow Remote Code Execution (958644)

    see how its done: 

    

    personally I think they just have an invis avatar and took screen shots of you to sh1* you up lol :matte-motes-big-grin-squint:

  5. You can make a http request to a php script which can obtain the owner key & name via the http headers, make the php script create a session and output the session key to be parsed by the in world script.

    The script could then set the location of the shared media to the out of world php script containing the media player html, passing the session key obtained from the first php script via a get variable so that it knows which avatar is using the shared media. 

    This would bode well for loading favourites or other user specific variables.

    If you load the jquery javascript framework library within the html you can use its ajax get request to make a callback to the first php script which can record the users actions against their session.

    You would then either have the in world object act as a web server or receive email from the php script or otherwise periodically request for updates from the first script regarding the users actions, fastest option would be preferable of course.

    In world to out world communication is perfectly doable through shared media with php, mysql & ajax but I guess the question is, is it worth it?

    Your looking at a very technical solution .. Good Luck

  6. thats not the problem, I am only using 5 prims to test the script and the output is fairly small.

     

    Build 5 cubes (Into an X pattern), link them, drop the script in. 

    When the script is placed inside and it will give you the default position array.

    Edit the script with the lsl code that was output, save it, then resize the object and when you click it its supposed to go back to its original scale (the root position wont change).

     

    The problem is that it doesnt change the positions, and the scale of each prim is set to the minimum value.

     

    I think that I might be providing the wrong primID's to setprimitiveparams and also get primitiveparams.


    Maybe someone could tell me how I can get all ID's for all the prims in the linked object. With that I could ensure that the right ID's are being used.

     

    When the script starts it should say something like:

     

    My current size is:
    list defaultPrimParams = ["0|<0.00000, 0.00000, 0.00000>|<183.26640, 236.83130, 29.26685>","1|<0.50000, 0.50000, 0.50000>|<0.00000, 0.00000, 0.00000>","2|<0.50000, 0.50000, 0.50000>|<0.00000, 0.51840, 0.48844>","3|<0.50000, 0.50000, 0.50000>|<0.00000, 0.51840, -0.51371>","4|<0.50000, 0.50000, 0.50000>|<0.00000, -0.50829, -0.51371>","5|<0.50000, 0.50000, 0.50000>|<0.00000, -0.51425, 0.52073>"];

     

    Which is what you can use to update the default param array at the top of the script

     

    PrimID | Size | Local Position

     

    As you may realise the values look odd, I think iv hit the nail on the head with the problem because  LINK_ROOT = 1;

     

    I can get the amount of prims in the linked object, but where do their ID's start? at 2?

     

    Would really appreachiate it if anyone finds the time to drop it into a basic object with more than 1 prim such as the one described above, only takes 10 seconds.

  7. Ok here is the refactored code. What am I doing wrong here?

     

    //Master Resize Scriptlist defaultPrimParams = [];default{    state_entry()    {        llOwnerSay("My current params are is: ");        //for each prim        integer primCount = llGetNumberOfPrims();        integer currentPrim = llGetLinkNumber();        integer p = 0;        string output="list defaultPrimParams = [";                for(;p<primCount+1;p++)        {            output+="\"";                        output+=(string)p+"|"; //primID            output+=(string)llList2Vector(llGetLinkPrimitiveParams(p,[PRIM_SIZE]),0)+"|"; //Scale            output+=(string)(llGetPos()-llList2Vector(llGetLinkPrimitiveParams(p,[PRIM_POSITION]),0));//Position Distance from currentPrim                        output+="\"";            if(p!=primCount)                output+=",";        }        output+="];";        llOwnerSay(output);    }    touch_start(integer total_number)    {        //Resets to default size        integer prims = llGetListLength(defaultPrimParams);        integer p = 0;        for(;p<prims+1;p++)        {            string paramsString = llList2String(defaultPrimParams,p);            list paramsList = llParseString2List(paramsString,["|"],[]);            integer primID = llList2Integer(paramsList,0);            vector primScale = llList2Vector(paramsList,1);            vector primPositionDistance = llList2Vector(paramsList,2);                        llSetLinkPrimitiveParamsFast(primID,[PRIM_SIZE,primScale]);            llSetLinkPrimitiveParamsFast(primID,[PRIM_POSITION,llGetPos()+primPositionDistance]);        }    }}

     

    + 1 Kudos to the Guru that knows their $%*7

  8. Is there a more precise way to reset the scale of a linked object than this?

    I have this script inside every prim in the linked object.

     

    default {
        link_message(integer sender_num, integer num, string str, key id) {
            float scale; // size factor
            list    primparams;
            
            scale = (float)str;
            
            primparams = [];
            
            primparams += [PRIM_SIZE, llGetScale() * scale]; // resize
            
            if (llGetLinkNumber() > 1) { // only move if we're not the root object
                primparams += [PRIM_POSITION, llGetLocalPos() * scale]; // reposition
            }
            
            llSetPrimitiveParams(primparams);
        }
    }

     and this is the master script which will try to reset the scale

     

    // rescales the linked set by the specified factor. factor > 1 makes it larger, < 1 smaller
    // example: "/9 2.5"
    Resize(float scale) {
        integer num_prims = llGetNumberOfPrims();
        integer i;
    
        for (i = 1; i <= num_prims; i++) { // first prim in a linked set is 1
            llMessageLinked(i, 0, (string)scale, NULL_KEY);
        }
        
    }
    
    integer a = 0;
    
    vector DEFAULT_MAINPRIM_SCALE = <0.30032,0.30032,0.83893>;
    
    reset2DefaultScale()
    {
        vector currentScale = llGetScale();
        if(currentScale!=DEFAULT_MAINPRIM_SCALE) //is not the original size as first recorded
        {
            llOwnerSay("Current Scale Differs from default by the following:");
            //get percentage difference between all 3 values and average them for the scale which should be the original scale
            float xScale = (1.0/DEFAULT_MAINPRIM_SCALE.x) * currentScale.x;
            float yScale = (1.0/DEFAULT_MAINPRIM_SCALE.y) * currentScale.y;
            float zScale = (1.0/DEFAULT_MAINPRIM_SCALE.z) * currentScale.z;
            float averageScale = (xScale+yScale+zScale)/3;
            llOwnerSay("<"+(string)xScale+","+(string)yScale+","+(string)zScale+"> average scale of: "+(string)averageScale);
            //Work out the original scale difference
            float difference = 0.0;
            if(averageScale>1.01)
            {
                difference = 1.0/averageScale;
                Resize(difference);
                llOwnerSay("New Calculation: 1.0/"+(string)(averageScale));
            }
            else if(averageScale<0.99)
            {
                difference = averageScale*10.0;
                Resize(difference);
                llOwnerSay("New Calculation: 1.0*"+(string)(averageScale));
            }
            llOwnerSay("Difference to reach original scale: "+(string)difference);
        }
        else
            llOwnerSay("Current Scale matches Default SCale");
    }
    
    default {
        state_entry() {
            reset2DefaultScale();
            llListen(9, "", llGetOwner(), "");
            //llSetTimerEvent(5.0);
            
            float pauseInSeconds = 2.0;
            
            while(1==1)
            {
            
                llSleep(pauseInSeconds);
                Resize(1.25);                       // L
                
                llSleep(pauseInSeconds);
                reset2DefaultScale();
                Resize(1.5);                        // XL
                
                llSleep(pauseInSeconds);
                reset2DefaultScale();
                Resize(1.25);                       // L
                
                llSleep(pauseInSeconds);
                reset2DefaultScale();               // M
        
                llSleep(pauseInSeconds);
                reset2DefaultScale();
                Resize(0.75);                       // S
                
                llSleep(pauseInSeconds);
                reset2DefaultScale();
                Resize(0.5);                        // XS
                
                llSleep(pauseInSeconds);
                reset2DefaultScale();
                Resize(0.75);                       // S
    
                llSleep(pauseInSeconds);
                reset2DefaultScale();               // M
                            
            }
        }
        
        listen(integer channel, string name, key id, string message) {
            float scale;
            
            scale = (float)message;
            if ( scale == 0.0 ) return; // we don't resize by factor 0.0
    
            llSay(0, "Resizing by factor " + (string)scale);
    
            Resize(scale);
            llSay(0,(string)llGetScale());
        }
        
        timer()
        {
            if(a==0)
            {
                a=1;
                Resize(0.5);
            }
            else if(a==1)
            {
                a=0;
                Resize(2.0);
            }
        }
    }

     The problem I have is, I cannot get it to return to the exact original size, which means over time, its possible that the size changes (larger or smaller) this is because I am having problems calculating the resize float pecisley i.e 1.0 = original, 2.0 = double size, 0.5 = half, 

    Firstly there is a problem resetting the object to its original size when it's scale is less than the original scale (DEFAULT_MAINPRIM_SCALE) so I guess ignore that problem as its just something I need to fix, unless anyone can shed some light on that too!

    It works fine if you make the object bigger, then reset the script and it will go back to the original size.

  9. So this is what I am using to load the texture.
     

        link_message(integer sender_num, integer num, string list_argument, key id)     {        list re_list = llParseString2List(list_argument, ["|"], [""]);    // Typecast string back to a list        //llSetTexture(llList2String(re_list,0),ALL_SIDES);        llSetLinkPrimitiveParamsFast(LINK_THIS,[ PRIM_TEXTURE, ALL_SIDES ,(key)llList2String(re_list,0),<1,1,1>,<0,0,0>,0.0]);    } 

     The texture that is being provided via the message, is the name of the texture within the inventory.
    I want to try this with the texture key because all the other prims dont have the textures in their inventory, but each have a copy of this script instead.

    But my main script which sets the texture in the first place, then does a link message to all other prims, only seems to return the inventory name for the texture, I'm still unclear as to weather you can even get the texture uuid anymore? 

  10. So if I hit 100% memory usage, and even though I clear the list using = [];  ,I will get memory usage errors when I start adding to the list, because the old data is still being held in memory by the script instance? or do you mean that just the llGetFreeMemory counter doesnt go back up again? Please say its the later.

×
×
  • Create New...