Jump to content

Xander Lopez

Resident
  • Posts

    47
  • Joined

  • Last visited

Everything posted by Xander Lopez

  1. So i can see from wiki that llCastRay will accept four filters RC_REJECT_AGENTS RC_REJECT_PHYSICAL RC_REJECT_NONPHYSICAL RC_REJECT_LAND What I am trying to achieve is a bit complicated. I am trying to create a weapon that can detect Avatar, AND ALSO certain type of prims. This special prims might have some special script inside, or maybe created by certain avatar, or maybe has some other indicator that says the prim is eligible for llCastRay to recognize. Is there any way to do this? If the ray hits any normal prims that are not eligible, i want it to just continue on until it hits any avatar or any valid prims. It seems very complicated to come up with this kind of rule. Any suggestions?
  2. I think the answer is probably no, but I just wanted to confirm this with someone knowledgeable... When llCastRay executes, I believe it shoots very very tiny ray to scan objects.. refer to this post Now, is there any possible way this tiny ray could be thicker? Perhaps.. 1 meter or 2 meters thick??
  3. so lets say i have the basic dialog script which opens up a menu so you can either choose "Yes" or "No". I have 100 of the same objects that contains the same script. Let's say the example is shown as below. Notice these 100 objects are all listening to channel -99. integer gListener; default { touch_start(integer total_number) { llListenRemove(gListener); gListener = llListen(-99, "", llDetectedKey(0), ""); llDialog(llDetectedKey(0), "\nyour answer is?", ["Yes", "No" ] , -99); llSetTimerEvent(60.0); } listen(integer chan, string name, key id, string msg) { if (msg == "Yes") ..... if (msg == "No") ..... } timer() { llListenRemove(gListener); llSetTimerEvent(0.0); } } Now, if i assign a different channel to all these 100 objects, they would have no problem identifying whos "no" means for which object. But I don't want to go thru and assigning a different channel to listen for 100 objects.. Is there anyway for each objects to listen to only "No" came from their own prim altho they are all listening to the same channel?
  4. so i was referring to the documentation shown here to create flight assist program. My objective is to simply reduce flight speed and not the run speed by modifying this code. After looking at the flight assist script, I am starting to have question as if the code inside the timer is necessary to fly slower now? timer() { if (llGetAgentInfo(llGetOwner()) & AGENT_FLYING) { llSetForce((<0.0,0.0,9.81> * llGetMass()),0); jump flight_off; } llSetForce(<0.0,0.0,0.0>,0); @flight_off; llSetTimerEvent(0.5); } It sounds like this portion was written so people could fly above certain height when secondlife in 2007 didn't allow you to fly above certain height. Can I omit this script portion inside the timer and still be able to fly slower with no problem?
  5. Question 1: It seems like these following codes pretty much bring the same result altho how it determines to see if both parties are in the same group is different. So which one would be faster to process? case 1: if (llDetectedGroup(0)) llOwnerSay("true"); case 2: if (llSameGroup(llDetectedKey(0))) llOwnerSay("true"); Question 2: I have Avatar A, and Avatar B comparing groups to see if they are wearing the same group. The problem is that the above fuctions will return true if both Avatar A and B are NOT wearing any group. I guess it treat as Avatar A and Avatar B are wearing the same group cuz technically both are wearing "no" groups. Is there anyway to return False if these avatars are not wearing any group??
  6. I am trying to create a radar which displays the distance between myself and my target avatar. (and also the target avatar's name thru llKey2Name) Here is the question. I think sensor is a thing of the past. Everyone talks about using http://wiki.secondlife.com/wiki/LlGetAgentList Though, I am not sure if i am on the right track. Would it make sense to use llGetAngetList to scan the target avatar, and calculate its distance every 0.1 seconds with timer event?? How should I start with the concept of creating this with the most lagless way?
  7. so i have a hud which opens a textbox llTextBox(llDetectedKey(0), "type your shout out", channel); Then the message received from llTextBox gets sent to another Prim called "Receiver" via llRegionSayTo() And this "Receiver" would display the message as hovertext llSetLinkPrimitiveParamsFast(0, [PRIM_TEXT, received_message, <1.0,1.0,1.0>, 1.0]); Then.. if the message was entered as "this is the first line. \nthis is the 2nd line.", it doesn't do the linebreak. Rather it displays as "this is the first line. \nthis is the 2nd line." How can I make sure that the hover text on receiver is shown as this is the first line. this is the 2nd line.
  8. I am trying to see if there is a way I can script to force users from stop flying? I searched wiki but i can't seem to find a good starting point to implement this. This would require no experience nor rlv. is this possible? Also, i was reviewing a flight assist script shown here because i want to find a way to prevent people from being able to move as I adjust the integer speed value. But decreasing the speed value doesn't seem to prevent people from moving around. Is there a way to effectively disable people from being able to move? or at least, move painfully slow?
  9. I have some complicated series of functions that call another function. And this is quite confusing to me. Let's say i have the following script. function1() { llOwnerSay("This chair is made of wood"); ... call more functions... } function2() { llOwnerSay("This chair is made of wood"); ... call more functions... } functionA (){ if (apple == 1) watermelon = 1; if (orange == 1) pineapple = 1; if (chair == 1) function1(); else if (desk == 1) function2(); } functionB () { llSetTimerEvent(2); } callMoreThanOneFunctions() { functionA();functionB();} So here is the confusing part. Let's say I called the function callMoreThanOneFunctions(). This would execute functionA first, and then execute functionB upon completion of the functionA. I want to execute callMoreThanOneFunctions() However, if (chair == 1) or (desk == 1) are true, I want to cancel calling functionB. I would like to avoid calling function1 and functionB when (chair == 1). How can I program this?
  10. Thanks for your explanation @Wulfie Reanimator I just did some couple testing and it appears to be that what you said is correct. (this makes my life a lot easier) I found the cause of my problem being originating from one of the llRegionSayTo.
  11. @Wulfie Reanimator Let me make sure that what you said also applies to the following scenario. Would "function2()" run ONLY after function1() is complete when StartMe() is executed? function1() { //contains 600 lines of code doing complex calculations and send out 5 different llRegionSayTo() and then finally set a global integer myValue = 100;} function2() { //simply read the global integer myValue and change some prim color } function3() { //contains another 300 lines of code doing complex calculations } StartMe() { function1(); function2(); function3(); }
  12. I am trying to see how I can ensure that the first function is completed before running the function written in the next line. I have the following code shown as below: myFunction1() { llOwnerSay("do some crazy calculations here"); } myFunction2() { llOwnerSay("change some textures here"); } myFunction3() { llOwnerSay("change prim shape here"); } startMe1() { myFunction1(); myFunction2(); myFunction3(); } startMe2() { myFunction3(); myFunction2(); myFunction1(); } My assumption was that when startMe1() was executed, it would process myFunction1 first, and then process to myFunction2 only if myFunction2 is complete, and same thing goes for myFuction3. However, it appears to be that myFunction1(), myFunction2(), myFunction3() would execute one after another regardless of previous function was complete or not. I guess I could have written the code as below so they run after one another. myFunction1() { llOwnerSay("do some crazy calculations here"); myFunction2(); } myFunction2() { llOwnerSay("change some textures here"); myFunction3(); } myFunction3() { llOwnerSay("change prim shape here"); } myFunction1(); But the problem with this code is that now, i can't reuse this code in reverse way like I would love to run them in shown as startMe2() { myFunction3(); myFunction2(); myFunction1(); } Can anyone help me how I can manage these functions and ensure the first function is complete before next function runs?
  13. Thanks for the reply! What if I would like to keep them separate though? Can I do that? Or is it safe to do that with above script? I think it is better if I just keep them separate for my own brain sake.
  14. I am trying to see if the following scripts need to be combined together or if i can just keep them in a separate script file. both script contains request permissions that takes user control. 1st script contains: llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS); run_time_permissions(integer permissions) llTakeControls(CONTROL_FWD|CONTROL_BACK|CONTROL_LEFT|CONTROL_RIGHT|CONTROL_UP|CONTROL_DOWN, 1, 1); 2nd script contains: llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS| PERMISSION_TRACK_CAMERA); run_time_permissions(integer permissions) llTakeControls(CONTROL_ML_LBUTTON, 1, 1); Any info will be appreciated.
  15. wow, that was something i was looking for! I knew there would be a better way to find the status of llCastRay. Thank you! @Fenix Eldritch
  16. I am trying to set up if statement when llCastRay returns nothing. But it is not working as I expected. I think llCastRay is still returning some results when it didn't find any hit. I have the following llCastRay: list myValue = llCastRay(start,end, [RC_REJECT_TYPES, RC_REJECT_LAND | RC_REJECT_PHYSICAL | RC_REJECT_NONPHYSICAL, RC_MAX_HITS,1]); Let's say that I want to see if the result of llCastRay that didn't hit anything. I was expecting that the list myValue would return nothing in this case. But noticed myValue was returning 0 instead. And the length of myValue was returning 1. Would the following 'if statement' be correct to see if llCastRay hit anything? if(llGetListLength(myValue) == 1) { llOwnerSay("No hit found!"); } else { llOwnerSay( "Yes! You hit " + (string)(llList2Key(myValue,0)) ); }
  17. I appreciate everyone for giving me some thoughtful answers
  18. Thank you all for sharing all the knowledge! I have decided to cast 3 rays with the same filter i mentioned in the very first post. It seems like the easiest solution i can come up with my given skills. speaking of the multiple rays, I came up with the following: list results1 = llCastRay(start+<0.5,1.5,0.5>, start+<60.0,1.5,0.5>*llGetCameraRot(),[RC_REJECT_TYPES, RC_REJECT_LAND | RC_REJECT_PHYSICAL | RC_REJECT_NONPHYSICAL, RC_MAX_HITS,2]); list results2 = llCastRay(start+<0.5,0.0,0.5>, start+<60.0,0.0,0.5>*llGetCameraRot(),[RC_REJECT_TYPES, RC_REJECT_LAND | RC_REJECT_PHYSICAL | RC_REJECT_NONPHYSICAL, RC_MAX_HITS,2]); list results3 = llCastRay(start+<0.5,-1.5,0.5>, start+<60.0,-1.5,0.5>*llGetCameraRot(),[RC_REJECT_TYPES, RC_REJECT_LAND | RC_REJECT_PHYSICAL | RC_REJECT_NONPHYSICAL, RC_MAX_HITS,2]); I am assuming that these are all parellel, and 1.5 meters apart from each other. But without the actual visualization of the ray, it is really hard to tell if I am going into the right direction??
  19. @animats Thanks for clarifications on the attachments. I feel like llCastRay was not the only answer to weapon system. I am recently exploring lsl scripting and more insight on this "touch detection" would be helpful. Could you give me some example syntax I could be using or any reference to lsl wiki page so where I can start reading documentation on touch detection? How does that concept exactly work? Does it detect anything that are touchable? @Wulfie Reanimator That is quite interesting that avatar would appear like a oblong sphere for cast ray. I thought it would be some kind of cube block or something.... So if I shoot multiple rays, i guess more than one rays could detect the same avatar. Does that mean those rays will report the victim multiple times and may take multiple damage while the victim actually got hit once?
  20. I am creating a simple weapon with llCastRay, I have the following following filters set for llCastRay: llCastRay(start, start+<60.0,0.0,0.0>*llGetCameraRot(), [RC_REJECT_TYPES, RC_REJECT_LAND | RC_REJECT_PHYSICAL | RC_REJECT_NONPHYSICAL, RC_DETECT_PHANTOM, FALSE, RC_DATA_FLAGS, RC_GET_ROOT_KEY, RC_MAX_HITS,1]); I assumed that this will allow my llCastRay to penetrate any objects until it finally hits an avatar. Then I realized there is a problem. I *think* llCastRay doesn't seem to detect the avatar if it happens to hit some physical attachments worn on the victim's av. Therefore, The victim doesn't register as getting a hit. Am I mistakened? What would be the best filter to put so that I would have a high chance to hit the Avatar and nothing else? llCastRay also shoots such a tiny ray that it is almost impossible to shoot someone who is moving around fast. aAe there any suggestions or advice i can take on how i can make it eaiser to shoot a victim?
  21. I have a HUD that receives messages thru llRegionSayTo. The problem is this message could be sent to my HUD from anyone who has the "message sender script". When I receive the message, I need to find a way to identify if this message is legit or not. For example, lets say the sender has the following script. default { touch_start(integer total_number) { integer ch = -99; key recieverskey = llDetectedKey(0); //this is me wearing the receiver HUD llRegionSayTo(recieverskey,-99,"this is the message."); } } I want to ensure this message is being sent from the item created by me. I want the receiver to be able to tell if the message sent to me is legit or not by seeing the creator of the item who sent the message. Lets say the receiver HUD has the following script: default { listen(integer chan, string name, key id, string msg) { if(chan == -99) { llOwnerSay("--------------------------------------"); llOwnerSay("sender's name is: " + name); llOwnerSay("sender's uuid is: " + (string)id); llOwnerSay("the message is: " + msg); } } } I know inserting a line of llGetCreator() won't let me tell the creator of the object who just sent the message to my HUD. Is there anyway to tell the creator? would there be anyway to identify that the message being sent to me is legit and came from the item I created??
×
×
  • Create New...