[SCRIPT BASE] Core 4.11 - Simple, yet powerful ScriptAPI base
-
Released Core 3.24
-
Added support for custom auto update urls.
Core.updateURL = "arawlink.com/smth.js" or you can disable updates: Core.updateURL = "" or Core.updateURL = false or null or smth like that
- Added TextEditor util. You can edit text files with it:
editor = new TextEditor(new File("smth.txt")); editor.text = "cool" or editor.setText("cool") editor.getText() == editor.text == "cool" editor.file == new File("smth.txt") editor.file = new File("smthelse.txt") or editor.setFile(new File("smthelse.txt"))
- Prevented creation of global variables after use of specific Core utils.
- Improved legacy support. (fixed autoupdates, names of scripts, modules, ...)
- Fixed CME crash when script updated during a reload.
-
-
Update 3.25
-
@plumer-man Yep, I'm only posting about important updates.
-
Core 3.28 brings artificial events!
All events are available for you
Thanks to @commandblock2 for giving me this idea, you can now use all events implemented in LiquidBounce, such as:
- onBlockBB
- onClientShutdown
- onEntityMovement
- onPushOut
- onRenderEntity
- onScreen
- onText
- onTick
Here is an example from https://github.com/CzechHek/Core/blob/master/Examples/artificial events.js
///api_version=2 (script = registerScript({ name: "ArtificialEvents", authors: ["CzechHek"], version: "1.0" })).import("Core.lib"); module = { onBlockBB: function (e) { var x = e.getX(), y = e.getY(), z = e.getZ(), block = e.getBlock(), bb = e.getBoundingBox(); e.setBoundingBox(bb.expand(0, 0.5, 0)); }, onClientShutdown: function () {}, onEntityMovement: function (e) { var entity = e.getMovedEntity(); }, onPushOut: function (e) { e.cancelEvent() }, onRenderEntity: function (e) { var entity = e.getEntity(), x = e.getX(), y = e.getY(), z = e.getZ(), yaw = e.getEntityYaw(), partialTicks = e.getPartialTicks(); }, onScreen: function (e) { var screen = e.getGuiScreen(); }, onText: function (e) { if (mc.thePlayer) { var text = e.getText(); e.setText(text.replace(mc.thePlayer.getName(), "axolotlus")); } }, onTick: function () {} }
-
-
@czechhek said in [SCRIPT BASE] Core 3.28 - Simple, yet powerful ScriptAPI base:
onClientShutdown
-
-
@fartcheese
Java.type("java.lang.Runtime").getRuntime().addShutdownHook( new Thread(function() { var editor = new TextEditor(new File("wtf.txt")); editor.text = "The process has been terminated." }) );
Works but I don't think that using Runtime isn't sus in scripting base scenario.
However I could make it call onClientShutdown event if you wanted.
Edit: For some reason it doesn't do anything probably because it is on other thread, however normal onClientShutdown detects process termination from Task Manager, so I will leave it like it is. Additionally, when I was doing stuff around this I noticed that you cannot call the new "artificial events" using built-in
callEvent
util, so I made them register into ScriptModule's event register as well. -
-
Core 4 brings new commands API
Reworked the whole Core Commands API. You can now specify arguments that are required as function parameters. Multiple arguments count can be accounted for by using array of functions with different parameter count. Look at some examples to learn how it works.
- https://github.com/CzechHek/Core/blob/master/Scripts/ValueBinder.js
- https://github.com/CzechHek/Core/blob/master/Scripts/Manager.js
- https://github.com/CzechHek/Core/blob/master/Examples/complex command.js
- https://github.com/CzechHek/Core/blob/master/Examples/simple command.js
Core Updater now prints latest commit information in update dialogs (changelog).
Added multiple functions: isObject, getFunctionParameters, downloadDirectory, Array.toLowerCase, Array.flat
ClickGui hooking separated into Core.updateClickGui. You can use it to refresh ClickGui while keeping events such as onClickGuiLoaded working.
Fixed a possible bug that could prevent core.log from being removed and therefore break Core Updater.All changes: https://github.com/CzechHek/Core/commit/293059540f632bc3300ccdd47128d3f0d21daba6