MantisBT - opensim
View Issue Details
0006562opensim[REGION] Scripting Enginepublic2013-03-04 12:312014-12-28 00:07
Diva 
 
normalminoralways
newopen 
master (dev code) 
master (dev code) 
Standalone (1 Region) , Standalone (Multiple Regions) , Grid (1 Region per Sim) , Grid (Multiple Regions per Sim)
BasicPhysics, ODE, BulletSim
Unknown
None
0006562: XEngine is confused about types of constants in llAttachToAvatarTemp
It looks like XEngine has some mismatch regarding the types of some LSL constants for llAttachToAvatarTemp. This doesn't happen for llAttachToAvatar.
Place this script on a cube, and touch the cube. You'll get a runtime error.

integer i = 0;

default
{
    state_entry()
    {
        llSay(0, "Script running");
    }
    
    touch_start(integer n)
    {
        if (i == 0)
        {
            i++;
            llRequestPermissions(llDetectedKey(0), PERMISSION_ATTACH);
        }
        else
            llDie();
    }
    
    run_time_permissions( integer vBitPermissions )
    {
        if( vBitPermissions & PERMISSION_ATTACH )
        {
            llAttachToAvatarTemp( ATTACH_LHAND );
        }
        else
        {
            llOwnerSay( "Permission to attach denied" );
        }
    }
}
No tags attached.
Issue History
2013-03-04 12:31DivaNew Issue
2014-12-28 00:07greg0254Note Added: 0027143

Notes
(0027143)
greg0254   
2014-12-28 00:07   
This is still an issue with r/25604 commit f3ab7c0f5c76. The message it produces is:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> OpenSim.Region.ScriptEngine.Shared.ScriptException: MOD Runtime Error: llAttachToAvatarTemp: parameter type mismatch; expecting Int32, type(parm)=System.Int32

A workaround is to add a redundant cast to the parameter, e.g. llAttachToAvatarTemp( (integer)ATTACH_LHAND );

(I'm also curious as to why it's necessary to enable MOD functions for temp attachments to work, if anyone cares to explain this.)