sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    'Stop Timer'-Help Needed

    Scheduled Pinned Locked Moved SketchyPhysics
    6 Posts 3 Posters 610 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.
    • M Offline
      MrPlanet
      last edited by

      I need the piston to stop, like a stopwatch after the visible box has been touched. Its for a racing game. Any ideas on how i can do it? (Everything in the .skp)


      HN.skp

      I reject your reality and substitute my own.

      1 Reply Last reply Reply Quote 0
      • H Offline
        hpnisse
        last edited by

        I used this code in the 'ontick'

        To start the "timer" press "A" (the SP Controll Panel must be visible and ontouched)

        
        if key("A")==1
         setVar("start",1)
         setVar("stop",0)
        end
        
        if getVar("start")==1
         setVar("time",getVar("time")+1)
        end
        
        if getVar("stop")==1
         setVar("start",0)
        end
        
        

        The timer stops when the box is touched by the ball
        and the timer also start again when you press "A" again.

        if you want to reset the timer every time you press "A" (or another key)
        put this line into the 'ontick' at the third line before the first 'end'.

        
         setVar("time",0)
        
        

        Hope this helps!:D


        this is the changed version

        ` /hpnisse`
        ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

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

          @hpnisse said:

          I used this code in the 'ontick'

          To start the "timer" press "A" (the SP Controll Panel must be visible and ontouched)

          
          > if key("A")==1
          >  setVar("start",1)
          >  setVar("stop",0)
          > end
          > 
          > if getVar("start")==1
          >  setVar("time",getVar("time")+1)
          > end
          > 
          > if getVar("stop")==1
          >  setVar("start",0)
          > end
          > 
          

          The timer stops when the box is touched by the ball
          and the timer also start again when you press "A" again.

          if you want to reset the timer every time you press "A" (or another key)
          put this line into the 'ontick' at the third line before the first 'end'.

          
          >  setVar("time",0)
          > 
          

          Hope this helps!:D

          Thanks, but it is not want i want, i want something that starts at fraem 0 and then the timer stops like a stopwatch when the box is touched, so, that is useful, but not what i want.

          I reject your reality and substitute my own.

          1 Reply Last reply Reply Quote 0
          • H Offline
            hpnisse
            last edited by

            Okey...

            change the first line

            
            if key("A")==1
            
            

            to

            
            if frame==0
            
            

            all script

            
            if frame==0
             setVar("start",1)
             setVar("stop",0)
            end
            
            if getVar("start")==1
             setVar("time",getVar("time")+1)
            end
            
            if getVar("stop")==1
             setVar("start",0)
            end
            
            

            This is exact that you searching for! (I hope)

            ` /hpnisse`
            ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

            1 Reply Last reply Reply Quote 0
            • P Offline
              phy
              last edited by

              Change the setVar('1',1) to setVar('timer',0).

              It should work.


              HN.skp

              Tableau de comparaison de Staxyn s'agit d'un mГ©dicament uniquement sur ordonnance.

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

                THANKS FOR ALL YOUR HELP!

                I reject your reality and substitute my own.

                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