Jump to content

EniarTenokei

Resident
  • Posts

    26
  • Joined

  • Last visited

Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you for your answer. I now know how to use it properly.
  2. http://wiki.secondlife.com/wiki/WrapText How would I go about using this code to wrap text?
  3. I want to make an RC Helicopter cam follower where I can click the hud on or off and the cam will follow the vehicle. What would the scripts, the one for the vehicle and the one for the hud, consist of?
  4. So how could I use llCastRay(); to not shoot the wing or other parts of my ship that isn't the root prim when firing at a selected target?
  5. if( llGetOwnerKey(llList2Key(hit, 0)) == llGetOwner() ) { return; // Exit the current function/event to stop shooting. } And this code means don't shoot the owner, right?
  6. Is this the code I would use if I don't want the turret to shoot the wing of my ship which isn't the root prim? if( llGetObjectDetails(llList2Key(hit, 0), [OBJECT_GROUP]) == group_key_to_ignore ) { return; // Exit the current function/event to stop shooting. }
  7. I'm probably creating more work for myself that I don't really need to be trying to add more dialogs to this turret script so I've decided not to. Thanks for your help everyone!
  8. How should I define avatarsNames here? Here's the script I'm working on: string mainMenuDialog = "\nWhich settings would you like to access?\nClick \"Close\" to close the menu.\n\nYou are here:\nMainmenu"; list mainMenuButtons = ["Select Avatar", "Cease Fire", "Close"]; string subMenu_01_Dialog = "\nClick \"Close\" to close the menu.\nClick \"-Main-\" to return to the main menu.\n\nYou are here:\nMainmenu > sub 01"; list subMenu_01_Buttons = [ "Close", "-Main-"]; string subMenu_02_Dialog = "\nClick \"Close\" to close the menu.\nClick \"-Main-\" to return to the main menu.\n\nYou are here:\nMainmenu > sub 02"; integer dialogChannel; integer dialogHandle; list avatarsKeys; list avatarsNames; open_menu(key inputKey, string inputString, list inputList) { dialogChannel = (integer)llFrand(DEBUG_CHANNEL)*-1; dialogHandle = llListen(dialogChannel, "", inputKey, ""); llDialog(inputKey, inputString, inputList, dialogChannel); llSetTimerEvent(30.0); } close_menu() { llSetTimerEvent(0.0);// you can use 0 as well to save memory llListenRemove(dialogHandle); } //menu listener integer listener; integer sensorChannel; // sensor integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { on_rez(integer start_param) { llResetScript(); } touch_start(integer total_number) { key id = llDetectedKey(0); // Ensure any outstanding listener is removed before creating a new one close_menu(); open_menu(id, mainMenuDialog, mainMenuButtons); } sensor(integer total_number) { integer i; key tempId; avatarsKeys = []; avatarsNames = []; i = 0; while ((i < total_number) && (i < 12)) { tempId = llDetectedKey(i); avatarsKeys = avatarsKeys + tempId; avatarsNames = avatarsNames + llKey2Name(tempId); i = i+1; } dialogChannel = randomNumber(); menu(llGetOwner(),dialogChannel,"Select an avatar...",avatarsNames); } listen(integer channel, string name, key id, string message) { if(channel != dialogChannel) return; close_menu(); if(message == "-Main-") open_menu(id, mainMenuDialog, mainMenuButtons); else if(message == "Select Avatar") llSetTimerEvent(0.3); else if(message == "Cease Fire") llResetScript(); }timer() { key kTarget = llList2Key(avatarsKeys,llListFindList(avatarsNames,[])); llLookAt(llGetPos() + (llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0) + <0.0, 0.0, 0.0> - llGetPos()) / llGetRootRotation(), 1.0, 0); llRezObject("bullet", llGetPos()+<0,0,3>*llGetRot(),<0,0,40>*llGetRot(),llGetRot(),0); } }
  9. I'm trying to get the select avatars dialog to open but can't get it to work. I put more dialog windows on the turret script once I got the timer to work. So, what should I do to get the select avatars button to detect the avatars? Here's the script I'm working on: //menu listener integer listener; integer sensorChannel; // sensor list avatarsKeys; list avatarsNames; string mainMenuDialog = "\nWhich settings would you like to access?\nClick \"Close\" to close the menu.\n\nYou are here:\nMainmenu"; list mainMenuButtons = ["Select Avatars", "Cease Fire", "Close"]; string subMenu_01_Dialog = "\nClick \"Close\" to close the menu.\nClick \"-Main-\" to return to the main menu.\n\nYou are here:\nMainmenu > sub 01"; list subMenu_01_Buttons = [ "Close", "-Main-"]; string subMenu_02_Dialog = "\nClick \"Close\" to close the menu.\nClick \"-Main-\" to return to the main menu.\n\nYou are here:\nMainmenu > sub 02"; list subMenu_02_Buttons = ["action 02a", "action 02b", "Close", "-Main-"]; integer dialogChannel; integer dialogHandle; open_menu(key inputKey, string inputString, list inputList) { listener = llListen(dialogChannel,"","",""); dialogChannel = (integer)llFrand(DEBUG_CHANNEL)*-1; dialogHandle = llListen(dialogChannel, "", inputKey, ""); llDialog(inputKey, inputString, inputList, dialogChannel); llSetTimerEvent(30.0); } close_menu() { llSetTimerEvent(0.0);// you can use 0 as well to save memory llListenRemove(dialogHandle); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { on_rez(integer start_param) { llResetScript(); } touch_start(integer total_number) { key id = llDetectedKey(0); // Ensure any outstanding listener is removed before creating a new one close_menu(); open_menu(id, mainMenuDialog, mainMenuButtons); } sensor(integer total_number) { integer i; key tempId; avatarsKeys = []; avatarsNames = []; i = 0; while ((i < total_number) && (i < 12)) { tempId = llDetectedKey(i); avatarsKeys = avatarsKeys + tempId; avatarsNames = avatarsNames + llKey2Name(tempId); i = i+1; } dialogChannel = randomNumber(); open_menu(llGetOwner(),sensorChannel,"Select an avatar..."); } listen(integer channel, string name, key id, string message) { if(channel != dialogChannel) return; close_menu(); if(message == "-Main-") open_menu(id, mainMenuDialog, mainMenuButtons); else if(message == "Select Avatars") open_menu(id, subMenu_01_Dialog, subMenu_01_Buttons, channel); else if(message == "Cease Fire") llResetScript(); else if (channel != dialogChannel) { llSetTimerEvent(0.3); //do something } } timer() { key kTarget = llList2Key(avatarsKeys,llListFindList(avatarsNames,[])); llLookAt(llGetPos() + (llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0) + <0.0, 0.0, 0.0> - llGetPos()) / llGetRootRotation(), 1.0, 0); llRezObject("bullet", llGetPos()+<0,0,3>*llGetRot(),<0,0,40>*llGetRot(),llGetRot(),0); } }
  10. Can I have more than 1 timer() function in one script?
  11. I don't think I would've ever figured that order out seeing that I've never done a lot of LSL scripting before. How does the process work for creating any type of script? The only answer I can think of is this: Learn the broad concepts instead of focusing on one specific thing, like you said, after I study all the functions, reverse engineer a lot of scripts, and the basic syntax then after enough experience and mistakes that take roughly 2 years then it will just start to click. Is that how it's done or am I missing something? You said you don't gain anything by looking up the answer in the teacher's book, I totally agree with you, but at the same time I think you can look up the different functions and study the premade examples by breaking them down and eventually you can put the different pieces together like a puzzle into one large script.
  12. With this example I came up with this: However, I still need the timer function to work. key kTarget; key kLookUpKey(integer n){ key k = llList2Key(lDetected,n); return k; } list lDetected; integer iFire; //menu listener integer listener; integer sensorChannel; // sensor list avatarsKeys; list avatarsNames; menu(key user,integer channel,string title,list buttons) { listener = llListen(channel,"","",""); llDialog(user,title,buttons,channel); //remove listener if there's no activity in menu llSetTimerEvent(20.0); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { touch_start(integer total_number) { //only owner can access the menu if (llDetectedKey(0) == llGetOwner()) { llSensor("","",AGENT|PASSIVE,96,PI); } } sensor(integer total_number) { integer i; key tempId; avatarsKeys = []; avatarsNames = []; i = 0; while ((i < total_number) && (i < 12)) { tempId = llDetectedKey(i); avatarsKeys = avatarsKeys + tempId; avatarsNames = avatarsNames + llKey2Name(llDetectedKey(i)); i = i+1; } sensorChannel = randomNumber(); menu(llGetOwner(),sensorChannel,"Select an avatar...",avatarsNames); } listen(integer channel,string name,key id,string message) { if((string)((integer)message) == message){//then message is a valid integer kTarget = kLookUpKey((integer)message); }}timer() { vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); float fDistance=llVecDist(<vTargetPos.x,vTargetPos.y,0>,<vPos.x,vPos.y,0>); llLookAt(vPos + (vTargetPos + <0.0, 0.0, 0.0> - vPos) / llGetRootRotation(), 1.0, 0); llRezObject("bullet", llGetPos()+<0,0,3>*llGetRot(),<0,0,20>*llGetRot(),llGetRot(),0); } }
  13. So I made kTarget global variable, and took out the if message, so how do I get the llSetTimer(); Switch to work? I'm not familiar with this method. //menu listener integer listener; integer sensorChannel; // sensor list avatarsKeys; list avatarsNames; integer kTarget; menu(key user,integer channel,string title,list buttons) { listener = llListen(channel,"","",""); llDialog(user,title,buttons,channel); //remove listener if there's no activity in menu llSetTimerEvent(20.0); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { touch_start(integer total_number) { //only owner can access the menu if (llDetectedKey(0) == llGetOwner()) { llSensor("","",AGENT|PASSIVE,96,PI); } } sensor(integer total_number) { integer i; key tempId; avatarsKeys = []; avatarsNames = []; i = 0; while ((i < total_number) && (i < 12)) { tempId = llDetectedKey(i); avatarsKeys = avatarsKeys + tempId; avatarsNames = avatarsNames + llKey2Name(llDetectedKey(i)); i = i+1; } sensorChannel = randomNumber(); menu(llGetOwner(),sensorChannel,"Select an avatar...",avatarsNames); } touch(integer num_detected) { llSetTimerEvent( 0.1 * (kTarget -= !kTarget) ); } timer() { llLookAt(llGetPos() + (llList2Vector(llGetObjectDetails(llList2Key(avatarsKeys,llListFindList(avatarsNames,[])),[OBJECT_POS]),0) + <0.0, 0.0, 0.0> - llGetPos()) / llGetRootRotation(), 1.0, 0); llRezObject("bullet", llGetPos()+<0,0,3>*llGetRot(),<0,0,20>*llGetRot(),llGetRot(),0); } }
×
×
  • Create New...