Difference between revisions of "Tool-Texture cube hollow face"
Jump to navigation
Jump to search
BETLOG Hax (talk | contribs) (Created page with '{{LSL Header}} ====Tool-Texture cube hollow face v0.1.0==== --BETLOG Hax GMT+10: 20090210 0222 [SLT: 20090209 0922] A tool for adjusting texture repeats for...') |
m (<lsl> tag to <source>) |
||
Line 8: | Line 8: | ||
<br> | <br> | ||
< | <source lang="lsl2"> | ||
//========================================================================= | //========================================================================= | ||
f_setHollowX(float Xrepeats) | f_setHollowX(float Xrepeats) | ||
Line 62: | Line 62: | ||
//========================================================================= | //========================================================================= | ||
</ | </source> | ||
[[Category:LSL Examples]] | [[Category:LSL Examples]] |
Latest revision as of 18:10, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Tool-Texture cube hollow face v0.1.0
--BETLOG Hax GMT+10: 20090210 0222 [SLT: 20090209 0922]
A tool for adjusting texture repeats for inside (hollow) face of cubes.
I made some attempt to accommodate other prim types, but never actually finished it.
//=========================================================================
f_setHollowX(float Xrepeats)
{ list data = llGetPrimitiveParams([PRIM_TYPE]);
vector cut = llList2Vector(data, 2);
float hollow = llList2Float(data, 3);
if (hollow == 0.0)
{ llOwnerSay("ERROR: not hollow.");
return;
}
if (llList2Integer(data, 0) != PRIM_TYPE_BOX)
{ llOwnerSay("WARNING: not a box. This is completely UNTESTED");
}
integer face = 5;
if (cut.y - cut.x <= 0.75) face = 4;
if (cut.y - cut.x <= 0.5) face = 3;
if (cut.y - cut.x <= 0.25) face = 2;
//llOwnerSay((string)cut+"\t"+(string)face);
float rpt = Xrepeats/-hollow;
float ofs = (((Xrepeats/-hollow)+Xrepeats) / 2.0)+(Xrepeats/2.0/Xrepeats);
if ((ofs > 1.0) || (ofs < -1.0))
ofs -= (float)llFloor(ofs);
vector o = llGetTextureOffset(face);
vector r = llGetTextureScale(face);
llSetPrimitiveParams([PRIM_TEXTURE, face
, llGetTexture(face)
, <rpt, r.y, 0.0>//repeats
, <ofs, o.y, 0.0>//offsets
, 0*DEG_TO_RAD
]);
}
//======================================================================================
default
{ on_rez(integer start_param)
{ llResetScript();
}
state_entry()
{ llOwnerSay(
"\n Type number of X texture repeats for the hollow face of a cube."
+"\n Type 'done' to delete script and finish.");
llListen(0, "", llGetOwner(), "");
}
listen(integer channel, string name, key id, string message)
{ if ((float)message != 0.0)
{ f_setHollowX((float)message);
}
if (llToLower(message) == "done")
{ llOwnerSay("OK, removing script.");
llRemoveInventory(llGetScriptName());
}
}
}
//=========================================================================