Hal Canary (hwc) wrote in sl_creators,
Hal Canary
hwc
sl_creators

Make a nice picture frame.

This one does the math so you don't have to.

// Change size of frame
// Simple script to make a frame around a rectangle using
// a single prim.
// Copyright 2008 Hal Canary

// Licence Information:
//  Permission is hereby granted, free of charge, to any
//  person obtaining a copy of this software and
//  associated documentation files (the "Software"), to
//  deal in the Software without restriction, including
//  without limitation the rights to use, copy, modify,
//  merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom
//  the Software is furnished to do so, subject to the
//  following conditions:
//
//  The above copyright notice and this permission notice
//  shall be included in all copies or substantial
//  portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
//  ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
//  LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
//  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
//  EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
//  FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
//  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
//  USE OR OTHER DEALINGS IN THE SOFTWARE.


// Set the x,y,w parameters based on the proper scale of
// the texture you have.  Then drag the script onto the
// prim.

default {
    state_entry() {
        float y = 2.000;        // width
        float x = y * 2 / 1;    // height
        float w = 0.200;        // frame width
        float z = 0.1;          // thickness

        llSetPrimitiveParams([PRIM_SIZE,
            <x + w + w, y + w + w, z>]);
        llSetPrimitiveParams([PRIM_TYPE,
            PRIM_TYPE_BOX,
            0, <0.0, 1.0, 0.0>, 
            0.0, <0.0, 0.0, 0.0>,
            <x/(x+w+w), y/(y+w+w), 0.0>,
            <0.0, 0.0, 0.0>]);
        llSay(0, "Frame resized!");
        llRemoveInventory(llGetScriptName());
    }
}
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded 

  • 0 comments