sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Variables

    Scheduled Pinned Locked Moved SketchyPhysics
    4 Posts 3 Posters 547 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      Wacov
      last edited by

      Found out a bit more about ruby variables; turns out you can set variables properly without setVar or getVar:

      @var
      

      That's it! To set, use:

      @var=1
      

      You can't use it properly with onTouch, but once onUnTouch comes that won't be a problem either. The thing is, it's not working how it's supposed to; it's acting like a global variable. It should be specific to a certain object... technically, $var is a global variable, but it appears to work the same.

      http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

      1 Reply Last reply Reply Quote 0
      • M Offline
        MrPlanet
        last edited by

        Is that code there setVar or getVar subsitute ❓

        I reject your reality and substitute my own.

        1 Reply Last reply Reply Quote 0
        • W Offline
          Wacov
          last edited by

          It's just the ruby script way. I guess the @/@@/$ bit saves it, so it works between frames, unlike normal ruby variables

          http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

          1 Reply Last reply Reply Quote 0
          • C Offline
            CPhillips
            last edited by

            That will work. But you should be aware of a few things:

            Some variables names could cause things to break. For example @frame is already being used and if you override it could break things.

            If you use something like "@foo" the value will be the same for all objects. Same as getVar and setVar are now. But in a future version each object will have its own version of "@foo". So keep in mind that a model that uses "@foo" now will change behavior when that version comes out.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement