Jump to content

Naskiff

Resident
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

4 Neutral

About Naskiff

  • Rank
    Member

Recent Profile Visitors

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

  1. It absolutely is. Perspective is important here. Most of the people who wrote here seem to ignore the context. When you have never scripted or programmed and you want to make a small script, you just want to make something that works, at all, even if just partially. Your goal is not to become a professional programmer or scripter, you just want to make a small thing and call it your own. It doesn't matter if it's incomplete, bugged, bloated or laggy. You just want it to work at all. If you can make your cube say something else than "Touched." when you click on it, that's fun. If you can make it say the current SLT time, then wow, things are getting exciting! And if you can make it say the current time in your own time zone, that's another exciting step and it doesn't matter what the script looks like, as long as it works. That's how you start. To someone who never scripted or programmed before, they can't even know if they will be able to make their cube do that because everything seems so uncertain. In 8-10 hours of taking a good programming tutorial, you learn about data types like strings, you hopefully learn that integers and floats are treated as different and somewhat incompatible things, you learn about global and local variables, you learn that you CAN create your own functions, you learn that lists exist and that they can be used in creative ways, for example as a 2D grid or as dynamic memory. You learn the general idea of brackets, and you learn how functions and everything else are vaguely supposed to work together. Without this knowledge, you might write state_entry(){ llGetObjectName(); } and you will save. It will compile without errors, making you believe that you did this step right. The next step is to somehow access and display this information. You might try... touch_start(integer t){ llOwnerSay("My name is t");} or llOwnerSay("My name is "+t);} or llOwnerSay("My name is "+ObjectName");} or llOwnerSay("My name is "+llGetObjectName);} or llOwnerSay("My name is "+llGetObjectName(););} etc. You will try all these wild attempts at magic and fail fail fail and waste a great amount of time and effort. What truly matters is that you get some sense of direction. That's what the 8-10 hours are for. If you took a partial C# tutorial, state_entry() won't look so strange to you because you've seen it many times before and you vaguely know how to use it. On the wiki, you will vaguely know what kind of information that you need, what part of the page is pertinent to your current need, and if you copy/paste something, you will at least have a vague idea of what it actually does and where/how to use it in your script. You won't spend an hour doing trial and error trying to figure out where to copy/paste something or if you're even trying to copy/paste the right thing. Later you will stumble on some tricks like "position.y" or "string functionName(){" or "functionName(string height){" and you will leave them on the back-burner until the day where you find a reason to use them and learn them properly. As long as you're just trying to get a cube to tell you the SLT time, you won't need to learn & use any of that fancy stuff. With 8-10 hours, you haven't formed habits yet, and you certainly haven't learnt to depend on language-specific features. And LSL looks a lot like a simpler, more convenient version of C#, so it's easy to transition. That's exactly what spending 8-10 on a tutorial is for. It gives you a sense of how things work, it gets you started smoothly on your first projects, and you learn more and refine as you keep scripting. If your first project is a complex one, it will become a disgusting mess, but at least it will give you small victory after small victory and you will actually get to see your script DO things and evolve, instead of getting stuck at the start for hours, staring at a script that is completely unintelligible to you. My first script was something that would lock my earrings on me using RLV. I had no basics. Somehow with a lot of trial and error and many hours, I kinda got it to work to lock the specific item that had the script in it. I learned NOTHING from the experience.
  2. My experience has been that trying to understand how scripting works by reading scripts made by others is extremely frustrating and a waste of time if you have no basics. When all you want to do is make something undetachable or have it give a landmark to those who click on it, it feels like learning the basics is not worth the commitment, but it really is. Learning to code properly doesn't take long. Spend about 8-10 hours learning from a programming tutorial and you will have a solid, functional grasp on what is important. You don't need to finish the whole tutorial, it's just more efficient to spend a few hours going through a tutorial than it is taking hours trying to make a stupid function work in your script when it should only take a minute. Python was recommended earlier. I recommend C# because it's extremely similar to LSL, so it's easy to transition from C# to LSL. You don't need to make your script right now, it can wait. SL will still be here next week. So don't be in a hurry, learn this properly. It will also make scripting enjoyable, and it will serve you well in a few months when you get a new scripting idea. The tutorial I used is https://www.sololearn.com/Course/CSharp/ You don't need to complete it, but you will be thankful to yourself for every hour you spend on it.
  3. In retrospect it makes sense and it should be easy to remember because we read from left to right.
  4. Are you sure? ^^ Haha, to be honest, I made a short test before writing this just to be sure I wasn't giving a wrong information... integer goal = 3; integer count = 0; default { state_entry() { do { llOwnerSay((string)count); } while (++count < goal); } } The result is [17:16] Object: 0 [17:16] Object: 1 [17:16] Object: 2 and if I write count++ instead, the result is... [17:17] Object: 0 [17:17] Object: 1 [17:17] Object: 2 [17:17] Object: 3 I learned something from testing this a second time, I used to think ++count and count++ did the exact same thing in LSL. I was wrong about that. Edit: I get it now, I think I was wrong in my explanation. It took me a while to wrap my head around it! And Pixstudio, learning LSL by just looking at the code is really hard. Since you seem interested in learning, I would recommend taking a tutorial for either LSL, or C or C#. I learned with this one: https://www.sololearn.com/Play/CSharp. Getting started with LSL was easy after that.
  5. It's part of "do { } while ( )". It works like this: do { that } while (this is true). What the script does: Keep rezzing copies of this object while it remains true that iCounter is smaller than iMax. It's called Do while, on this page. http://wiki.secondlife.com/wiki/Category:LSL_Flow_Control ++iCounter means every time the script reaches this point, it takes iCounter's value (at first, zero) and adds +1 to it for the next time. So it runs until the script reaches iCounter while its value is 10, in which case it's no longer smaller than iMax.
  6. Wow... you're good! It was exactly that. It's indeed next to the sim border, and using a timer for llSensor fixed it. I tested in a populated sim, and then back to the home, and it works as I needed it to. Thank you!
  7. integer sensorDetected = 0; default { state_entry() { llSensorRepeat("","",AGENT,35,PI,3.0); } sensor(integer detected) { if (sensorDetected == 0) { sensorDetected = 1; llOwnerSay("Someone is nearby."); } } no_sensor() { if (sensorDetected == 1) { sensorDetected = 0; llOwnerSay("Nobody is nearby."); } } } This script, when worn, should tell me only once whether there is someone nearby or not, until there is a change in whether there is someone or not. This script works everywhere I have been, except at my friend's home on the main land. If I stand there without moving and nobody else is around, every 3 seconds I receive one of the two messages. Nobody is nearby. Someone is nearby. Nobody is nearby. Someone is nearby. Nobody is nearby. Someone is nearby. ... I thought maybe it comes from a nearby item even though it's scanning for agents... so I went a few meters high in the sky where the nearest item is hundreds of metres away, and I still get the message spam, so it's about X Y and not Z positioning. If I walk to the neighboring parcels far enough, it doesn't spam anymore. If someone else is there, it works fine. If I TP out, it works fine in that other sim... As soon as I TP back and there is nobody there, it spams the messages again. I tried PI/2. When someone is nearby and I face them, they are detected once. If I don't face them, they are not detected, again once. That's working as intended. But I need a 360° scan. Doing PI/1 doesn't change anything, it behaves in the same spammy way. The parcel's "options" are 100% health, avatars inside this parcel cannot be seen, Health, no flying, no voice. The spam happens to whoever wears this script in that zone. I have another object there that scans the region occasionally, so I rezzed it in another place to see if causes the spam. It does not. Any ideas? I realize it's not exactly a scripting question, but I don't know a better place to ask. Edit: I have changed it to llInstantMessage to rez it at the home and TP away. It never spams, it works as intended. So the weird loop happens when I'm wearing it and there is nobody else around and I'm at this specific home.
  8. I am trying to detect non-physical objects, not myself. ^^ I want the script to bump me up a little when I "collide" with a certain non-physical object. Without the script, I just walk through that object. But yes it's only intended to be used by myself.
  9. Indeed, I will do something to deal with multiple detections. I tend to start with something stripped out like this and build on top of it. Thank you.
  10. It did not change the result, but I have found a solution. I really don't understand why it changes anything, but I needed to add while(num_detect--) inside sensor(). Thank you for you time!
  11. I am trying to scan a nearby scripted object to get its object name. I figure getting its key would be a good start... Could someone please explain why this sensor keeps returning a NULL key when it detects an object? "I detect 00000000-0000-0000-0000-000000000000" What I'm actually trying to accomplish is, I want to wear this sensor. When I walk into a small, non-physical item that has a particular name, it will change my hover height to a predetermined value to make it seem like I'm standing on it normally. key id; default { state_entry() { llSensorRepeat("","",SCRIPTED,1,PI,2); llOwnerSay("beep"); } sensor(integer num_detect) { id = llDetectedKey(num_detect); llOwnerSay("I detect "+(string)id); } no_sensor() { llOwnerSay("no detect"); } }
×
×
  • Create New...