Macros ?



  • I suggest adding a macro editor where u can add macro keys for example /tpaccept will be typed in chat when u press a certain key



  • ccbluex won't do any changes of liquidbounce until the cross-version is done



  • nothing relevant but /tpyes also works and is shorter



  • This post is deleted!

  • Moderator

    There are many mods for stuff like that, so use a mod.


  • Admin

    You can use this script I made a while ago.

    Syntax
    .macro add <key> <command...>
    .macro remove <key>

    eg.:
    .macro add i killaura range 3.4
    .macro remove i

    Make sure the module called 'Macros' is enabled!

    var scriptName = "Macros";
    var scriptAuthor = "Senk Ju";
    var scriptVersion = 1.0;
    
    var File = Java.type("java.io.File");
    var FileReader = Java.type("java.io.FileReader");
    var BufferedReader = Java.type("java.io.BufferedReader");
    var FileWriter = Java.type("java.io.FileWriter");
    var BufferedWriter = Java.type("java.io.BufferedWriter");
    var Keyboard = Java.type("org.lwjgl.input.Keyboard");
    var LiquidBounce = Java.type("net.ccbluex.liquidbounce.LiquidBounce");
    
    var macros = {};
    var prefix = LiquidBounce.commandManager.getPrefix();
    
    function chatSyntax(message) {
        chat.print("§8[§9§lMacros§8] §3Syntax: §7" + prefix + message);
    }
    
    function chatText(message) {
        chat.print("§8[§9§lMacros§8] §3" + message);
    } 
    
    function readFile(filePath) {
        try {
            var file = new File(filePath);
            var reader = new BufferedReader(new FileReader(file));
            var content = [];
            var line;
    
            while ((line = reader.readLine()) !== null) {
                content.push(line);
            }
    
            return content;
        } catch (err) {}
    }
    
    function writeFile(path, string) {
        try {
            writer = new BufferedWriter(new FileWriter(path));
            writer.write(string);
    
            writer.close();
        } catch (err) {}
    }
    
    function saveMacros() {
        var macrosJson = JSON.stringify(macros);
    
        writeFile(mc.mcDataDir + "/lb-macros.json", macrosJson);
    }
    
    function loadMacros() {
        macros = JSON.parse(readFile(mc.mcDataDir + "/lb-macros.json").join(""));
    }
    
    function joinArray(array, startIndex) {
        var joinedString = "";
    
        for (var i = startIndex; i < array.length; i++) {
            joinedString += array[i] + " ";
        }
    
        return joinedString.trim();
    }
    
    function MacroModule() {
    
        this.getName = function() {
            return "Macros";
        };
    
        this.getDescription = function() {
            return "Allows you to bind commands to keys.";
        };
    
        this.getCategory = function() {
            return "Misc";
        };
    
        this.onKey = function(event) {
            var key = event.getKey();
    
            if (macros[key]) {
                commandManager.executeCommand(prefix + macros[key]);
            }
        };
    }
    
    function MacroCommand() {
    
        this.getName = function() {
            return "macro";
        };
    
        this.getAliases = function() {
            return ["macros"];
        };
    
        this.execute = function(args) {
            if (args.length <= 1) {
                chatSyntax("macro <add/remove>");
                return;
            }
    
            switch (args[1]) {
                case "add":
                    if (args.length <= 3) {
                        chatSyntax("macro add <key> <command...>");
                        return;
                    }
    
                    var key = args[2].toUpperCase();
                    var keyCode = Keyboard.getKeyIndex(key);
                    var command = joinArray(args, 3);
    
                    macros[keyCode] = command;
    
                    saveMacros();
                    chatText("Successfully bound command '§7" + command + "§3' to key '§7" + key + "§3'.");
    
                    break;
    
                case "remove":
                    if (args.length <= 2) {
                        chatSyntax("macro remove <key>");
                        return;
                    }
    
                    var key = args[2].toUpperCase();
                    var keyCode = Keyboard.getKeyIndex(key);
    
                    if (macros[keyCode]) {
                        delete macros[keyCode];
                        chatText("Successfully removed macro.");
                        saveMacros();
                    } else {
                        chatText("Macro does not exist!");
                    }
    
                    break;
    
                default:
                    chatSyntax("macro <add/remove>");
            }
        };
    }
    
    var macroModule = new MacroModule();
    var macroCommand = new MacroCommand();
    
    function onLoad() {
        loadMacros();
    }
    
    function onEnable() {
        moduleManager.registerModule(macroModule);
        commandManager.registerCommand(macroCommand);
    }
    
    function onDisable() {
        moduleManager.unregisterModule(macroModule);
        commandManager.unregisterCommand(macroCommand);
    }
    

Log in to reply