CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Help pls pls

    ScriptAPI
    2
    3
    87
    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.
    • Its Domme
      Its Domme last edited by

      Please tell me how to make something happen something every second, two seconds or three

      ? 1 Reply Last reply Reply Quote 0
      • ?
        A Former User @Its Domme last edited by A Former User

        @its-domme

        this.onUpdate = function() {
            if(mc.thePlayer.ticksExisted % (1*20) == 0)
                do_stuff();
        }
        

        To give some context here, mc.thePlayer.ticksExisted is the amount of ticks (20 ticks = one second), x % y is a modulo operation, it takes the residue of x divided by y. == 0 checks if the modulo operation returns zero, i.e. x is divisible by y.

        So, since onUpdate runs every tick:
        Ticks = 1: false
        Ticks = 2: false
        Ticks = 3: false
        ...
        Ticks = 20: true
        The if statement now runs every time the amount of ticks the player has existed is divisible by 20, every second.

        Its Domme 1 Reply Last reply Reply Quote 0
        • Its Domme
          Its Domme @Guest last edited by

          @cancernameu Thank you very much, helped a lot

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          About
          • Terms of Service
          • Privacy Policy
          • Status
          • Contact Us
          Downloads
          • Releases
          • Source code
          • License
          Docs
          • Tutorials
          • CustomHUD
          • AutoSettings
          • ScriptAPI
          Community
          • Forum
          • Guilded
          • YouTube
          • Twitter
          • D.Tube