Jump to content

Script error. Help please


sb4u
 Share

You are about to reply to a thread that has been inactive for 4411 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Can anyone hellp with this script?  Keeps coming up with Syntax error.  I am new so its probably something obvious.

default

{ 
    state_entry()
    {
        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
    }
 
    run_time_permissions( integer vBitPermissions )
    {
        if( vBitPermissions & PERMISSION_ATTACH )
        {
            llAttachToAvatar( ATTACH_LHAND );
        }
        else
        {
            llOwnerSay( "Permission to attach denied" );
        }
    }
    
          touch_start(integer num_detected)
    {
        integer i = 0;
        for(; i<num_detected; ++i)
           llAttachToAvatar(ATTACH_RHAND);
            state hot;
state hot{
    state_entry()
        { 
        touch_start(integer num_detected)
    {
         llAttachToAvatar(ATTACH_HUD_CENTER_2);
        state default;
    }
}
           
  
           
}
}

 

Link to comment
Share on other sites

I tried the editor but with syntax checker I got these three results...Im still left wondering...

1    } expected    new.lsl    26    26    
2    } expected    new.lsl    29    10    
3    Type or namespace definition, or end-of-file expected    new.lsl    42    1    




Link to comment
Share on other sites

The correct syntax would be like this:

default{     state_entry()    {        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );    }     run_time_permissions( integer vBitPermissions )    {        if( vBitPermissions & PERMISSION_ATTACH )        {            llAttachToAvatar( ATTACH_LHAND );        }        else        {            llOwnerSay( "Permission to attach denied" );        }    }        touch_start(integer num_detected)    {        integer i = 0;        for(; i<num_detected; ++i)           llAttachToAvatar(ATTACH_RHAND);            state hot;    }}state hot{    state_entry()    {     }        touch_start(integer num_detected)    {         llAttachToAvatar(ATTACH_HUD_CENTER_2);        state default;    }}

 Now the script compiles, but doesn't really work, what do you want it to do exactly? If I get what you want, the problem is that you can't attach the object to another position while it is attached, you need to detach it first.

  • Like 1
Link to comment
Share on other sites

I am trying to make a script that would enable me to attach then deattach it after.  This script itself would not work that well but it was a start.  My true aim, if possible, was to use a scripted HUD to change a sword from sheathed position to ready position, which comes down to changing the transparency of the sheathed object, then attaching a seperate sword on the other.  I am not sure how to make the HUD work with these other objects though.

Link to comment
Share on other sites

Is there a particular reason why you want to rez the sword each time you want to use it, rather than -- which is the normal way of doing this -- wear two attachments, a sheathed sword and an unsheathed one, and toggle their visibility, or at least the visibility of the sword prims in the sheathed version (since the scabbard needs to stay visible at all times)?

Rezzing one is certainly possible, and the new llAttachToAvatarTemp (only works on Magnum sims at the moment, but should be grid-wide in a week or so, all being well) does away with the problem with llAttachToAvatar, which only lets you detach the rezzed object into your inventory.

However, it's only going to work on parcels where you can rez stuff, and it's fiddly to set up if you don't want to keep on having to grant the sword permission to attach to you each time you rez it.    

My strong advice would be to toggle visibility unless there's a pressing reason not to.

Link to comment
Share on other sites

Why do you want to draw and sheath the weapon through a hud for?  Why not just use the script in the weapon to draw and sheath through chat gestures? -

(Included in the start of the script) -

EXAMPLE -

integer chat_channel= (your channel here that the weapon will listern to, ...lets say 30)

(youd want to make some gestures as below)

Gesture to draw , chat = /30 draw / / set gesture trigger F11

gesture to sheath, chat = /30 sheath / / set gesture trigger F12

 

(For the sword to show and fade on draw sheath you need to set the alpha -)

EXAMPLE -

listen(integer chan, string name, key id, string msg)

{

if(llToLower(msg)== "sheath")

{

llSetLinkAlpha(LINK_SET, 0, ALL_SIDES);

(any other action to be taken on sheath)

llReleaseControls();

}

else if (llToLower(msg)== "draw")

{

llSetLinkAlpha(LINK_SET, 1, ALL_SIDES);

(any other action to be taken on Draw)

}

}

(Rest of script here)

That will make the weapon show and fade. if you want to have a sheathed weapon show and fade you use the same as above within that sheath prim excpet its in reverse order. There are other ways of doing this also.

 

Hope that example helps some.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4411 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...