Second Life Scripting: Beginner 01 - Creating a Simple Switch

Поділитися
Вставка
  • Опубліковано 15 жов 2024

КОМЕНТАРІ • 39

  • @greenthumb-greywraith7426
    @greenthumb-greywraith7426 4 роки тому +5

    I would like to express my thanks for these tutorials you've uploaded. They've been a big help thus far in learning LSL. Keep up the good work and, thanks again!

    • @HumAiClub
      @HumAiClub 2 роки тому

      I also would like to express my thanks for these very helpful tutorials.

  • @juliamilovat
    @juliamilovat 28 днів тому

    Many, many thanks for making this crystal clear!

  • @teachertang
    @teachertang 9 місяців тому +1

    Thank you for the technique. I'm learning programming.

  • @RandomLabs
    @RandomLabs  11 років тому +1

    Glad to hear it! Yes, when they are broken down into small parts, scripts are not as complicated as they first appear!

  • @RobbeyT1
    @RobbeyT1 9 років тому +1

    Finally I get it...Thanks! Slowly (very slowly), working on a Hud that needs a small switch which will turn Black for off, and Red for on.

  • @DarkKingBowser
    @DarkKingBowser 9 років тому +2

    In college I did a lot of C++. I'm so glad those skills carry over...

  • @tommpimm
    @tommpimm 11 років тому +1

    great! ,this is the push I needed to finely try understanding LLscript.Thanx

  • @immigration007
    @immigration007 11 років тому +1

    very helpful. I kind of understand events now.

  • @RandomLabs
    @RandomLabs  9 років тому +2

    @3dmaster Thanks!
    In this case, the word 'switch' has been set up as a variable that can hold any whole numbers (aka, an integer variable).
    When I first set it up using 'integer switch;' its initial default value will be zero (unless I specifically set it otherwise, e.g. integer switch=1;). I use that zero value to represent the switch being off.
    And so, when you touch the object, it will ask the question if (switch==0) or in other words... is 'switch' currently set to zero?
    When that is true, the code directly beneath inside the parentheses { } will be executed, setting the switch to 1, which represents the switch being on.
    The next time the question is asked, if (switch==0) the answer will no longer be true, because we set the value of switch to 1 (to represent that the switch is now on)
    so instead, it will move on to the next question.. else if (switch==1).. or in other words.. Ok, so if switch isn't set to 0.. is it set to 1??
    Now this question will be true, and so the code in those parentheses will be executed instead, setting 'switch' back to zero again.
    Having said all of this, the code would work just fine if you wrote it all the other way around...so...
    if(switch==1)
    {
    switch=0;
    doOtherStuff;
    }
    else if (switch==0)
    {
    switch = 1;
    etc;
    }
    ...would also work perfectly fine. In this case, the fist time you clicked the object with switch still set at its default zero, it would skip over the false first question and instead go to the true 2nd question.
    I only wrote it down in that particular order as that's how my brain works I suppose :)
    In more complicated scenarios the order you step through your if-then-else logic may well become more important, but in this case either way would work fine.
    Hope that helps! :)

  • @YngPup
    @YngPup 3 роки тому +2

    the problem I am seeing with every person that does lessons on scripting is they do not explain what every little mark on a keyboard means or does.... I.E. what an asterisk ( * ) does or a slash ( / ) does or the meaning of what a comma ( , ) does beforehand... they just shoot straight into a lesson of writing scripting

  • @coolarine
    @coolarine 5 років тому +1

    Thank you so much ♡
    This video helped me a lot 😍

    • @coolarine
      @coolarine 5 років тому

      @steve gale i bought scripts from marketplace, but i didn't know how to add ... but after watching this i managed to do it..

    • @RandomLabs
      @RandomLabs  5 років тому +1

      Hi Steve, this was a script for absolute beginners, I wrote it this way so that people could clearly see that the if statement is asking the question "if switch is currently set at a certain value, do this and change that value". I would also point out that lsl doesn't actually have proper bools, and TRUE and FALSE are just integer constants with a value of 1 and 0. If it were me writing it for myself, I would actually use...
      if (switch =! switch) // flip the switch
      {
      //Do true stuff
      }else
      //Do false stuff
      }
      But again, this isn't as clear for absolute beginners who have zero concept of what any of this means. This code clearly isn't for you as you're clearly not an absolute beginner.
      Showing it this way also makes it clearer that you could do something like...
      if (switch == 1)
      {
      }
      else if (switch == 2)
      {
      }
      else if (switch == 3)
      {
      }
      etc.
      Seeing as lsl also doesn't have any sort of switch / case statement, again, this is more helpful for the absolute beginner in my opinion.

  • @Sphinx-productionsNl
    @Sphinx-productionsNl 8 років тому +2

    Nice! can this trick tobe used for HUD buttons that are transparant?

  • @RandomLabs
    @RandomLabs  11 років тому +1

    Cool! I'm attempting to upload episode 2 right now :)

  • @MManel
    @MManel 5 років тому +1

    Very good
    Thanks for share !...

  • @jourdymoretti9081
    @jourdymoretti9081 9 років тому +1

    Ok i'm looking for a way to write a scripts that is very specific and hoping that someone can point me in the right direction. I want to make a charm bracelet, so say you have the bracelet and you want to get a charm, i want you be able to touch that charm and add it to the bracelet. Does anyone know where or how I would look. I've asked people in SL but so far no responses.

  • @sabiatounjoya7308
    @sabiatounjoya7308 4 роки тому +2

    Thank you so MUCH! from SabiaLunaBitcoin.

  • @Nekotico
    @Nekotico 8 років тому

    dude, i have a question, im using a particle system, but i have a problem, the texture have a parameter that follow all the time the camera angle, i mean, every angle i see the texture, its all the time looking at me...what parameter do that? i wanna change it....im doing it for a car, so it let the whell mark in the floor, thanks good video!

    • @RandomLabs
      @RandomLabs  8 років тому

      Hey Nekotico. You need to look in to Ribbon particles. They are relatively new in SL and I haven't played with them much, but that's what you should be searching for :) This video show a good example of what you're looking for... ua-cam.com/video/qIjc5JkOgu8/v-deo.html and here is the wiki page for the particle system... wiki.secondlife.com/wiki/LlLinkParticleSystem#llLinkParticleSystem

  • @sniperunu7716
    @sniperunu7716 7 років тому

    how i can make the tatto appllier to not show me more error is work fidne but is show me the error and idk how to stopthet can somabry help me ?

    • @emilyjohnson6096
      @emilyjohnson6096 6 років тому

      sniper unu What. Do a try catch around the statement.

  • @gundanga
    @gundanga 8 років тому

    Why is every tutorial on LSL script the same. They all spend forever explaining the default state.

    • @RandomLabs
      @RandomLabs  8 років тому +2

      Level: Beginner. I was trying to explain the structure of things for people who have never touched code.

    • @gundanga
      @gundanga 8 років тому

      Random Labs Yeah I know but so have thousands of other people done since SL started. Search for any SL scripting tutorials and they all think the same as you and think. Anyone that is interested in scripting for SL damn well knows what the default state is because every tutorials spends forever explaining it and nothing new is learnt.

    • @RandomLabs
      @RandomLabs  8 років тому

      +famous porn superstar™ Have you tried including the words "intermediate" or "advanced" in your searches? I went for a beginner tutorial because I felt I might be good at explaining things in a way a total beginner would understand. Too many people make assumptions about the level of understanding of their audience and will skim over things that they assume will be understood because it's just second nature for the tutor.

    • @gundanga
      @gundanga 8 років тому

      Random Labs Yeah I have done searches for "intermediate" or "advanced" and they are just as painfully slow, irritating and dwell on the same old default states: Or they have no voice and have blurred video.

    • @gundanga
      @gundanga 8 років тому

      Random Labs People like me that mesh want to know how to change skin texture with scripts. but having said that I know someone that will help me learn such things.

  • @emilyjohnson6096
    @emilyjohnson6096 6 років тому +3

    SL is definitely broken script language

  • @wolflahti412
    @wolflahti412 2 роки тому

    "First of all, I'm going to create a cube."
    First of all, tell beginners how to create a cube. (Most tutorials say to right-click on the ground, but that just brings up an edit window for the ground object.)

    • @RandomLabs
      @RandomLabs  2 роки тому

      In the time it took you to write this comment, you could instead have just searched youtube for a beginners building tutorial. This is a beginners scripting tutorial.

  • @amyjames2077
    @amyjames2077 8 років тому

    Think I'll leave this to the experts.

  • @NuevoVR
    @NuevoVR 9 років тому

    this makes no fucking sense lmao.

    • @RandomLabs
      @RandomLabs  9 років тому

      What part are you having trouble with Kuuro? Feel free to ask a question if you have one!

    • @NuevoVR
      @NuevoVR 9 років тому

      its not your fault its just my poor understanding ahaha

    • @NuevoVR
      @NuevoVR 9 років тому

      just trying to become familiar with LSL so I can edit scripts.