• 0

    posted a message on Macro / Keybind Mod

    How do you get constant negative pitch values for the look command? Using minus just makes the pitch relative.

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    That's perfect, thank you. I'll try the new version out and come back with feedback yet again if there's something I can't wrap my head around. Want a small donation or something? Nothing big, just so I can thank you less superficially. It's also close to Christmas, so I guess it's kinda like an early present or something. If so, does paypal work?

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

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

    Posted in: Minecraft Mods
  • 0

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

    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;
    ```


    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.

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    Sorry about the late response, I was at a baptism today.

    You're a god, thank you so much! I'll try the script and get back to you afterwards in case I encounter any problems.

    Posted in: Minecraft Mods
  • 0

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

    Well the core of it is just Look(pitch,yaw) and Keydown(forward)
    But depending on how smart you want it to be it can be anything from easy to practically impossible
    Consider for example the following potential obstacles

    Difficult
    Hostile players
    Mobs
    Fatal drops (holes in the ground - ravines)
    Unavoidable drops (steep mountain side)
    Unavoidable pillaring (steep mountain side again)
    Doors
    Unavoidable mining (coordinates accidentally happen to be inside a mountain or w\e)

    Potentially doable:
    Turns (A house is in the way, have to go around it)

    Doable:
    Jumps: (The terrain gradually changes height, have to jump up 1 block ledges)


    So it all depends on the context of what you want this for


    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.

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    Is there any way to make a script to look in the direction of a coordinate and walk to that position then do the same for a chain of different coordinates using GETID and CALCYAWTO? If anyone could make me a script that does this and tell me how to input custom x and z values I'd be eternally grateful.

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