Jump to content

Estelle Pienaar

Resident
  • Posts

    143
  • Joined

  • Last visited

Everything posted by Estelle Pienaar

  1. Hello, I have made a user defined function that does not bring the same result as writing the function each time separately in the script. I might have made a mistake but don't see what it could be. The script snippet should cycle through a list by deleting the first value of a list and then adding it to the end of the list. In this example this is done with two separate lists at the same time: list content1 = ["1","2","3","4","5"]; list content2 = ["a","b","c","d","e"]; default { state_entry() { llSetTimerEvent(5); } timer() { //script cycles the first list if(llGetListLength(content1) > 0) { //script saves the first entry of the list string first_entry = llList2String(content1, 0); //script deletes the first entry of the list content1 = llDeleteSubList(content1, 0, 0); //script adds deleted first entry to the end of the list content1 += first_entry; llOwnerSay("Debugging. New list order is: " + llList2CSV(content1)); } //script cycles the the list if(llGetListLength(content1) > 0) { //script saves the first entry of the list string first_entry = llList2String(content2, 0); //script deletes the first entry of the list content2 = llDeleteSubList(content2, 0, 0); //script adds deleted first entry to the end of the list content2 += first_entry; llOwnerSay("Debugging. New list order is: " + llList2CSV(content2)); } } touch_end( integer num_detected ) { llSetTimerEvent(0); } } This snippet works as expected. Then I have made a user defined function but here the script will only delete the first entry of the list and put it at the end of the list at the very first iteration. After that, the list gets "stuck" and is not changed anymore at each timer event. cycleList (list c_list) { if(llGetListLength(c_list) > 0) { string first_entry = llList2String(c_list, 0); c_list = llDeleteSubList(c_list, 0, 0); c_list += first_entry; llOwnerSay("Debugging. New list order is: " + llList2CSV(c_list)); } } list content1 = ["1","2","3","4","5"]; list content2 = ["a","b","c","d","e"]; default { state_entry() { llSetTimerEvent(5); } timer() { //script cycles the first list cycleList (content1); //script cycles the the list cycleList (content2); } touch_end( integer num_detected ) { llSetTimerEvent(0); } } Can anyone spot the mistake, that I am making? I don't get it.
  2. Ok, I found this and it answers the question negatively. I really think that ending an animation while it is playing is ugly and makes the Second Life experience worse. But there is nothing that can be done.
  3. I am planning to script an animation overrider. It would be great to let each animation play exactly as long as it is and not interrupt them after an x amount of time. However I cannot find any way to find out how long an animation is. Neither by script nor by any other means. That is certainly a big oversight by the Lab and the information certainly is available with the saved animation on the servers, but it does not get visible to the users. Or is there a way to make it visible?
  4. Thanks, it works like a charm, once my scripting was correct. 😁
  5. This script will switch on and off a projector. In order for the light to act like projector, the value for PRIM_FULLBRIGHT should be FALSE (unlike with point light): integer isLightTurnedOn; default { state_entry() { llSetPrimitiveParams([ PRIM_PROJECTOR, "TextureName", 3, 10, 0.5 ]); } touch_start(integer total_number) { isLightTurnedOn = !isLightTurnedOn; vector COLOR_White = <1.00, 1.00, 1.00>; if (isLightTurnedOn){ llSetPrimitiveParams([ PRIM_FULLBRIGHT, ALL_SIDES, FALSE, PRIM_POINT_LIGHT, TRUE, COLOR_White, 1.0, 10.0, 0.6]); } else{ vector COLOR_White = <1.00, 1.00, 1.00>; llSetPrimitiveParams([ PRIM_FULLBRIGHT, ALL_SIDES, FALSE, PRIM_POINT_LIGHT, FALSE, COLOR_White, 1.0, 10.0, 0.6]); } } }
  6. Thank you for your ideas. I will try and see if I can "switch on" a projector via a script event by first making it a point light and then defining a projector flag in a second step.
  7. I am looking into projectors at the moment and the only LSL command that I can find is llSetPrimitiveParams and the flag [ PRIM_PROJECTOR ]. Unlike the flag [ PRIM_POINT_LIGHT ] the prim_projector flag does not contain a boollean for FALSE or TRUE. Does that mean that there is no way to switch on or off a projector via touch and the only way to change it is by editing the object and do it in the edit window via the features tab? This would be a serious problem IMHO, now that PBR will look more dynamic and interesting by placing more projectors. But maybe I am overlooking something?
  8. Thank you very much for your replies and sorry for my late answer. I was travelling and couldn't come back earlier. Now I am happy to look into it. Yay!
  9. Hello, I cannot find a function call that would change the access list of a parcel. However the existence of this script seems to suggest that it should be possible? Second Life Marketplace - Total Land Access! Prevent people ENTERING your land! My dream would be to script an object that checks if I am home and then restricts access to my parcel but allows access to anyone when I am not in the parcel. Doing this manually is a pain.
  10. Just one update: Everything works find apart from playing animations when getting from the Animation State "Standing" to Animation State "Turning", despite the animation being priority 5 and it being displayed in Animation info. Also I can not reproduce what I said before. It is not working in all viewers, there is no more difference between SL or BD viewer. I think I will open a JIRA.
  11. This is for smiles, not a serious discussion! Who cannot relate?
  12. So after some more testing, my experience has been that it seems to be the contrary. The animations need to be stopped by the script, even if they should continue to run in another state and then be called again. That makes it much more reliable. If I do not stop the previous (same) animation from another animation state, it will often time not play in the new animation state (even if it is a higher priority). Moreover: If I test with the script with llGetAnimationList( key avatar ); , I will get a positive response saying that the animation is still playing, but it is not. One more remark: It is strange, that I can check for playing animations only by their keys while I can start animations only by the string name. Or is there a way to start an animation by its key and not its name? But this question is at this point rather theoretical, since the function llGetAnimationList seems not to be reliable anyway. I have given up on that step. I just stop the old animation and call for it in every animation state update, even if that is quite inefficient. But it works (for about 95% of animation state changes).
  13. I am still playing around and changing the script, but I have not been able to fix this particular part. As soon as I think that the script cannot be changed anymore, I will make a full perm version of script and animations for you available, so that you can test yourself. It is very well possible that the difference stems from the lower threshhold before playing the turn.
  14. Thank you very much, I will look into it! What I can already say is, that it really works differently in the Second Life viewer. There I don't have problems when switching between turns and . But Black Dragon viewer never plays it in this case. On the other hand the Black Dragon viewer almost always shows the priority 4 walking animation (I'd say 95% of the time it works) while the Second Life viewer almost never shows it (I'd say 30% of the time it works). I did not expect such differences between viewers. That means that I additionally might have to create another priority 5 animation, probably.
  15. You are right, one animation for walking and running with the wand was only priority 4. The other one for standing is priority 5. I have set the timer to 0.25 seconds instead of 0.1 seconds. Now it works quite ok. However I realised that if I switch from turning left to turning right or from turning right to turning left, it will always fail to play (despite this animation being priority 5). If I check with list anims = llGetAnimationList(owner); if(~llListFindList(anims, check)) if the animation is playing during the turn it gives me a positive, but it is not visible. It might be a problem specific to the Black Dragon viewer. Will check that later.
  16. While writing this post, I had the idea that the script might get confused that I use the same animation for "Standing" and "Turning". So I added another copy of the same animation with a different name. I renamed the two instances of the same animation "wand-standing" and "wand-turning". Now the switch between "Standing" and "Turning works. However the following problem remains: (1) The "wand" animations plays reliably with "standing". (2) The "wand" animation plays approximately 4 out of 5 times when "walking" or "running". (3) The "wand" animation plays NOW approximately 4 out of 5 times when "turning". EDIT: I made now 5 instances of the 2 animations as "wand-walk", "wand-run", "wand-stand", "wand-turn-l", "wand-turn-r" to make sure that the reason for the animation sometimes not starting in some animation states is not due to using the same animation with the same name in different states. But the problem remains.
  17. So in order to have the wand holding up in a mele fight, I have created wand holding animations that are added to the animations of the AO. These animations should be played when walking, running, standing and turning. The following snippet is what I have so far. It does reliably realize when the animation state changes and always gives the correct message in chat, e.g. "You started walking". However the animations are not played reliably. I don't think that it is a problem of the animation priorities because they do play for all animations, just not all of the time. Here is what I am experiencing: (1) The "wand" animations plays reliably with "standing". (2) The "wand" animation plays approximately 4 out of 5 times when "walking" or "running". (3) The "wand" animation plays only when turning when coming from a "walking" or "running" state. It never plays when I have been "standing" before. It's a riddle why the changes of the animation states are reliably called out in chat, but the animations are not played reliably. key ownerK; integer timernumber; integer movementstate; string gLastAnimation; string newAnimation; string Lanimation = "wand-attackV2"; default { state_entry() { ownerK = llGetOwner(); llSetTimerEvent (0.1); } timer () { if (gLastAnimation == "0") {gLastAnimation = llGetAnimation(ownerK);} else { newAnimation = llGetAnimation(ownerK); if (gLastAnimation != newAnimation) { if (newAnimation == "Walking") { llStopAnimation (Lanimation); llStartAnimation("wand- walkV3b"); llOwnerSay("You started walking"); gLastAnimation = "Walking"; Lanimation = "wand- walkV3b"; } else if (newAnimation == "Running") { llStopAnimation (Lanimation); llStartAnimation("wand- walkV3b"); llOwnerSay("You started running"); gLastAnimation = "Running"; Lanimation = "wand- walkV3b"; } else if (newAnimation == "Standing") { llStopAnimation (Lanimation); llStartAnimation("wand-attackV2"); llOwnerSay("You are standing"); gLastAnimation = "Standing"; Lanimation = "wand-attackV2"; } else if (newAnimation == "Turning Left") { llStopAnimation (Lanimation); llStartAnimation("wand-attackV2"); llOwnerSay("You are turning left"); gLastAnimation = "Turning Left"; Lanimation = "wand-attackV2"; } else if (newAnimation == "Turning Right") { llStopAnimation (Lanimation); llStartAnimation("wand-attackV2"); llOwnerSay("You are turning right"); gLastAnimation = "Turning Right"; Lanimation = "wand-attackV2"; } } }
  18. Oh wow, I didn't realize that SL even differentiates between global and local x-axis. I will look into that. Silly me!
  19. Thank you for all the suggestions and for pointing me to Cornerstone. I have started my rant to early... ❤️
  20. Thanks a lot for the first part of the response. Indeed you are right that the sensor does not originate from the attached prim, but from the center of the avatar. The lsl Wiki could be more specific at this point. But now I know that a simple sensor called from an attached will be sufficient for the player agent. I also tested and the PI/4 arc is not sufficiently wide. It needs to be PI/3. So for that part my headaches are solved! I don't however understand the second part of your response. This would only work if the NPC does not move and rotate at all, wouldn't it? But in the concept of the game the agent and the NPC object will move and rotate constantly towards each other. So also the sensor that originates from the NPC would have to rotate with the NPC. But an LSL sensor originating from an object would constantly only point towards the x-axis, ignoring any rotation of the object. Or do I get something wrong?
  21. Thank you very much for these ideas! It is best to know as many options before investing too much time into one way of implementing only to turn around after half of the way!
  22. Thank you very much for the hint that the SL simulator might not know the attachment position. I will do some tests and see if a simple sensor will do! I guess that all scripters are ok to pretty good with math. But geometry is just not my love affair and if I can avoid it... 😂
  23. All mele combat systems that I have ever tried in SL (I have to admit that I haven't tried many) where very clunky. Mostly they consisted of trying to move in front of target and click the left mouse button as often as possible. There are no real movement combinations for attacks or defense. As I have the project to script a mele combat system, I would like to see what my options are. The big problem for implementing more refined combat moves seems to be that it is impossible to assign other keys than the typical movement keys and the two mouse buttons to be detected by an LSL script. But the movement keys are already needed for the movement during a fight. So if I wanted to assign an attack to the key "G" on the keyboard and have it recognised by the script, it is literally impossible. Or are there any practical workarounds? As far as I can see my only options are: (1) measuring how long the left mouse button is clicked and assign two different attacks depending on if it is clicked long or short. (2) Creating a HUD with different buttons and the player would have to click different buttons for different attacks. Not userfriendly at all. (3) Assign attacks and dodging to keys that are not frequently used during normal SL movement. This could be used for dodging: CONTROL_DOWN 0x00000020 Move down control (PgDn or C) This could be used for attack combinations: CONTROL_LEFT 0x00000004 4 move left control (shift + A or left arrow) CONTROL_RIGHT 0x00000008 8 move right control (shift + D or right arrow) Why has Linden Lab never implemented the possibility to llTakeControl of another keyboard key that is not used for movement? That would have opened up so many opportunities, not just for combat systems, but also other interactive content. It's a riddle to me why Linden Lab sees all the clunky mele combat systems in SL and says: Yes, that is how content on our platform should be. Creators clearly have all the tools they need at their disposal. 😅 Or am I missing anything?
×
×
  • Create New...