Wonder if anyone can point me in the right direction. Hopefully very simple.
Trying to package photographs and art and so have a one prim 'canvas' with image as texture. All images different sizes and so original prim will have correct dimensions.
Don't want the item to be set with Mod permissions and so would like a script to scale the canvas to the user requirements. Found some script to do this with linked prims on wiki but whats the point if I only need the one prim.
Ideally want a button control to adjust the size e.g. <, >, and reset however a chat command based script would be fine:-
and so here's what I did which is a bit daft but gotta learn somehow
in the linked prim
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 in the root prim being 100% alpha invisible at the back of the picture
// 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);
}
}
default {
state_entry() {
llListen(9, "", llGetOwner(), ""
;}
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);
}
}
all above as per wiki example....great it works BUT
how do i accomadate for silly user entry. The max size is obviously always going to be 10m x 10 X 10 and so if a user enters a scale of 2000 you end up with a 10m cube. Basically what I am trying to say is that the depth of the picture should always remain the same i.e. 0.25m.
Hope that all makes sense
Noob to scripting but reasonably intelligent...lol....any advice would be gratefully accepted
XX
DD
DD