Change font size
It is currently Fri Aug 17, 2018 7:45 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 2   [ 11 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Resizer Script?
PostPosted: Tue Apr 10, 2012 1:28 am 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
I did a quick search but didn't see this.

I am looking for a resizer script I can put in objects and resize them to fit my avatar then delete.

Thanks for any help.


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 2:22 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 384
Location: Australia
Interesting, but I dont know if there is such a thing.
I have been thinking about how such a script could work and there are just too many variables,
I imagine one could make an object and then build in a resize script to suit that object, but you would need a different script for each different object.
Unless you built a generic script which could incrementally increase or decrease the size of any object until the desired size was achieved, there would need to be some controlling mechanism involved like a hud switch or chat listener. like "one size bigger" and "two sizes smaller" etc.
But thats a lot of work when a tweak of the stretch box does it in 3 seconds.
So in short. it could be done, but is it really worth it? What exactly did you want to resize?


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 2:49 am 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
I am trying to resize a linkset. Like my belt, hair , shoes, etc.

Lots of things in sl have resizer menus in them. I also have a script for inworldz I can put in objects to resize them.

Some of these are open source too, but I am having problems with them in osgrid. I put them in the object ok, but when the resize menu comes up and I choose increase .001 or .005 the whole object becomes giant-sized. These are lsl scripts.


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 5:50 am 
OSG Elite
User avatar

Joined: Sat Jun 14, 2008 12:28 am
Posts: 384
Location: Australia
OK it would seem that these would be generic type scripts that resize incrementally, please pardon my ignorance of these scripts, they would be have to depend on the root prim.
Maybe we could look at one of the scripts you have to see what is different in Opensim, there is not much difference between lsl in SL and lsl in OS.
Please post the script and we will have a go.
Cam


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 9:09 am 
OSG Elite

Joined: Wed Aug 05, 2009 1:59 am
Posts: 417
Here are some:
{L_CODE}:
// resize script by Dora Gustafson, Studio Dora 2010
// Free for anybody to read, copy, modify, compile, use, rip apart, trample on and flush
// The script is open source and free. As so it is not supported in any way
// NOTE: only for SL server v1.38 and later
// Place in prim or linkset in order to resize
// Must run in root prim
// resizer v1.0 No check or precautions against dimensions out of limits
// resizer v1.1 Test if new dimensions are within limts [0.01;10.0]m If not, resize is cancelled
// resizer v1.2 Added kill script button
// resizer v1.3 Added llListenRemove() for low lag
// resizer v1.4 Added Current relative size display
// resizer v1.5 Added rounding for size display
// resizer v1.6 Reversible resize increments
// resizer v1.7 changed to accept 64m max prim size, limits [0.01;64.0]m

integer dialogChanal;
list USER_MENU = [ "Size@Rez", "Size@Buy", "Kill Script", "-1.96..%", "-4.76..%", "-9.09..%", "+2%", "+5%", "+10%" ];
string uDialogP = "•Resize\n•Set to Size at Rez\n•Set to Size at Buy";

float fabsizeX;
float rezsizeX;
vector rs;
float listenTimeout=1800.0; // seconds
integer listenHandle;

open_dialog( vector vr )
{
    string s="Size is "+(string)(llRound(100.0*vr.x/fabsizeX))+" %\n";
    llDialog( llGetOwner(), s+uDialogP, USER_MENU, dialogChanal);
    llSetTimerEvent(listenTimeout);
}

integer dimTest( vector vr )
{
    return !( vr.x<0.01 || vr.y<0.01 || vr.z<0.01 || vr.x>64.0 || vr.y>64.0 || vr.z>64.0 );
}

primloop( float scal )
{
    integer primindx;
    integer validDim=TRUE;
    list primP;

    if (llGetNumberOfPrims()<2) validDim = validDim && dimTest( scal*llGetScale());
    else
    for ( primindx = 1; primindx <= llGetNumberOfPrims(); primindx++ )
    {
        primP = llGetLinkPrimitiveParams( primindx, [PRIM_SIZE]);
        validDim = validDim && dimTest( scal*llList2Vector( primP, 0 ));
    }

    if ( validDim )
    {
        if (llGetNumberOfPrims()<2) llSetScale( scal*llGetScale()); // not linked prim
        else
        for ( primindx = 1; primindx <= llGetNumberOfPrims(); primindx++ )
        {
            primP = llGetLinkPrimitiveParams( primindx, [PRIM_SIZE, PRIM_POSITION]);
            vector primScale = scal*llList2Vector( primP, 0 );
            vector primPos = scal*(llList2Vector( primP, 1 )-llGetPos());
            if ( primindx == 1 ) llSetLinkPrimitiveParamsFast( primindx, [PRIM_SIZE, primScale]);
            else llSetLinkPrimitiveParamsFast( primindx, [PRIM_SIZE, primScale, PRIM_POSITION, primPos/llGetRootRotation()]);
        }
    }
    else llOwnerSay("No resize! Out of limit sizes are not accepted");
}

default
{
    state_entry()
    {
        rs = llGetScale();
        fabsizeX = rs.x;
        rezsizeX = fabsizeX;
        llOwnerSay("Size at buy is set to Current size");
    }
    on_rez( integer p)
    {
        rs = llGetScale();
        rezsizeX = rs.x;
    }
    touch_end(integer n)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            dialogChanal = (integer)llFrand( 8388608.0 ) + 0x80000000;
            llListenRemove(listenHandle);
            listenHandle = llListen( dialogChanal, "", llGetOwner(), "");
            open_dialog(llGetScale());
        }
    }
    listen(integer cannel, string name, key id, string message)
    {
        if ( message == "Kill Script" ) llRemoveInventory( llGetScriptName());
        else
        {
            rs = llGetScale();
            if ( message == "+2%" ) primloop( 1.02);
            else if ( message == "+5%" ) primloop( 1.05);
            else if ( message == "+10%" ) primloop( 1.1);
            else if ( message == "-1.96..%" ) primloop( 1.0/1.02);
            else if ( message == "-4.76..%" ) primloop( 1.0/1.05);
            else if ( message == "-9.09..%" ) primloop( 1.0/1.1);
            else if ( message == "Size@Rez" ) primloop( rezsizeX/rs.x);
            else if ( message == "Size@Buy" ) primloop( fabsizeX/rs.x);
            open_dialog(llGetScale());
        }
    }
    timer()
    {
        llListenRemove(listenHandle);
        llSetTimerEvent(0.0);
    }
}


