Kayaker is right; To get the transparency of a face, use
PRIM_COLOR:
Code: Select all
default
{
state_entry()
{
llSay(0, "Script running");
}
touch_start(integer num)
{
float alpha = llList2Float(llGetLinkPrimitiveParams(1,[PRIM_COLOR,0]),1);
llSay(0,"My Alpha is: " + (string)alpha);
}
}
What you tried to do is get the alpha mask cutoff point of a texture set to mode PRIM_ALPHA_MODE_MASK:
PRIM_ALPHA_MODE. The returned mask_cutoff is an integer (!) and can range from 0..255 (see wiki). It defines the cutoff point on the texture where the 1-bit (!) alpha kicks in.
Code: Select all
default
{
state_entry()
{
llSay(0, "Script running");
}
touch_start(integer num)
{
integer mask_cutoff = llList2Integer(llGetLinkPrimitiveParams(1,[PRIM_ALPHA_MODE,0]),1);
llSay(0,"My alpha mask cutoff point is: " + (string)mask_cutoff);
}
}
The default alpha mode on newly textured faces (with 32-bit/alpha textures) is 'Alpha blending', and probably the reason why you got 0 returned as mask_cutoff is undefined with PRIM_ALPHA_MODE_BLEND.
Off-topic builder tip: Setting alpha mode to 'Alpha masking' instead can tremendously improve viewer side performance, it is just less pretty because it's 1-bit (on/off) so no pretty anti aliasing on the edges. Play with the cutoff point to see what looks nice; I suggest start with 128, and only if it fails to look good revert to alpha blending.