• 1

    posted a message on Macro / Keybind Mod

    Wondering if anyone knows how to make attack stay pressed. e.g. key own(forward), however, this does not work with keydown(attack). my problem is coming from doing key(attack) occurs too little in a period of time and it is not fast enough. Help would be greatly appreciated, Thanks :)





    This post explains the reasons behind the different types of bindings and how to use them

    Stateful vs trigger vs momentary bindings

    Posted in: Minecraft Mods
  • 2

    posted a message on Macro / Keybind Mod
    Quote from nbird»

    Is it possible to delete local variables after a script is run?


    I had run some scripts set local variables e.g. #m, &m, &m[] and after stopping all scripts or even restarting minecraft,

    if I check the variables its still filled with the same values - and no its not global variables.


    This is a problem especially with arrays.

    At one point a array is filled with 10 different values (index 0-9). If I want to use this variable name again, I first have to empty the array by hand with POP(), otherwise if I only put 4 values (index 0-3) into the array it would still iteraote over 10 values, because the old ones are still there, too.


    Is there some setting I am missing or some command doing something like &m[]=NULL (this specific doesn't work) or &m[] = new Array() or only &m[]; to get a completly new/empty array?


    You can clear an array easily with `Unset(&myarray[])`
    If that didn't exist you could still do something like `#n = ArraySize(&myarray[]);DO(%#n%);POP(&myarray[]);LOOP;`

    Posted in: Minecraft Mods
  • 2

    posted a message on Macro / Keybind Mod

    The other thing i suspect is that you have spaces after the commas - i remember at least some commands choking on them (they treat the space as part of the input)

    Posted in: Minecraft Mods
  • 1

    posted a message on Macro / Keybind Mod

    nah

    Posted in: Minecraft Mods
  • 2

    posted a message on Macro / Keybind Mod
    Quote from MatthewTheWeeb»

    Height shouldn't matter except for the single block jumps, so just x and z is probably fine.





    Alright, i've removed the extra bits and added comments for everything, i hope this version is a bit clearer


    Lines starting with // are comments - meaning nothing would change if they were removed (the mod ignores those lines), they're simply there for explanation


    Edit: Wanted to at least highlight the comments but can't get the forums to cooperate

    //
    // Configuration
    //
    
    // How close we need to get to the target
    #threshold = 0
    
    //
    // Waypoints
    //
    // Reset the array so that the list doesn't get bigger every time the script is run
    UnSet(#walkx[])
    UnSet(#walkz[])
    
    // Add one coordinate
    #walkx[] = 10
    #walkz[] = 10
    
    // Add another coordinate
    #walkx[] = 10
    #walkz[] = 0
    
    //
    // Code
    //
    
    // A common snippet used to make a script toggleable (let me know if you want an explanation of this)
    TOGGLE;IF;Log("Stopped");Keyup(jump);Keyup(forward);STOP;ENDIF;
    
    // How many total coordinates do we have?
    #size = ArraySize(#walkx[])
    #size = #size - 1
    // For each waypoint
    FOR(#i = 0 to %#size%)
        // Copy the coordinates to shorter variables for convenience
        #x = #walkx[%#i%]
        #y = #walky[%#i%]
        #z = #walkz[%#i%]
    
    
        // Start walking
        keydown(forward)
    
        // Repeat this part until we reach the waypoint
        // This part handles looking towards the coordinate and jumping if necessary
        DO()
            // Look towards the waypoint on the x-z plane
            calcyawto(%#x%,%#z%,#yaw,#dist);
            inc(#yaw,180); // Fix because minecraft yaw is 180 degrees off
            look(%#yaw%,+0); // +0 means do not affect pitch (you can still control pitch with the mouse then)
    
    
    
            // ↓ Jump if blocks in the way
            // Depending on which 90 degree angle you're looking towards, this will only check the three blocks that are in that sector
            // sig_x - Whether we're looking more towards positive x or negative x
            // sig_z - Same but for z
            #sig_x = 1;
            #sig_z = 1;
            IF(YAW < 180); #sig_x = -1; ENDIF
            IF((90 < YAW) && (YAW < 270)); #sig_z = -1; ENDIF
    
            // Block along x axis, along y axis, and on the diagonal
            &block_1 = GETIDREL(%#sig_x%,0,0)
            &block_2 = GETIDREL(%#sig_x%,0,%#sig_z%)
            &block_3 = GETIDREL(0,0,%#sig_z%)
    
            // If all are air, do not jump, else jump
            IFMATCHES("%&block_1%,%&block_2%,%&block_3%","air,air,air");
                Keyup(jump)
            ELSE;
                Keydown(jump);
            ENDIF;
            // ↑ end
    
    
    
            // ↓ Expose global variables
            // Not important for the script, but might be handy if you want to make a GUI to show progress or something
            @#walker_yaw = %#yaw%
            @#walker_pitch = %#pitch%
            @#walker_target_x = %#x%
            @#walker_target_y = %#y%
            @#walker_target_z = %#z%
            @#walker_distance = %#dist%
            // ↑ end
    
        While(#threshold < #dist);
        // Done walking to waypoint
        Keyup(forward)
    NEXT;
    // Done walking to all waypoints
    Posted in: Minecraft Mods
  • 1

    posted a message on Macro / Keybind Mod
    Quote from MatthewTheWeeb»

    Alright, I've tried it out and I have a question. How do you input several coordinates to travel to after one another? For example, first coordinate 1, then 2, then 3 etc. Also, let me specify what I want the script to do more specifically so you have a better idea of what I'm trying to do; I want to set up a loop for the character, where it walks from coordinate to coordinate, eventually returning to the start position and then repeating the loop. At every coordinate inputted, the character will left click once, wait 5 seconds and continue toward the next coordinate and repeating the action. The code might look something like this (very simplified and unprofessional):
    1. Go to coordinate 1
    2. Left click

    3. Wait 5 sec

    4. Go to coordinate 2

    5. Left click

    6. Wait 5 sec

    7. Go to coordinate 3

    8. Left click

    9. Wait 5 sec
    10. Repeat

    In practice, more coordinates would be needed, forming a kind of circle, but I believe this demonstrates my idea adequately. This is probably what your script does with a couple more steps added, but I think I might need an explanation of how to work it and input the variables as I'm not exactly experienced in coding... Sorry if this is too much to ask. I do think I could make something workable after hours of trial and error, but I figured it's probably easier and less time consuming if you just explain how it works. :P

    Again, thanks so much for responding and giving me a script almost immediately. I am as stated previously, eternally grateful.


    This example already has two coordinates right at the start there, 10,10 and 10,0
    Let me remove the extra stuff and leave only the script and commends, hopefully it'll make more sense then

    edit: A lot of the complexity comes from the fact that i tried to combine 2d and 3d logic
    Do you want height to matter? or only the x and z?

    Posted in: Minecraft Mods
  • 1

    posted a message on Macro / Keybind Mod
    Quote from MatthewTheWeeb»

    I want it to walk to a specific inputted coordinate, then walk to a chain of different specific coordinates. Ideally also able to jump over singular blocks. That's it.


    Turns out i already had something like that - had to tweak it a bit but this should get you started

    (The entire thing goes in a file, it looks like markdown with code snippets (well, it is), but it works just fine for the mod too because it ignores all the lines it doesn't understand)

    # Waypoint walker script
    
    ## Configuration
    
    ```mkb
    &logtarget = "Debug"
    #threshold = 0
    use_y = false
    ```
    
    ## Waypoints
    
    ```mkb
    UnSet(#walkx[])
    UnSet(#walky[])
    UnSet(#walkz[])
    
    #walkx[] = 10
    #walky[] = 4
    #walkz[] = 10
    
    #walkx[] = 10
    #walky[] = 6
    #walkz[] = 0
    ```
    
    Note: The following global variables are exposed (you can use these in a GUI for example)  
    The current waypoint we're walking towards: `@#walker_target_x` `@#walker_target_y` `@#walker_target_z`  
    The distance to that waypoint: `@#walker_distance`
    
    ## Code
    
    ```mkb
    TOGGLE;
    IF;LogTo("%&logtarget%","Stopped");Keyup(jump);Keyup(forward);STOP;ENDIF;
    
    #size = ArraySize(#walkx[])
    #size = #size - 1
    FOR(#i = 0 to %#size%)
        logTo("%&logtarget%","%#i%")
        #x = #walkx[%#i%]
        #y = #walky[%#i%]
        #z = #walkz[%#i%]
    
    
        keydown(forward)
        DO()
            // ---------------- CALCULATE DIRECTION TO LOOK IN ----------------
            // Get direction and distance on the horizontal plane
            calcyawto(%#x%,%#z%,#yaw,#dist);
            inc(#yaw,180); // coordinate transformation
    
            // Get direction and distance on a vertical plane
            // Get position relative to head
            #deltay = #y - YPOS + 2; //+2 for player correction
            #deltaz = #dist
    
            //// NOV16: I suspect this doesn't actually add precision
            // *100 for increased precision
            #deltay = #deltay * 100
            #deltaz = #deltaz * 100
            IF(!use_y) #deltay = 0
    
            // Offset from current position
            #vx = XPOS+#deltay
            #vz = ZPOS+#deltaz
    
            // Get pitch
            CalcYawTo(%#vx%,%#vz%,#pitch,#dist_3d)
    
            // Look in direction
            IF(use_y)
                look(%#yaw%,%#pitch%)
            ELSE 
                look(%#yaw%,+0)
            ENDIF
    
            // Jump if suspect blocks in the way
            #sig_x = 1;
            #sig_z = 1;
            IF(YAW < 180); #sig_x = -1; ENDIF
            IF((90 < YAW) && (YAW < 270)); #sig_z = -1; ENDIF
            &block_1 = GETIDREL(%#sig_x%,0,0)
            &block_2 = GETIDREL(%#sig_x%,0,%#sig_z%)
            &block_3 = GETIDREL(0,0,%#sig_z%)
            IFMATCHES("%&block_1%,%&block_2%,%&block_3%","air,air,air");
                Keyup(jump)
            ELSE;
                Keydown(jump);
            ENDIF;
    
    
            // expose global variables
            @#walker_yaw = %#yaw%
            @#walker_pitch = %#pitch%
            @#walker_target_x = %#x%
            @#walker_target_y = %#y%
            @#walker_target_z = %#z%
            IF(use_y)
                @#walker_distance = %#dist_3d%
            ELSE
                @#walker_distance = %#dist%
            ENDIF
            // ---------------- CHECK IF TARGET REACHED ----------------
        While((#threshold < #dist_3d) && (use_y || (#threshold < #dist)));
        Keyup(forward)
    NEXT;
    ```
    Posted in: Minecraft Mods
  • 1

    posted a message on Macro / Keybind Mod
    Quote from LiftedRici»

    Hey, i hope someone can help me with my macro. I tried for days now, but it doesn't work.
    First i will tell you what i want to achieve.
    So i want a macro that will start sprinting forward and start mining cobble until the inventory is full. After that, the account should drop the cobblestone out of the inventory and repeat running/mining and dropping without pressing the macro key again it should work afk.
    Here is what i got so far. I got 3 scripts that contain:


    run.txt
    $${keydown(sprint);keydown(forward);}$$

    attack.txt

    $${TOGGLE(autoclick);DO;KEY(attack);WHILE(autoclick)}$$


    drop.txt

    $${GUI(inventory);FOR(#s,9,35);GETSLOTITEM(%#s%,#i);IF(#i=Cobblestone);SLOTCLICK(%#s%);SLOTCLICK(-999);ENDIF;NEXT;GUI}$$


    Now i bind it to a key with:
    $${$$<run.txt>}$$ $${$$<attack.txt>}$$ $${wait(50ms)}$$ $${$$<attack.txt>}$$


    Like this it will run and start attacking. I have attack doubled because after i open the inventory with the drop.txt the account need to press the attack button again. I got no solution for the drop.txt that it triggers when the inventory is full. And overall this is a really bad solution i think.

    I hope you can help me to get a working script because im to bad to get it right :)





    It might be easier to start with the entire script in one file, because that's how the mod eventually runs the code - just like it was copy pasted together

    Figure out a basic high level overview, because you can only do one thing at a time
    I'm guessing it should go something like



    Once you have the high level idea of what you want to make, start making and testing it in individual pieces

    For example, try to just get it to run first

    Then to run and mine


    Then in a separate script try to figure out how to detect if the inventory is full

    Then combine them


    Then in a separate script try to figure out how to drop all the items in your inv

    Then combine them

    Posted in: Minecraft Mods
  • 1

    posted a message on Macro / Keybind Mod
    Quote from deltadll»

    Hey Mumfrey!


    First of all, thanks for this amazing mod. But, I'm having a problem: i'm trying to play in a server with that mod, but i'm getting detected and kicked from it. I'd like to know how they're doing this and how I can bypass it. I'd be so grateful if u help me.


    There is no stealth mode, and for good reason

    If you suspect that the autokick is configured too agressively and the mod would otherwise be allowed, consider notifying an owner/admin and asking if they can add a whitelist entry for it.

    Posted in: Minecraft Mods
  • 1

    posted a message on Macro / Keybind Mod
    Quote from AURAequine»


    I have tried the command in quotation marks, yes. However due to the item id also being in quotation marks, I think the command read only between the first and second ". Not the first and last, like I feel that it should.

    Just tested it again and ${ECHO("/summon item ~ ~2 ~ {Item:{Id:"apple",Count:1}}")}$ resulted in Data tag parsing failed: Expected '}' but got '"'at: {Item:{Id:apple"<--[HERE]

    So I think it might be misinterpreting the quote marks and after the quote it sees the next comma as another line. Although then again that might not be the case, as nothing else entered the chat, which would've happened if the echo dumped the rest.


    Not sure if that's supported, but two things you could try are:
    Using different quotes (' around and " inside, or vice versa, f.ex. Echo("this is 'an' example"); Echo('and so is "this" now'))
    Also it might be possible to escape quotes as in Echo("this is an \"escaped\" example")
    Quote from Noobthebuilder»

    Hehe, you're hard to spot without the Pony picture! I got it working, however IF(SPACE), doesn't work. Also tried it with input KEYDOWN(jump) and then KEYUP(jump) worked for me. The script looks like this:


    KEYDOWN(jump);
    WAIT(1ms);
    KEYUP(jump);
    IF(jumpflag);
    ECHO(/cast doublejump);
    UNSET(jumpflag);
    ELSE;
    SET(jumpflag);
    WAIT(250ms);
    UNSET(jumpflag);
    ENDIF;
    ENDIF;

    There is an issue now with going up while using flight and autojumping. You can't go up now anymore, because the script doesn't run it continously. Any way to hold keydown(jump) while holding the key down? I imagine it would look something like

    DO;
    Key(jump)
    WHILE(SPACE)
    ENDIF;
    ENDIF;

    Or something, but the problem is that "SPACE" doesn't work.


    Use a key state macro?
    Key Down: $${KeyDown(jump); // Rest of the script }$$
    Key held:
    Key up: $${KeyUp(jump);}$$

    Posted in: Minecraft Mods
  • To post a comment, please .