Navigation

    CCBlueX Forum

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

    Help pls pls

    ScriptAPI
    2
    3
    61
    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

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

        @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 @cancernameu last edited by

          @cancernameu Thank you very much, helped a lot

          1 Reply Last reply Reply Quote 0
          • First post
            Last post