sb4u Posted May 30, 2012 Share Posted May 30, 2012 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 More sharing options...
Darkie Minotaur Posted May 30, 2012 Share Posted May 30, 2012 You got your curly brackets ({}) all screwed up. Load the script to a decent editor that helps you checking the syntax and hunt for the little bastards. Such an editor would be LSL Editor, which is simple to install and use. Link to comment Share on other sites More sharing options...
sb4u Posted May 30, 2012 Author Share Posted May 30, 2012 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 More sharing options...
Vladan Highwater Posted May 30, 2012 Share Posted May 30, 2012 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. 1 Link to comment Share on other sites More sharing options...
sb4u Posted May 30, 2012 Author Share Posted May 30, 2012 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 More sharing options...
sb4u Posted May 30, 2012 Author Share Posted May 30, 2012 Is it possible? Link to comment Share on other sites More sharing options...
sb4u Posted May 30, 2012 Author Share Posted May 30, 2012 Thats what I was trying to achieve and failing Link to comment Share on other sites More sharing options...
sb4u Posted May 30, 2012 Author Share Posted May 30, 2012 Also many thanks Link to comment Share on other sites More sharing options...
Vladan Highwater Posted May 30, 2012 Share Posted May 30, 2012 Yes it goes as you wrote, except that you have to attach the sword in advance to your hand, but when it is sheathed you make the one in your hand transparent. When you want to get it in your hand, you make the one in your hand visible and the one sheathed transparent. Link to comment Share on other sites More sharing options...
sb4u Posted May 30, 2012 Author Share Posted May 30, 2012 Pity Im so new to SL scripting I have no idea where to start... Link to comment Share on other sites More sharing options...
sb4u Posted May 30, 2012 Author Share Posted May 30, 2012 Thanks for your help in advance though. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 31, 2012 Share Posted May 31, 2012 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 More sharing options...
Helm Anton Posted June 1, 2012 Share Posted June 1, 2012 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 More sharing options...
sb4u Posted June 1, 2012 Author Share Posted June 1, 2012 Thank you both it shure has Link to comment Share on other sites More sharing options...
Recommended Posts
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