CCBlueX Forum

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

    [Script]Some Script Example for scriptAPI V2 (lb b72+)

    Scripts
    7
    7
    620
    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.
    • As丶One
      As丶One last edited by Temm

      ExampleModule

      /// api_version=2
      var script = registerScript({
          name: "ExapmleScript",
          version: "1.0",
          authors: ["As丶One"]
      });
      
      script.on("enable", function () {});
      
      script.on("disable", function () {});
      
      script.on("load", function () {});
      
      script.registerModule({
          name: "ExapmleModule",
          description: "ExapmleModule By As丶One",
          category: "Fun",
          tag: "I am a tag",
          settings: {
              Boolean: Setting.boolean({
                  name: "BooleanValue",
                  default: true
              }),
              Integer: Setting.integer({
                  name: "IntegerValue",
                  default: 5,
                  min: 0,
                  max: 10
              }),
              Float: Setting.float({
                  name: "FloatValue",
                  default: 3.24,
                  min: 0.01,
                  max: 6.25
              }),
              Text: Setting.text({
                  name: "TextValue",
                  default: "TextValue"
              }),
              Block: Setting.block({
                  name: "BlockValue",
                  default: 26
              }),
              List: Setting.list({
                  name: "ListValue",
                  values: ["Hi", "Hello"],
                  default: "Hello"
              })
          }
      }, function (module) {
          module.on("enable", function () {
              module.settings.Text.set("Hi,I am enabled")
              module.tag = "Enabled"
              chat.print(module.settings.Text.get())
          });
          module.on("disable", function () {
              module.settings.Text.set("Hi,I am disabled")
              module.tag = "Disabled"
              chat.print(module.settings.Text.get())
          });
          module.on("update", function () {});
          module.on("motion", function (event) {
              var eventState = event.getEventState()
          });
          module.on("render2D", function (event) {
              var partialTicks = event.getPartialTicks()
          });
          module.on("render3D", function (event) {
              var partialTicks = event.getPartialTicks()
          });
          module.on("packet", function (event) {
              //event.cancelEvent()
              //event.isCancelled()
              var packet = event.getPacket()
          });
          module.on("jump", function (event) {
              /*
              event.cancelEvent()
              event.isCancelled()
              var motion = event.getMotion()
              event.setMotion(0.42)
              */
          });
          module.on("attack", function (event) {
              var targetEntity = event.getTargetEntity()
          });
          module.on("key", function (event) {
              var pressedKey = event.getKey()
          });
          module.on("move", function (event) {
              /*
              var x = event.getX()
              var y = event.getY()
              var z = event.getZ()
              var isSafeWalk = event.isSafeWalk()
              event.setX(0)
              event.setY(0)
              event.setZ(0)
              event.setSafeWalk(true)
              event.zero()
              event.zeroXZ()
              event.cancelEvent()
              */
          });
          module.on("step", function (event) {
              var stepHeight = event.getStepHeight()
          });
          module.on("stepConfirm", function () {});
          module.on("world", function (event) {
               var worldClient = event.getWorldClient()
          });
          module.on("session", function (event) {});
          module.on("clickBlock", function (event) {
              var clickedBlock = event.getClickedBlock();
              var enumFacing = event.getEnumFacing()
          });
          module.on("strafe", function (event) {
              var strafe = event.getStrafe();
              var forward = event.getForward();
              var friction = event.getFriction();
              //event.cancelEvent()
          });
          module.on("slowDown", function (event) {
              var strafe = event.getStrafe();
              var forward = event.getForward();
              //event.setForward(1);
              //event.setStrafe(1);
          });
      });
      

      ExampleCommand

      /// api_version=2
      var script = registerScript({
          name: "ExapmleScript",
          version: "1.0",
          authors: ["As丶One"]
      });
      script.registerCommand({
          name: "ExampleCommand",
          aliases: ["ExampleCommand"]
      }, function (command) {
          command.on("execute", function (args) {
              chat.print("Jump !")
              mc.thePlayer.jump();
          });
      });
      

      ExampleTab

      /// api_version=2
      var script = registerScript({
          name: "ExapmleScript",
          version: "1.0",
          authors: ["As丶One"]
      });
      script.registerTab({
          name: "ExampleTab",
          icon: "apple",
          items: [
              Item.create("dirt"),
              Item.create("skull 1 3 {display:{Name:\"Chimney\"},SkullOwner:{Id:\"2a0069a3-30a6-4aa6-b0ae-d31f1bd777f3\",Properties:{textures:[{Value:\"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjk5NTljYjk5YzY5ZjA3MzE2YWUxNGY4OWVlMjU0YTAwMzRkOTFkMThiMTZmMGM5NDBiOTNjZDUzMjUzNjQ1MSJ9fX0=\"}]}}}")
          ]
      });
      

      Offical Example Scripts:https://github.com/CCBlueX/LiquidBounce-ScriptAPI/tree/master/examples
      Offical Documentation:https://liquidbounce.net/docs/ScriptAPI/Getting Started

      1 Reply Last reply Reply Quote 1
      • ChocoPie_isme
        ChocoPie_isme Banned last edited by

        cool (fuck my comment need to have 8 characters or more)

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

          pretty good

          1 Reply Last reply Reply Quote 0
          • Temm
            Temm Moderator last edited by Temm

            Scripts that use the New Script API should start with the following line:

            /// api_version=2
            

            If this line is missing, the script will be ran with legacy support, and might not work correctly.
            I have edited your post to respect this.

            CzechHek 1 Reply Last reply Reply Quote 0
            • ButterChicken
              ButterChicken last edited by

              thank you 🙂

              1 Reply Last reply Reply Quote 0
              • CzechHek
                CzechHek @Temm last edited by

                @Temm You should actually make it check if first line contains api_version=2 not that it is equals to /// api_version=2

                Senk Ju 1 Reply Last reply Reply Quote 0
                • Senk Ju
                  Senk Ju Admin @CzechHek last edited by

                  @CzechHek We do that in b73: https://github.com/CCBlueX/LiquidBounce/blob/master/1.8.9-Forge/src/main/java/net/ccbluex/liquidbounce/script/Script.kt#L126

                  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