[HELP] Converting Core scripts to Script API v2 scripts.
-
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.
-
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) -
i used to port CzechHek's scripts all of the time, i don't really like core
-
@skiddermaster412 After testing this, it did not work. I'm trying to fix it by reading more scripts. Thank you for your help though.
-
@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 -
i just realized something
cant find setSafeWalk in the docs idfk
-
@sigma-bot apparently its from api v1
https://github.com/CCBlueX/LiquidScript/blob/master/ScriptAPI-v1 Docs/module/event.md
-
@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
-
This post is deleted!