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] Converting Core scripts to Script API v2 scripts.

[HELP] Converting Core scripts to Script API v2 scripts.

Scheduled Pinned Locked Moved Unsolved ScriptAPI
11 Posts 6 Posters 991 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.
  • G Offline
    G Offline
    GolikeAzzis
    wrote on last edited by
    #1

    Hi, so I need help converting a Core script to the normal Script API version. I am using a custom build of Liquidbounce (Lint), so Core scripts don't work on it (From what I noticed). And I'm a complete noob at scripting.

    What do I need to do to convert this script from Core to the normal API v2 version?

    This script is by CzechHek

    ///api_version=2
    (script = registerScript({
        name: "AutoSafeWalk",
        version: "1.3",
        authors: ["CzechHek"]
    })).import("Core.lib");
    
    module = {
        category: "Movement",
        description: "SafeWalk that activates if there is a gap exceeding maximal fall distance.",
        values: [
            airsafe = value.createBoolean("AirSafe", true),
            maxfalldistance = value.createInteger("MaxFallDistance", 5, 0, 255)
        ],
        onMove: function (e) {
            (mc.thePlayer.onGround || airsafe.get()) && e.setSafeWalk(!isAboveGround());
        }
    }
    
    function isAboveGround() {
        for (i = 0, bp = new BlockPos(mc.thePlayer); i++ < maxfalldistance.get();) if (!mc.theWorld.isAirBlock(bp.down(i))) return true
    }
    

    This is what I could figure out so far from studying the normal API v2 scripts. (No, it doesn't work after I tested it.)

    ///api_version=2
    var script = registerScript({
        name: "AutoSafeWalk",
        version: "1.3",
        authors: ["CzechHek"]
    });
    
    script.registerModule({
        name: "AutoSafeWalk"
        category: "Movement",
        description: "SafeWalk that activates if there is a gap exceeding maximal fall distance.",
        values: [
            airsafe = value.createBoolean("AirSafe", true),
            maxfalldistance = value.createInteger("MaxFallDistance", 5, 0, 255)
        ],
        onMove: function (e) {
            (mc.thePlayer.onGround || airsafe.get()) && e.setSafeWalk(!isAboveGround());
        }
    });
    
    function isAboveGround() {
        for (i = 0, bp = new BlockPos(mc.thePlayer); i++ < maxfalldistance.get();) if (!mc.theWorld.isAirBlock(bp.down(i))) return true
    }
    

    I apologize in advance if I sound stupid.

    CzechHekC 1 Reply Last reply
    0
    • skiddermaster412S Offline
      skiddermaster412S Offline
      skiddermaster412
      wrote on last edited by
      #2

      you nearly in the right path,
      see how the other scripts work.
      you are far away from converting the script
      here take it, just to educate you and not to steal it.

      ///api_version=2
      var script = registerScript({
          name: "AutoSafeWalk",
          version: "1.3",
          authors: ["CzechHek"]
      });
      var airsafe = Setting.boolean({
          name: "AirSafe",
          default: true
      });
      var maxfalldistance = Setting.integer({
          name:"MaxFallDistance",
          default: 5,
          min: 0,
          max: 255
      });
      script.registerModule({
          name: "AutoSafeWalk"
          category: "Movement",
          description: "SafeWalk that activates if there is a gap exceeding maximal fall distance.",
          settings: {
              airsafe: airsafe,
              maxfalldistance: maxfalldistance
          }
      }, function (module){
          module.on("move", function(e){
              (mc.thePlayer.onGround || airsafe.get()) && e.setSafeWalk(!isAboveGround());
          });
      });
      
      function isAboveGround() {
          var BlockPos = Java.type("net.minecraft.util.BlockPos");
          for (i = 0, bp = new BlockPos(mc.thePlayer); i++ < maxfalldistance.get();) if (!mc.theWorld.isAirBlock(bp.down(i))) return true
      }
      

      compare and see what errors you had.
      (btw i made this without testing so if it works it works)

      G ? 2 Replies Last reply
      0
      • skiddermaster412S Offline
        skiddermaster412S Offline
        skiddermaster412
        wrote on last edited by
        #3

        i used to port CzechHek's scripts all of the time, i don't really like core

        1 Reply Last reply
        0
        • skiddermaster412S skiddermaster412

          you nearly in the right path,
          see how the other scripts work.
          you are far away from converting the script
          here take it, just to educate you and not to steal it.

          ///api_version=2
          var script = registerScript({
              name: "AutoSafeWalk",
              version: "1.3",
              authors: ["CzechHek"]
          });
          var airsafe = Setting.boolean({
              name: "AirSafe",
              default: true
          });
          var maxfalldistance = Setting.integer({
              name:"MaxFallDistance",
              default: 5,
              min: 0,
              max: 255
          });
          script.registerModule({
              name: "AutoSafeWalk"
              category: "Movement",
              description: "SafeWalk that activates if there is a gap exceeding maximal fall distance.",
              settings: {
                  airsafe: airsafe,
                  maxfalldistance: maxfalldistance
              }
          }, function (module){
              module.on("move", function(e){
                  (mc.thePlayer.onGround || airsafe.get()) && e.setSafeWalk(!isAboveGround());
              });
          });
          
          function isAboveGround() {
              var BlockPos = Java.type("net.minecraft.util.BlockPos");
              for (i = 0, bp = new BlockPos(mc.thePlayer); i++ < maxfalldistance.get();) if (!mc.theWorld.isAirBlock(bp.down(i))) return true
          }
          

          compare and see what errors you had.
          (btw i made this without testing so if it works it works)

          G Offline
          G Offline
          GolikeAzzis
          wrote on last edited by
          #4

          @skiddermaster412 After testing this, it did not work. I'm trying to fix it by reading more scripts. Thank you for your help though.

          1 Reply Last reply
          0
          • skiddermaster412S skiddermaster412

            you nearly in the right path,
            see how the other scripts work.
            you are far away from converting the script
            here take it, just to educate you and not to steal it.

            ///api_version=2
            var script = registerScript({
                name: "AutoSafeWalk",
                version: "1.3",
                authors: ["CzechHek"]
            });
            var airsafe = Setting.boolean({
                name: "AirSafe",
                default: true
            });
            var maxfalldistance = Setting.integer({
                name:"MaxFallDistance",
                default: 5,
                min: 0,
                max: 255
            });
            script.registerModule({
                name: "AutoSafeWalk"
                category: "Movement",
                description: "SafeWalk that activates if there is a gap exceeding maximal fall distance.",
                settings: {
                    airsafe: airsafe,
                    maxfalldistance: maxfalldistance
                }
            }, function (module){
                module.on("move", function(e){
                    (mc.thePlayer.onGround || airsafe.get()) && e.setSafeWalk(!isAboveGround());
                });
            });
            
            function isAboveGround() {
                var BlockPos = Java.type("net.minecraft.util.BlockPos");
                for (i = 0, bp = new BlockPos(mc.thePlayer); i++ < maxfalldistance.get();) if (!mc.theWorld.isAirBlock(bp.down(i))) return true
            }
            

            compare and see what errors you had.
            (btw i made this without testing so if it works it works)

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

            @skiddermaster412 do you even remember how to add a setting
            edit: nvm im retarded, the reason why it doesnt work its bcz you didnt import BlockPos
            edit 2:nvm im too retarded

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              i just realized something

              chrome_QCsZ62uzah.png

              chrome_kGAA4HPbPW.png

              cant find setSafeWalk in the docs idfk

              V 1 Reply Last reply
              1
              • ? A Former User

                i just realized something

                chrome_QCsZ62uzah.png

                chrome_kGAA4HPbPW.png

                cant find setSafeWalk in the docs idfk

                V Offline
                V Offline
                vinci
                wrote on last edited by
                #7

                @sigma-bot apparently its from api v1
                https://github.com/CCBlueX/LiquidScript/blob/master/ScriptAPI-v1 Docs/module/event.md
                7b8a7ad3-ffd0-4b6a-b2f0-c008af8a365e-image.png

                CzechHekC 1 Reply Last reply
                1
                • G GolikeAzzis

                  Hi, so I need help converting a Core script to the normal Script API version. I am using a custom build of Liquidbounce (Lint), so Core scripts don't work on it (From what I noticed). And I'm a complete noob at scripting.

                  What do I need to do to convert this script from Core to the normal API v2 version?

                  This script is by CzechHek

                  ///api_version=2
                  (script = registerScript({
                      name: "AutoSafeWalk",
                      version: "1.3",
                      authors: ["CzechHek"]
                  })).import("Core.lib");
                  
                  module = {
                      category: "Movement",
                      description: "SafeWalk that activates if there is a gap exceeding maximal fall distance.",
                      values: [
                          airsafe = value.createBoolean("AirSafe", true),
                          maxfalldistance = value.createInteger("MaxFallDistance", 5, 0, 255)
                      ],
                      onMove: function (e) {
                          (mc.thePlayer.onGround || airsafe.get()) && e.setSafeWalk(!isAboveGround());
                      }
                  }
                  
                  function isAboveGround() {
                      for (i = 0, bp = new BlockPos(mc.thePlayer); i++ < maxfalldistance.get();) if (!mc.theWorld.isAirBlock(bp.down(i))) return true
                  }
                  

                  This is what I could figure out so far from studying the normal API v2 scripts. (No, it doesn't work after I tested it.)

                  ///api_version=2
                  var script = registerScript({
                      name: "AutoSafeWalk",
                      version: "1.3",
                      authors: ["CzechHek"]
                  });
                  
                  script.registerModule({
                      name: "AutoSafeWalk"
                      category: "Movement",
                      description: "SafeWalk that activates if there is a gap exceeding maximal fall distance.",
                      values: [
                          airsafe = value.createBoolean("AirSafe", true),
                          maxfalldistance = value.createInteger("MaxFallDistance", 5, 0, 255)
                      ],
                      onMove: function (e) {
                          (mc.thePlayer.onGround || airsafe.get()) && e.setSafeWalk(!isAboveGround());
                      }
                  });
                  
                  function isAboveGround() {
                      for (i = 0, bp = new BlockPos(mc.thePlayer); i++ < maxfalldistance.get();) if (!mc.theWorld.isAirBlock(bp.down(i))) return true
                  }
                  

                  I apologize in advance if I sound stupid.

                  CzechHekC Offline
                  CzechHekC Offline
                  CzechHek
                  wrote on last edited by CzechHek
                  #8

                  @golikeazzis they work on it, however as far as I remember Lint had nothing special to offer, spammed errors of missing images in logs and its scriptapi somehow didn't fully work

                  garbage

                  G Painis BotP 2 Replies Last reply
                  0
                  • V vinci

                    @sigma-bot apparently its from api v1
                    https://github.com/CCBlueX/LiquidScript/blob/master/ScriptAPI-v1 Docs/module/event.md
                    7b8a7ad3-ffd0-4b6a-b2f0-c008af8a365e-image.png

                    CzechHekC Offline
                    CzechHekC Offline
                    CzechHek
                    wrote on last edited by
                    #9

                    @nvinci what does events have to do with scriptapi

                    1 Reply Last reply
                    0
                    • CzechHekC CzechHek

                      @golikeazzis they work on it, however as far as I remember Lint had nothing special to offer, spammed errors of missing images in logs and its scriptapi somehow didn't fully work

                      garbage

                      G Offline
                      G Offline
                      GolikeAzzis
                      wrote on last edited by
                      #10

                      @czechhek Oh okay, thanks.

                      1 Reply Last reply
                      0
                      • CzechHekC CzechHek

                        @golikeazzis they work on it, however as far as I remember Lint had nothing special to offer, spammed errors of missing images in logs and its scriptapi somehow didn't fully work

                        garbage

                        Painis BotP Offline
                        Painis BotP Offline
                        Painis Bot
                        wrote on last edited by
                        #11
                        This post is deleted!
                        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