cabaletta / baritone

google maps for block game
GNU Lesser General Public License v3.0
7.15k stars 1.43k forks source link

Baritone timed scripting idea #4502

Closed Paladynee closed 1 week ago

Paladynee commented 1 week ago

Describe your suggestion

This idea incorporates a timer and a list of baritone commands to be executed when the time comes. The script starts by executing the first command as a baritone command, waits for a specific or calculated amount of time to pass, then executes the next command and repeats.

Settings

A setting that specifies an input file or a list of commands and timer settings to be executed by baritone.

Context

This allows baritone to be a more flexible player controller while not introducing any breaking changes to the API.

Example script

{
    "commands": [
        "mine diamond_ore deepslate_diamond_ore",
        "goal ~100 ~ ~"
    ],
    "timers": [
        60000, 
        30000
    ],
    "repeat": [
        10,
        10
    ],
    "finished": [
        "stopscript"
    ]
}
ZacSharp commented 1 week ago

Looking at your example, I think json is a horrible scripting language. List-of-commands-style scripting with additional delay/repetition commands is both easier to implement and easier to use.

Apart from that, adding native scripting is a very old suggestion and you can easily use a macro mod instead. E.g. with jsmacros you could write something like this (warning: I did not try running it):

for (let i = 0; i < 10; i++) {
    Chat.say("#mine diamon_ore deepslate_diamond_ore");
    Client.waitTick(1200);
    Chat.say("#goto ~100 ~ ~");
    Client.waitTick(600);
}

See #448 for a version that's more likely to be implemented and #881 for the full-blown scripting language suggestion (also there's a bunch of issues on other more specific suggestions). However I don't think either is going to happen any time soon. #448 is nontrivial because it is not currently possible to wait for a command to finish and if you want #881 you are better of with a macro mod anyway.