Tested, and it seems to work.

And another one:
{L_CODE}:
///////////////////////////////////////////////////////////////////////////////
// Resizer
// by Emma Nowhere
//
// Last modified: 6/1/2010
//
// How to use with menu:
// 1. Install this script in the root prim of a linked set of prims (aka "linkset")
// 2. Type /1resizer to show the menu
// 3. Hit the appropriate buttons to scale up or down the linkset
// 4. Hit the "Finish" button to remove the script and finalize prim sizes
//
// Optionally, enter the percentage directly via chat by typing /1resizer x%
// where x is the percentage of the original size you want to resize to.
//
// If using in a product with no other scripts, change START_ON_TOUCH below to TRUE
// so user can initiate resizing by just touching the object.

integer START_ON_TOUCH = FALSE;

// Display status messages in chat window (to owner only)

integer SAY_STATUS = TRUE;

// Channel to listen for commands on

integer CHAT_CHANNEL = 1;

// SL constraints

float MIN_SIZE = .01;
float MAX_SIZE = 10;
float MAX_DISTANCE = 10;
float MIN_SCALE = .1;

integer MENU_CHANNEL = -1001;

list backupPrims = [];
integer backupStored = FALSE;

float scale = 1.0;

init_menu_channel() {
    MENU_CHANNEL = ((integer)("0x" + llGetSubString((string)llGetKey(), -8, -1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
}

say_status(string msg) {
    if (SAY_STATUS) llOwnerSay(msg);
}

backup() {
    if (!backupStored) {
        say_status("Backing up prim positions and sizes.");
        backupPrims = [];
        integer p = llGetNumberOfPrims();
        integer i = 0;
        vector root_pos = <0, 0, 0>;
        for (i = 1; i <= p; i++)
        {
            list params = llGetLinkPrimitiveParams(i, [PRIM_POSITION, PRIM_SIZE]);
            vector pos = llList2Vector(params, 0);
            vector size = llList2Vector(params, 1);
            if (i == 1)
            {
                root_pos = pos;
            }
            else {
                pos = pos - root_pos;
            }
            backupPrims = backupPrims + pos + size;
        }
        backupStored = TRUE;
        say_status("Prim positions and sizes backed up.");
    }
}

float min(float a, float b) {
    if (a < b) return a;
    return b;
}

float max(float a, float b) {
    if (a > b) return a;
    return b;
}

float constrainMinMax(float value, float min, float max) {
    value = max(value, min);
    value = min(value, max);
    return value;
}

vector constrainSize(vector size) {
    size.x = constrainMinMax(size.x, MIN_SIZE, MAX_SIZE);
    size.y = constrainMinMax(size.y, MIN_SIZE, MAX_SIZE);
    size.z = constrainMinMax(size.z, MIN_SIZE, MAX_SIZE);
    return size;
}

vector constrainDistance(vector delta) {
    delta.x = min(delta.x, MAX_DISTANCE);
    delta.y = min(delta.y, MAX_DISTANCE);
    delta.z = min(delta.z, MAX_DISTANCE);
    return delta;
}

process(integer restore) {
    backup();

    if (restore) {
        say_status("Restoring previously backed up positions and sizes.");
        scale = 1;
    }
    else {
        say_status("Resizing prims to " + (string)llRound(scale * 100) + "% of original size.");
    }

    integer p = llGetNumberOfPrims();
    integer i = 0;
    for (i = 1; i <= p; i++)
    {
        vector pos = llList2Vector(backupPrims, (i - 1) * 2);
        vector size = llList2Vector(backupPrims, ((i - 1) * 2) + 1);

        if (!restore) size = constrainSize(size * scale);

        if (i == 1) {
            llSetLinkPrimitiveParamsFast(i, [PRIM_SIZE, size]);
        }
        else {
            if (!restore) pos = constrainDistance(pos * scale);
            llSetLinkPrimitiveParamsFast(i, [PRIM_POSITION, pos, PRIM_SIZE, size]);
        }
    }

    if (restore) {
        say_status("Previously backed up prim positions and sizes restored.");
    }
    else {
        say_status("Prims resized.");
    }
}

finish() {
    say_status("Deleting Resizer script.");
    llRemoveInventory(llGetScriptName());
}

menu() {
    llDialog(llGetOwner(),
    "Resizer\n\nMake a backup of your object first.\n\nPlease choose an option:\n",
    ["Revert", "-", "Finish", "-1%", "-5%", "-10%", "+1%", "+5%", "+10%"], MENU_CHANNEL);
}

handle_message(integer channel, string name, key id, string message)
{
    if (channel == CHAT_CHANNEL) {
        if (message == "resizer") {
            menu();
        }
        else if (llSubStringIndex(message, "resizer") == 0) { 
            list params = llParseString2List(message, [" "], [] );
            if (llGetListLength(params) == 2) {
                string scale_param = llList2String(params, 1);
                if (llGetSubString(scale_param, -1, -1) == "%") {
                    scale = (((float)llGetSubString(scale_param, 0, -2)) / 100);
                    scale = max(scale, MIN_SCALE);
                    process(FALSE);
                }
            }
        }
    }
    else if (channel == MENU_CHANNEL) {
        if (message == "Revert") {
            process(TRUE);
            menu();
        }
        else if (message == "Finish") {       
            finish();                   
        }
        else if (llGetSubString(message, -1, -1) == "%") {
            scale = scale + (((float)llGetSubString(message, 0, -2)) / 100);
            scale = max(scale, MIN_SCALE);
            process(FALSE);
            menu();
        }
    }

}

default
{
    state_entry()
    {
        if (START_ON_TOUCH) {
            // we only want a touch_start handler if we're going to use it
            // so change state rather than just testing inside touch_start
            // for START_ON_TOUCH to be true.
            state start_on_touch;
        }
        else {
            llListen(CHAT_CHANNEL, "", llGetOwner(), "");

            init_menu_channel();
            llListen(MENU_CHANNEL, "", llGetOwner(), "");

            llOwnerSay("Resizer Ready");
            llOwnerSay("Type /" + (string)CHAT_CHANNEL + "resizer for menu.");
        }
    }

    on_rez(integer start_param) {
        llOwnerSay("Resizer Installed");
        llOwnerSay("Type /" + (string)CHAT_CHANNEL + "resizer for menu.");
    }   

    listen(integer channel, string name, key id, string message)
    {
        handle_message(channel, name, id, message);
    }
}

state start_on_touch
{
    state_entry()
    {
        llListen(CHAT_CHANNEL, "", llGetOwner(), "");

        init_menu_channel();
        llListen(MENU_CHANNEL, "", llGetOwner(), "");

        llOwnerSay("Resizer Ready");
        llOwnerSay("Touch for resizer menu.");
    }

    on_rez(integer start_param) {
        llOwnerSay("Resizer Installed");
        llOwnerSay("Touch for resizer menu.");
    }   

    listen(integer channel, string name, key id, string message)
    {
        handle_message(channel, name, id, message);
    }

    touch_start(integer num_detected)
    {
        menu();
    }

}

This one gives an error on line 87 and 88. (Expression denotes a variable', where a 'method group' was expected.)

And another one:
{L_CODE}:
// Linkset Resizer with Menu
// version 1.00 (25.04.2010)
// by: Brilliant Scientist
// --
// This script resizes all prims in a linkset, the process is controlled via a menu.
// The script works on arbitrary linksets and requires no configuration.
// The number of prims of the linkset it can process is limited only by the script's memory.
// The script is based on "Linkset Resizer" script by Maestro Linden.
// http://wiki.secondlife.com/wiki/Linkset_resizer
// This script still doesn't check prim linkability rules, which are described in:
// http://wiki.secondlife.com/wiki/Linkability_Rules
// Special thanks to:
// Ann Otoole

float MIN_DIMENSION=0.01; // the minimum scale of a prim allowed, in any dimension
float MAX_DIMENSION=10.0; // the maximum scale of a prim allowed, in any dimension

float max_scale;
float min_scale;

float   cur_scale = 1.0;
integer handle;
integer menuChan;

float min_original_scale=10.0; // minimum x/y/z component of the scales in the linkset
float max_original_scale=0.0; // minimum x/y/z component of the scales in the linkset

list link_scales = [];
list link_positions = [];

makeMenu()
{
   llListenRemove(handle);
   menuChan = 50000 + (integer)llFrand(50000.00);
   handle = llListen(menuChan,"",llGetOwner(),"");

   //the button values can be changed i.e. you can set a value like "-1.00" or "+2.00"
   //and it will work without changing anything else in the script
   llDialog(llGetOwner(),"Max scale: "+(string)max_scale+"\nMin scale: "+(string)min_scale+"\n \nCurrent scale: "+
        (string)cur_scale,["-0.05","-0.10","-0.25","+0.05","+0.10","+0.25","MIN SIZE","RESTORE","MAX SIZE","DELETE..."],menuChan);
}

integer scanLinkset()
{
   integer link_qty = llGetNumberOfPrims();
   integer link_idx;
   vector link_pos;
   vector link_scale;

   //script made specifically for linksets, not for single prims
   if (link_qty > 1)
   {
      //link numbering in linksets starts with 1
      for (link_idx=1; link_idx <= link_qty; ++link_idx)
      {
         link_pos=llList2Vector(llGetLinkPrimitiveParams(link_idx, [PRIM_POS_LOCAL]),0);
         link_scale=llList2Vector(llGetLinkPrimitiveParams(link_idx,[PRIM_SIZE]),0);

         // determine the minimum and maximum prim scales in the linkset,
         // so that rescaling doesn't fail due to prim scale limitations
         if(link_scale.x<min_original_scale) min_original_scale=link_scale.x;
         else if(link_scale.x>max_original_scale) max_original_scale=link_scale.x;
         if(link_scale.y<min_original_scale) min_original_scale=link_scale.y;
         else if(link_scale.y>max_original_scale) max_original_scale=link_scale.y;
         if(link_scale.z<min_original_scale) min_original_scale=link_scale.z;
         else if(link_scale.z>max_original_scale) max_original_scale=link_scale.z;

         link_scales    += [link_scale];
         link_positions += [link_pos];
      }
   }
   else
   {
      llOwnerSay("error: this script doesn't work for non-linked objects");
      return FALSE;
   }

   max_scale = MAX_DIMENSION/max_original_scale;
   min_scale = MIN_DIMENSION/min_original_scale;

   return TRUE;
}

resizeObject(float scale)
{
   integer link_qty = llGetNumberOfPrims();
   integer link_idx;
   vector new_size;
   vector new_pos;

   if (link_qty > 1)
   {
      //link numbering in linksets starts with 1
      for (link_idx=1; link_idx <= link_qty; link_idx++)
      {
         new_size   = scale * llList2Vector(link_scales, link_idx-1);

         if (link_idx == 1)
         {
            //because we don't really want to move the root prim as it moves the whole object
            llSetLinkPrimitiveParamsFast(link_idx, [PRIM_SIZE, new_size]);
         }
         else
         {
            new_pos    = scale * llList2Vector(link_positions, link_idx-1);
            llSetLinkPrimitiveParamsFast(link_idx, [PRIM_SIZE, new_size, PRIM_POSITION, new_pos]);
         }
      }
   }
}

default
{
   state_entry()
   {
      if (scanLinkset())
      {
         //llOwnerSay("resizer script ready");
      }
      else
      {
         llRemoveInventory(llGetScriptName());
      }
   }

   touch_start(integer total)
   {
      if (llDetectedKey(0) == llGetOwner()) makeMenu();
   }

   listen(integer channel, string name, key id, string msg)
   {
      //you can never be too secure
      if (id == llGetOwner())
      {
         if (msg == "RESTORE")
         {
            cur_scale = 1.0;
         }
         else if (msg == "MIN SIZE")
         {
            cur_scale = min_scale;
         }
         else if (msg == "MAX SIZE")
         {
            cur_scale = max_scale;
         }
         else if (msg == "DELETE...")
         {               
                           llDialog(llGetOwner(),"Are you sure you want to delete the resizer script?",
                           ["DELETE","CANCEL"],menuChan);
                           return;            
         }            
         else if (msg == "DELETE")
         {               
                           llOwnerSay("deleting resizer script...");
            llRemoveInventory(llGetScriptName());            
         }         
         else
         {
             cur_scale += (float)msg;
         }

         //check that the scale doesn't go beyond the bounds
         if (cur_scale > max_scale) { cur_scale = max_scale; }
         if (cur_scale < min_scale) { cur_scale = min_scale; }

         resizeObject(cur_scale);
      }
   }
}


I just tested it in-world, it compiles ok, but when used, the whole linkset gets messed up. (see pic)
{L_IMAGE}
(Yes, the pile of prims on the left, is a resized version of the carriage on the right, lol)

And the last resizer script can be found here: http://community.secondlife.com/t5/LSL- ... d-p/711557
(I'm lazy today, too much scripts to copy from that post :D )

Hope this helps,

Odd


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 12:38 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
Oddball Otoole {L_WROTE}:
Here are some:
{L_CODE}:
// resize script by Dora Gustafson, Studio Dora 2010
// Free for anybody to read, copy, modify, compile, use, rip apart, trample on and flush
// The script is open source and free. As so it is not supported in any way
// NOTE: only for SL server v1.38 and later
// Place in prim or linkset in order to resize
// Must run in root prim
// resizer v1.0 No check or precautions against dimensions out of limits
// resizer v1.1 Test if new dimensions are within limts [0.01;10.0]m If not, resize is cancelled
// resizer v1.2 Added kill script button
// resizer v1.3 Added llListenRemove() for low lag
// resizer v1.4 Added Current relative size display
// resizer v1.5 Added rounding for size display
// resizer v1.6 Reversible resize increments
// resizer v1.7 changed to accept 64m max prim size, limits [0.01;64.0]m

integer dialogChanal;
list USER_MENU = [ "Size@Rez", "Size@Buy", "Kill Script", "-1.96..%", "-4.76..%", "-9.09..%", "+2%", "+5%", "+10%" ];
string uDialogP = "•Resize\n•Set to Size at Rez\n•Set to Size at Buy";

float fabsizeX;
float rezsizeX;
vector rs;
float listenTimeout=1800.0; // seconds
integer listenHandle;

open_dialog( vector vr )
{
    string s="Size is "+(string)(llRound(100.0*vr.x/fabsizeX))+" %\n";
    llDialog( llGetOwner(), s+uDialogP, USER_MENU, dialogChanal);
    llSetTimerEvent(listenTimeout);
}

integer dimTest( vector vr )
{
    return !( vr.x<0.01 || vr.y<0.01 || vr.z<0.01 || vr.x>64.0 || vr.y>64.0 || vr.z>64.0 );
}

primloop( float scal )
{
    integer primindx;
    integer validDim=TRUE;
    list primP;

    if (llGetNumberOfPrims()<2) validDim = validDim && dimTest( scal*llGetScale());
    else
    for ( primindx = 1; primindx <= llGetNumberOfPrims(); primindx++ )
    {
        primP = llGetLinkPrimitiveParams( primindx, [PRIM_SIZE]);
        validDim = validDim && dimTest( scal*llList2Vector( primP, 0 ));
    }

    if ( validDim )
    {
        if (llGetNumberOfPrims()<2) llSetScale( scal*llGetScale()); // not linked prim
        else
        for ( primindx = 1; primindx <= llGetNumberOfPrims(); primindx++ )
        {
            primP = llGetLinkPrimitiveParams( primindx, [PRIM_SIZE, PRIM_POSITION]);
            vector primScale = scal*llList2Vector( primP, 0 );
            vector primPos = scal*(llList2Vector( primP, 1 )-llGetPos());
            if ( primindx == 1 ) llSetLinkPrimitiveParamsFast( primindx, [PRIM_SIZE, primScale]);
            else llSetLinkPrimitiveParamsFast( primindx, [PRIM_SIZE, primScale, PRIM_POSITION, primPos/llGetRootRotation()]);
        }
    }
    else llOwnerSay("No resize! Out of limit sizes are not accepted");
}

default
{
    state_entry()
    {
        rs = llGetScale();
        fabsizeX = rs.x;
        rezsizeX = fabsizeX;
        llOwnerSay("Size at buy is set to Current size");
    }
    on_rez( integer p)
    {
        rs = llGetScale();
        rezsizeX = rs.x;
    }
    touch_end(integer n)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            dialogChanal = (integer)llFrand( 8388608.0 ) + 0x80000000;
            llListenRemove(listenHandle);
            listenHandle = llListen( dialogChanal, "", llGetOwner(), "");
            open_dialog(llGetScale());
        }
    }
    listen(integer cannel, string name, key id, string message)
    {
        if ( message == "Kill Script" ) llRemoveInventory( llGetScriptName());
        else
        {
            rs = llGetScale();
            if ( message == "+2%" ) primloop( 1.02);
            else if ( message == "+5%" ) primloop( 1.05);
            else if ( message == "+10%" ) primloop( 1.1);
            else if ( message == "-1.96..%" ) primloop( 1.0/1.02);
            else if ( message == "-4.76..%" ) primloop( 1.0/1.05);
            else if ( message == "-9.09..%" ) primloop( 1.0/1.1);
            else if ( message == "Size@Rez" ) primloop( rezsizeX/rs.x);
            else if ( message == "Size@Buy" ) primloop( fabsizeX/rs.x);
            open_dialog(llGetScale());
        }
    }
    timer()
    {
        llListenRemove(listenHandle);
        llSetTimerEvent(0.0);
    }
}


Tested, and it seems to work.

<snip>

Odd

Thanks for the help. Well I put that in a new script and placed in the root prim, but it won't activate when I left-click the object. (the pointer doesn't change shape to the hand). I can open the script when I pull up the object contents but at the bottom where there are two check boxes: running and mono, they are both checked but greyed out.

I used the script below and it works for my shoes (4-prims linkset) but not on the belt (20-prims linkset). When used with the belt, it makes the minimum size giant and won't go any smaller. The shoes seem to resize fine. Everything else about the objects looks similar on the property pages. It is weird, I think I have to learn a little about scripting to figure this out lol.

I'm thinking it is something involving this part like it checks that it is not below the minimum scale and for some reason this object's link_scale is confusing the script and it thinks it has to restore to a min_original_scale that is actually quite large for the object. Dunno, that was just my first thought I really haven't looked at it too deep.
{L_CODE}:
if(link_scale.x<min_original_scale) min_original_scale=link_scale.x;
else if(link_scale.x>max_original_scale) max_original_scale=link_scale.x;
if(link_scale.y<min_original_scale) min_original_scale=link_scale.y;
else if(link_scale.y>max_original_scale) max_original_scale=link_scale.y;
if(link_scale.z<min_original_scale) min_original_scale=link_scale.z;
else if(link_scale.z>max_original_scale) max_original_scale=link_scale.z;


{L_CODE}:
// Linkset Resizer with Menu
// version 1.00 (25.04.2010)
// by: Brilliant Scientist
// --
// This script resizes all prims in a linkset, the process is controlled via a menu.
// The script works on arbitrary linksets and requires no configuration.
// The number of prims of the linkset it can process is limited only by the script's memory.
// The script is based on "Linkset Resizer" script by Maestro Linden.
// http://wiki.secondlife.com/wiki/Linkset_resizer
// This script still doesn't check prim linkability rules, which are described in:
// http://wiki.secondlife.com/wiki/Linkability_Rules
// Special thanks to:
// Ann Otoole

float MIN_DIMENSION=0.01; // the minimum scale of a prim allowed, in any dimension
float MAX_DIMENSION=64.0; // the maximum scale of a prim allowed, in any dimension

float max_scale;
float min_scale;

float   cur_scale = 1.0;
integer handle;
integer menuChan;

float min_original_scale=10.0; // minimum x/y/z component of the scales in the linkset
float max_original_scale=0.0; // minimum x/y/z component of the scales in the linkset

list link_scales = [];
list link_positions = [];

makeMenu()
{
    llListenRemove(handle);
    menuChan = 50000 + (integer)llFrand(50000.00);
    handle = llListen(menuChan,"",llGetOwner(),"");

    //the button values can be changed i.e. you can set a value like "-1.00" or "+2.00"
    //and it will work without changing anything else in the script
    llDialog(llGetOwner(),"Max scale: "+(string)max_scale+"\nMin scale: "+(string)min_scale+"\n \nCurrent scale: "+
        (string)cur_scale,["-0.01","-0.05","-0.10","+0.01","+0.05","+0.10","MIN SIZE","RESTORE","MAX SIZE","DELETE..."],menuChan);
}

integer scanLinkset()
{
    integer link_qty = llGetNumberOfPrims();
    integer link_idx;
    vector link_pos;
    vector link_scale;

    //script made specifically for linksets, not for single prims
    if (link_qty > 1)
    {
        //link numbering in linksets starts with 1
        for (link_idx=1; link_idx <= link_qty; link_idx++)
        {
            link_pos=llList2Vector(llGetLinkPrimitiveParams(link_idx,[PRIM_POSITION]),0);
            link_scale=llList2Vector(llGetLinkPrimitiveParams(link_idx,[PRIM_SIZE]),0);

            // determine the minimum and maximum prim scales in the linkset,
            // so that rescaling doesn't fail due to prim scale limitations
            if(link_scale.x<min_original_scale) min_original_scale=link_scale.x;
            else if(link_scale.x>max_original_scale) max_original_scale=link_scale.x;
            if(link_scale.y<min_original_scale) min_original_scale=link_scale.y;
            else if(link_scale.y>max_original_scale) max_original_scale=link_scale.y;
            if(link_scale.z<min_original_scale) min_original_scale=link_scale.z;
            else if(link_scale.z>max_original_scale) max_original_scale=link_scale.z;

            link_scales    += [link_scale];
            link_positions += [(link_pos-llGetRootPosition())/llGetRootRotation()];
        }
    }
    else
    {
        llOwnerSay("error: this script doesn't work for non-linked objects");
        return FALSE;
    }

    max_scale = MAX_DIMENSION/max_original_scale;
    min_scale = MIN_DIMENSION/min_original_scale;

    return TRUE;
}

resizeObject(float scale)
{
    integer link_qty = llGetNumberOfPrims();
    integer link_idx;
    vector new_size;
    vector new_pos;

    if (link_qty > 1)
    {
        //link numbering in linksets starts with 1
        for (link_idx=1; link_idx <= link_qty; link_idx++)
        {
            new_size   = scale * llList2Vector(link_scales, link_idx-1);
            new_pos    = scale * llList2Vector(link_positions, link_idx-1);

            if (link_idx == 1)
            {
                //because we don't really want to move the root prim as it moves the whole object
                llSetLinkPrimitiveParamsFast(link_idx, [PRIM_SIZE, new_size]);
            }
            else
            {
                llSetLinkPrimitiveParamsFast(link_idx, [PRIM_SIZE, new_size, PRIM_POSITION, new_pos]);
            }
        }
    }
}

default
{
    state_entry()
    {
        if (scanLinkset())
        {
            //llOwnerSay("resizer script ready");
        }
        else
        {
            llRemoveInventory(llGetScriptName());
        }
    }

    touch_start(integer total)
    {
        if (llDetectedKey(0) == llGetOwner()) makeMenu();
    }

    listen(integer channel, string name, key id, string msg)
    {
        //you can never be too secure
        if (id == llGetOwner())
        {
            if (msg == "RESTORE")
            {
                cur_scale = 1.0;
            }
            else if (msg == "MIN SIZE")
            {
                cur_scale = min_scale;
            }
            else if (msg == "MAX SIZE")
            {
                cur_scale = max_scale;
            }
            else if (msg == "DELETE...")
            {               
                           llDialog(llGetOwner(),"Are you sure you want to delete the resizer script?",
                           ["DELETE","CANCEL"],menuChan);
                           return;               
            }               
            else if (msg == "DELETE")
            {               
                           llOwnerSay("deleting resizer script...");
               llRemoveInventory(llGetScriptName());               
            }           
            else
            {
                cur_scale += (float)msg;
            }

            //check that the scale doesn't go beyond the bounds
            if (cur_scale > max_scale) { cur_scale = max_scale; }
            if (cur_scale < min_scale) { cur_scale = min_scale; }

            resizeObject(cur_scale);
        }
    }
}


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 3:38 pm 
Was given this by Sissy Spacedout at LBSA..I just ran a quick check with 6 linked prims...Seems to work ok, maybe it will suit your purpose?


{L_CODE}:
//    OpenSim Compatible Linkset Resizer v 1.4
//  Copyright 2011 Sissy SpacedOut   
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.





integer min_flag;
integer max_flag;
integer do_nothing;
integer attach_flag = 0;
float max_scale = 10.0;
integer first_flag = 1;
float min_scale = 0.001;
float   cur_scale = 1.0;
integer handle;
integer menuChan;
list base_positions = [];
list base_sizes = [];

makeMenu()
{
    llListenRemove(handle);
    menuChan = 50000 + (integer)llFrand(50000.00);
    handle = llListen(menuChan,"",llGetOwner(),"");
   
    //the button values can be changed i.e. you can set a value like "-1.00" or "+2.00"
    //and it will work without changing anything else in the script
    llDialog(llGetOwner(),"Max scale: "+(string)max_scale+"\nMin scale: "+(string)min_scale+"\n \nCurrent scale: "+
        (string)cur_scale,["-0.05","-0.10","-0.25","+0.05","+0.10","+0.25","MIN SIZE","RESTORE","MAX SIZE"],menuChan);
}

getLinksetData() {
    integer link_qty = llGetNumberOfPrims();
    integer link_idx;
   
   
    base_sizes += llGetLinkPrimitiveParams(LINK_SET,[PRIM_SIZE]);
    if(attach_flag == 0) {base_positions += llGetLinkPrimitiveParams(LINK_SET, [PRIM_POSITION]);}
    else {base_positions += llGetLinkPrimitiveParams(LINK_SET, [PRIM_POSITION]);}
   
}


resizeObject(float scale)
{
    integer link_qty = llGetNumberOfPrims();
    integer link_idx;
    vector new_sz;
    vector sz;
    vector new_pos_temp;
    vector new_pos_temp_b;
    vector new_pos;
    getLinksetData();
    if (llGetNumberOfPrims() > 1)
    {
       sz   = (vector)(scale * llList2Vector(base_sizes,0));
       vector xz = llList2Vector(base_sizes,0);
       for (link_idx=1; link_idx <= link_qty; link_idx++)
        {
            new_sz   = (vector)(scale * llList2Vector(base_sizes, link_idx-1));
            if ((new_sz.x < min_scale) || (new_sz.y < min_scale) || (new_sz.z < min_scale) || (new_sz.x > max_scale) || (new_sz.y > max_scale) || (new_sz.z > max_scale)) {do_nothing = 1; if((new_sz.x < min_scale) || (new_sz.y < min_scale) || (new_sz.z < min_scale)) { min_flag = 1;} else { max_flag = 1;}}
            else {
            do_nothing = 0;
            }
        }
        for (link_idx=1; link_idx <= link_qty; link_idx++)
        {
            new_sz   = (vector)(scale * llList2Vector(base_sizes, link_idx-1));
            if (do_nothing ==    0) {
                if (link_idx == 1)
                {
                    //because we don't really want to move the root prim as it moves the whole object
                    llSetLinkPrimitiveParamsFast(link_idx, [PRIM_SIZE, sz]);
                }
                else
                {
                    new_pos_temp = ((sz.x * (llList2Vector(base_positions, 0) - llList2Vector(base_positions, link_idx-1))) / xz.x);
                    integer this_var = link_idx - 1;
                    if (first_flag == 1){ new_pos_temp_b = <(-1 * new_pos_temp.x), (-1 * new_pos_temp.y), (-1 * new_pos_temp.z)>;}
                    else {
                        new_pos_temp_b = new_pos_temp;;
                    }
                   
                    new_pos = new_pos_temp_b;
                    llSetLinkPrimitiveParamsFast(link_idx, [PRIM_SIZE, new_sz]);
                    llSetLinkPrimitiveParamsFast(link_idx, [PRIM_POSITION, new_pos]);
                }
            }
            else {
                if (min_flag == 1) {
                    integer channel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
                     
                    llDialog(llDetectedKey(0), "Cannot Resize, size would be under minimum.",
                        ["Okay"], channel);
                }
                else if (max_flag ==1) {
                    integer channel = (integer)(llFrand(-1000000000.0) - 1000000000.0);
                     
                    llDialog(llDetectedKey(0), "Cannot Resize, size would be over maximum.",
                        ["Okay"], channel);
                }
                min_flag = 0;
                max_flag = 0;
            }
        }
    }
}

default
{
    state_entry()
    {
        llResetScript();
    }
    on_rez()
    {
        llResetScript();
    }
    touch_start(integer total)
    {
        if (llDetectedKey(0) == llGetOwner()) makeMenu();
    }

        attach(key attached)
    {
        attach_flag = 1;
    }
    listen(integer channel, string name, key id, string msg)
    {
        //you can never be too secure
        if (id == llGetOwner())
        {
            if (msg == "RESTORE")
            {
                cur_scale = 1.0;
            }
            else if (msg == "MIN SIZE")
            {
                cur_scale = min_scale;
            }
            else if (msg == "MAX SIZE")
            {
                cur_scale = max_scale;
            }           
            else
            {
                cur_scale += (float)msg;
            }
            resizeObject(cur_scale);
        }
    }
}


Top
  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 9:33 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
Thanks for the script but unfortunately it scrambles the prims that make up the objects when I try it. I think my objects are cursed lol. It scrambled both the shoes and the belt. But once it gets scrambled then it will resize fine but still keeping the scrambled form.

I'm gonna work on this tonight and see if I can make some sense of it. This is a fun problem. I can learn a little about scripts hopefully.

oh boy, this will be embarrassing if it turns out to be something I am doing wrong :).

Sarah Kline {L_WROTE}:
Was given this by Sissy Spacedout at LBSA..I just ran a quick check with 6 linked prims...Seems to work ok, maybe it will suit your purpose?


{L_CODE}:
//    OpenSim Compatible Linkset Resizer v 1.4
//  Copyright 2011 Sissy SpacedOut   
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//   This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
<snip>


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 9:51 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
Oddball Otoole {L_WROTE}:
Here are some:
{L_CODE}:
// resize script by Dora Gustafson, Studio Dora 2010
// Free for anybody to read, copy, modify, compile, use, rip apart, trample on and flush
// The script is open source and free. As so it is not supported in any way
// NOTE: only for SL server v1.38 and later
// Place in prim or linkset in order to resize
// Must run in root prim
// resizer v1.0 No check or precautions against dimensions out of limits
// resizer v1.1 Test if new dimensions are within limts [0.01;10.0]m If not, resize is cancelled
// resizer v1.2 Added kill script button
// resizer v1.3 Added llListenRemove() for low lag
// resizer v1.4 Added Current relative size display
// resizer v1.5 Added rounding for size display
// resizer v1.6 Reversible resize increments
// resizer v1.7 changed to accept 64m max prim size, limits [0.01;64.0]m
<snip>

Odd

Odd, just want to mention that when I said earlier that the script from your reply wouldn't work when I put it in the root prim, that was an error on my part as I when I cut and paste it from the forum here something messed up.

When I went to save it in notepad just now, it complained it had unicode characters so I saved as text then cut and pasted that back into the script and now it does run from the objects woot.

It resizes the shoes fine but again this belt is not resizing right. Something is weird about it.

But at least this script you posted gives me a clue. It says in chat:
{L_CODE}:
[18:39]  .:M&B:. Death Metal - ceinture / belt: No resize! Out of limit sizes are not accepted

So something is messed up in this belt that is hosing up the resize scripts.


Top
 Profile  
 
 Post subject: Re: Resizer Script?
PostPosted: Tue Apr 10, 2012 10:30 pm 

Joined: Fri Mar 16, 2012 12:25 am
Posts: 36
**Edit: It is working when I resize with the object on the ground. If I am wearing the object and resize it, then the prims get scrambled like their positions get hosed**

Ok, got it working with Odd's first script. When the belt was saying "No resize! Out of limit sizes are not accepted" it was from this part of the script:
{L_CODE}:
if ( validDim )
{
   <somecode>
}
else llOwnerSay("No resize! Out of limit sizes are not accepted");

validDim was failing the test. validDim is set here and depends on the results of the dimTest function:
{L_CODE}:
for ( primindx = 1; primindx <= llGetNumberOfPrims(); primindx++ )
{
    primP = llGetLinkPrimitiveParams( primindx, [PRIM_SIZE]);
    validDim = validDim && dimTest( scal*llList2Vector( primP, 0 ));
}

So the primP list was receiving some values from the object (via llGetLinkPrimitiveParams) that were causing problems.

I added this line into the loop:
{L_CODE}:
llSay(0, "My prim_size is: " + (string)llGetLinkPrimitiveParams( primindx, [PRIM_SIZE]));

The loop was now this:
{L_CODE}:
for ( primindx = 1; primindx <= llGetNumberOfPrims(); primindx++ )
{
    primP = llGetLinkPrimitiveParams( primindx, [PRIM_SIZE]);
    llSay(0, "My prim_size is: " + (string)llGetLinkPrimitiveParams( primindx, [PRIM_SIZE]));
    validDim = validDim && dimTest( scal*llList2Vector( primP, 0 ));
}

This gave me a readout of all the object's prims' x,y,z sizes in chat:
{L_CODE}:
My prim_size is: <0.392782,0.326023,0.041328>
My prim_size is: <0.001000,0.042643,0.041214>
My prim_size is: <0.055968,0.055968,0.055968>
My prim_size is: <0.015836,0.015836,0.015836>
My prim_size is: <0.031639,0.031639,0.031639>
My prim_size is: <0.041031,0.001000,0.028564>
My prim_size is: <0.019834,0.018685,0.011726>
My prim_size is: <0.001000,0.042643,0.041214>
My prim_size is: <0.001000,0.042643,0.041214>
My prim_size is: <0.425927,0.348698,0.012513>
My prim_size is: <0.425927,0.343602,0.012513>
My prim_size is: <0.388345,0.302183,0.012513>
My prim_size is: <0.356489,0.294000,0.012513>
My prim_size is: <0.175498,0.417851,0.285881>
My prim_size is: <0.175498,0.398549,0.285881>
My prim_size is: <0.237008,0.050460,0.175399>
My prim_size is: <0.243477,0.050460,0.175399>
My prim_size is: <0.243477,0.095330,0.175399>
My prim_size is: <0.063644,0.190933,0.063644>
My prim_size is: <0.025702,0.023125,0.025451>

So now looking at dimTest it seems no prim can have a size lower than 0.01:
{L_CODE}:
integer dimTest( vector vr )
{
    return !( vr.x<0.01 || vr.y<0.01 || vr.z<0.01 || vr.x>64.0 || vr.y>64.0 || vr.z>64.0 );
}

But in the belt I could see a couple prims at 0.001000:
{L_CODE}:
My prim_size is: <0.041031,0.001000,0.028564>
My prim_size is: <0.001000,0.042643,0.041214>
My prim_size is: <0.001000,0.042643,0.041214>

I changed dimTest to allow down to 0.0001 minimum sizes:
{L_CODE}:
integer dimTest( vector vr )
{
    return !( vr.x<0.0001 || vr.y<0.0001 || vr.z<0.0001 || vr.x>64.0 || vr.y>64.0 || vr.z>64.0 );
}

Now the belt resizes woot!

Not sure if this will have any unintended consequences but I don't see why it would.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 11 posts ]
Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net