DanielWolfsong Posted January 1, 2014 Share Posted January 1, 2014 Hi - back again -I moved the 'give book' script to the chair. But the chair will execiute only the 'sit' script. To get it to execute the secondary "give book" script I find I have to click on the chair again after sitting in it.Which leads me to my next question - there are no "If then" operators in LSL?IF I am sitting in the chair THEN give me the book. (?)Perhaps I'm too simple-minded for this LS language?Thanks for any help you can give-Daniel Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted January 1, 2014 Share Posted January 1, 2014 Hi Daniel, LSL has the standard if-else logic. You can learn more about it here... http://lslwiki.net/lslwiki/wakka.php?wakka=ifelse The "then" is implied by the curly braces that encompass the block of code. Those braces are not needed if the conditional bit is only one statement, but I generally use them anyway. The top of the LSL wiki is here... http://lslwiki.net/lslwiki/wakka.php?wakka=HomePage Spend some time meandering through the introductory stuff to get your bearings. Good luck! Link to comment Share on other sites More sharing options...
DanielWolfsong Posted January 1, 2014 Author Share Posted January 1, 2014 Yes thank you - I admit I am over my head with this LSL. I simply want an av to sit in a chair and be given a book in one seamless action. I have the sit script and I have the give book script BUT I cannot figure out how to make them act togeher. I'm willing to pay someone at this point to write the script I need! LOL Sit script is this: // Basic sit-pose script by Lex Neva default { state_entry() { llSitTarget(<0.01975, 0.32866, 0.12265>, <-0.00000, 0.00000, 0.70711, 0.70711>); } changed(integer change) { if (llAvatarOnSitTarget() != NULL_KEY) llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION); } run_time_permissions(integer perm) { string anim = llGetInventoryName(INVENTORY_ANIMATION, 0); if (anim != "") { llStopAnimation("sit"); llStartAnimation(anim); } } } Gve Book Script is this: default { touch_start(integer total_number) { llGiveInventory(llDetectedKey(0), "Book for Reading *wear*"); } } If there is anyone out there willing to help I would be very appreciative! Thanks- Daniel Link to comment Share on other sites More sharing options...
Rolig Loon Posted January 1, 2014 Share Posted January 1, 2014 Not very hard. Since you want to give the book to the person who sat down, just change your llGiveInventory statement to llGiveInventory(llAvatarOnSitTarget(), "Book for Reading *wear*"); and put it in the run_time_permissions event, along with your animation control statements. Incidentally, it would be much more interesting if you wrote your script to use llAttachToAvatarTemp. That way, the person who sits on your chair could attach the book directly instead of having to receive it, find the thing in inventory, and attach it. He also wouldn't be stuck with a new copy of your book every time he sits down. 1 1 Link to comment Share on other sites More sharing options...
LepreKhaun Posted January 1, 2014 Share Posted January 1, 2014 LSL, as do all programming languages, has an implicit IF THEN operator: IF (one_wishes_to_write_a_program_using_LSL) THEN {one_must_first_study_LSL}; 1 Link to comment Share on other sites More sharing options...
DanielWolfsong Posted January 1, 2014 Author Share Posted January 1, 2014 Thanks so much everyone for your time and insight. I really appreictae the help. I must be particularly slow at the concept here - no matter what changes I make to the second script (give book) it still will not execute it after the "sit". The chair has to be clicked on after sitting to get the second script to work. It only executes the sit script. This has been the problem all along - I wanted them to execute at the same time. (I'm not an LSL programer) Well - I've run out of time on this project and must got back to work tomorrow. Thanks for all your help! -Daniel Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now