Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

LiquidBounce Forum

  1. Home
  2. ScriptAPI
  3. Help pls pls

Help pls pls

Scheduled Pinned Locked Moved ScriptAPI
3 Posts 2 Posters 315 Views
  • 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 DommeI Offline
    Its DommeI Offline
    Its Domme
    wrote on last edited by
    #1

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

    ? 1 Reply Last reply
    0
    • Its DommeI Its Domme

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

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      @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 DommeI 1 Reply Last reply
      0
      • ? 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 DommeI Offline
        Its DommeI Offline
        Its Domme
        wrote on last edited by
        #3

        @cancernameu Thank you very much, helped a lot

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        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
        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups