• 0

    posted a message on Macro / Keybind mod scripts!

    A* based Pathfinder Macro for Minecraft 1.11.2 (Made by WhitePaw2002)


    The two macros supplied log to a GUI element called PathLog. You can probably put that in somewhere, or change it.


    First part of two: Small ish macro to place goal position.



    ${SHOWGUI(Empty);&destination=$p}$ ${IFMATCHES(%&destination%,(\w+) (\w+) (\w+),@&destx,1);ENDIF;IFMATCHES(%&destination%,(\w+) (\w+) (\w+),@&desty,2);ENDIF;IFMATCHES(%&destination%,(\w+) (\w+) (\w+),@&destz,3);ENDIF;LOGTO(PathLog,"Destination has changed to (%@&destx% %@&destz%) with height of (%@&desty%));}$





    Main part. The Pathfinder itself. It's a biggie, here's a spoiler.


     @#goalx=%@&destx%
     @#goaly=%@&desty%
     @#goalz=%@&destz%
     LOGTO(PathLog,%@#goalx%, %@#goaly%, %@#goalz%)
     INC(@#goaly)
     #startx=%XPOS%
     #starty=%YPOS%
     #startz=%ZPOS%
     LOGTO(PathLog,%#startx%, %#starty%, %#startz%)
     CALCYAWTO(%@#goalx%,%@#goalz%,#bin,#fsc)
     #climb=%#starty%-%@#goaly%
     #climb=%#climb%*10
     IF(%#climb%<0)
     #climb=0-%#climb%
     ENDIF
     #fsc=(%#fsc%*10)+%#climb%
     // The set of nodes already evaluated
    
     // The set of currently discovered nodes that are not evaluated yet.
     // Initially, only the start node is known.
     @#cid=0
     UNSET(#setx[])
     #setx[0]=%#startx%
    
     UNSET(#sety[])
     #sety[0]=%#starty%
    
     UNSET(#setz[])
     #setz[0]=%#startz%
    
     UNSET(#setzdiff[])
     #setzdiff[0]=0
    
     UNSET(setisopen[])
     setisopen[0]=%TRUE%
    
     #setopencount=1
    
     UNSET(#openids[])
     #openids[0]=0
    
     UNSET(#setcamefrom[])
     #setcamefrom[0]=-1
    
     UNSET(#setcamefromid[])
     #setcamefromid[0]=-1
    
     UNSET(#setgscore[])
     #setgscore[0]=0
    
     UNSET(#setfscore[])
     #setfscore[0]=%#fsc%
     // For each node, which node it can most efficiently be reached from.
     // If a node can be reached from many nodes, cameFrom will eventually contain the
     // most efficient previous step.
    
    
     // For each node, the cost of getting from the start node to that node.
    
     // The cost of going from start to start is zero.
    
     // For each node, the total cost of getting from the start node to the goal
     // by passing by that node. That value is partly known, partly heuristic.
    
     // For the first node, that value is completely heuristic.
     TOGGLE(@callid)
     UNSET(makepath)
     #totalloopc=0
     DO
     INC(#totalloopc)
     LOGTO(PathLog,Round %#totalloopc%)
     //Find lowest f
     ARRAYSIZE(#openids[],#idc)
     DEC(#idc)
     #lowestf=-17
     #idoflowest=-1
     #arrayplacement=0
     FOR(#num,0,%#idc%)
     #id=%#openids[%#num%]%
     IF(((%#setfscore[%#id%]%<%#lowestf%) || (%#lowestf%==-17)) && (%setisopen[%#id%]%))
     #lowestf=%#setfscore[%#id%]%
     #idoflowest=%#id%
     #arrayplacement=%#num%
     LOGTO(PathLog,>>>>>>>>>>>>>>>>>>>>> %#setfscore[%#id%]% %setisopen[%#id%]% %#id%)
     endif
     NEXT
     @#cid =%#idoflowest%
     #cid=%@#cid%
     setisopen[%#cid%]=%FALSE%
     //Remove from openids
     ARRAYSIZE(#openids[],#asize)
     DEC(#asize)
     FOR(#i,%#cid%,%#asize%)
     #ii=%#i%+1
     IF(%#ii%<=%#asize%)
     #openids[%#i%]=%#openids[%#ii%]%
     ENDIF
     NEXT
     LOGTO(PathLog,Node %#cid% has lowest F score, removed from open array)
     //Check if path close
     DEC(#setopencount)
     #cx=%#setx[%#cid%]%
     #cy=%#sety[%#cid%]%
     #cz=%#setz[%#cid%]%
     UNSET(calibrated)
     DO
     GETID(%#cx%,%#cy%,%#cz%,&id)
     #id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     #cy=%#cy%-1
     ELSE
     #cy=%#cy%+2
     SET(calibrated)
     ENDIF
     UNTIL(%calibrated%)
     if((%#setx[%#cid%]%==%@#goalx%) && (%#sety[%#cid%]%==%@#goaly%) && (%#setz[%#cid%]%==%@#goalz%))
     SET(makepath)
     LOGTO(PathLog,Done Finding Path, with ID %#cid% and evidence (%#setx[%#cid%]%==%@#goalx%) (%#setz[%#cid%]%==%@#goalz%))
     endif
     IF(!%makepath%)
     for(#npm,0,7)
     LOGTO(PathLog,%#npm% Neighbor %#npm% has been called)
     UNSET(corner)
     //Define placement
     if(%#npm%==0);#nx=%#cx%+1;#nz=%#cz%;endif
     if(%#npm%==1);#nx=%#cx%+1;#nz=%#cz%+1;corner=%TRUE%;endif
     if(%#npm%==2);#nx=%#cx%;#nz=%#cz%+1;endif
     if(%#npm%==3);#nx=%#cx%-1;#nz=%#cz%+1;corner=%TRUE%;endif
     if(%#npm%==4);#nx=%#cx%-1;#nz=%#cz%;endif
     if(%#npm%==5);#nx=%#cx%-1;#nz=%#cz%-1;corner=%TRUE%;endif
     if(%#npm%==6);#nx=%#cx%;#nz=%#cz%-1;endif
     if(%#npm%==7);#nx=%#cx%+1;#nz=%#cz%-1;corner=%TRUE%;endif
     #ny=%#cy%
     UNSET(fail)
     //Check if node is pass-able
     GETID(%#nx%,%#ny%,%#nz%,&id);#id=TILEID(%&id%)
     UNSET(goodtogo)
     IF(%corner%)
     GETID(%#cx%,%#ny%,%#nz%,&id)
     #id1=TILEID(%&id%)
     GETID(%#nx%,%#ny%,%#cz%,&id)
     #id2=TILEID(%&id%)
     IF(((%#id1%==0) || (%#id1%==64) || (%#id1%==176) || (%#id1%==321) || (%#id1%==63) || (%#id1%==68)) && ((%#id2%==0) || (%#id2%==64) || (%#id2%==176) || (%#id2%==321) || (%#id2%==63) || (%#id2%==68)))
     #biny=%#ny%-1
     GETID(%#cx%,%#biny%,%#nz%,&id)
     #id1=TILEID(%&id%)
     GETID(%#nx%,%#biny%,%#cz%,&id)
     #id2=TILEID(%&id%)
     IF(((%#id1%==0) || (%#id1%==64) || (%#id1%==176) || (%#id1%==321) || (%#id1%==63) || (%#id1%==68)) && ((%#id2%==0) || (%#id2%==64) || (%#id2%==176) || (%#id2%==321) || (%#id2%==63) || (%#id2%==68)))
     SET(goodtogo)
     ENDIF
     ENDIF
     ELSE
     SET(goodtogo)
     ENDIF
     #holescore=-2
     IF(((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68)) && (goodtogo))
     
     UNSET(breaksearch)
     FOR(#down,1,5)
     #biny=%#ny%-%#down%
     GETID(%#nx%,%#biny%,%#nz%,&id)
     #id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     IF(!%breaksearch%)
     #holescore=%#down%-1
     ENDIF
     ELSE
     SET(breaksearch)
     ENDIF
     NEXT
     IF(%#holescore%==4)
     #holescore=-2
     ENDIF
     #biny=%#ny%+1
     GETID(%#nx%,%#biny%,%#nz%,&id);#id=TILEID(%&id%)
     IF((((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68)) && (!corner)) && (%#holescore%==-2))
     #biny=%#cy%+1
     GETID(%#cx%,%#biny%,%#cz%,&id);#id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     #biny=%#ny%-1
     GETID(%#nx%,%#biny%,%#nz%,&id);#id=TILEID(%&id%)
     IF(!((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68)))
     #holescore=-1
     ENDIF
     ENDIF
     ENDIF
     ENDIF
     IF(%#holescore%==-2)
     SET(fail)
     LOGTO(PathLog,%#npm% Neighbor is unreachable)
     ENDIF
     IF(!%fail%)
     UNSET(calibrated)
     DO
     GETID(%#nx%,%#ny%,%#nz%,&id)
     #id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     #ny=%#ny%-1
     ELSE
     #ny=%#ny%+2
     SET(calibrated)
     ENDIF
     UNTIL(%calibrated%)
     LOGTO(PathLog,%#npm% Neighbor can be reached, and has a holescore of %#holescore%)
     //Check if node has been created before
     ARRAYSIZE(#setx[],#size)
     DEC(#size)
     #nid=-1
     FOR(#i,0,%#size%)
     IF(%#setx[%#i%]%==%#nx%)
     IF(%#sety[%#i%]%==%#ny%)
     IF(%#setz[%#i%]%==%#nz%)
     #nid=%#i%
     LOGTO(PathLog,%#npm% Node has been linked to Neighbor)
     ENDIF
     ENDIF
     ENDIF
     NEXT
     //Discover new node
     IF(%#nid%==-1)
     PUSH(#setx[],%#nx%)
     PUSH(#sety[],%#ny%)
     PUSH(#setz[],%#nz%)
     PUSH(#setzdiff[],%#holescore%)
     PUSH(setisopen[],%TRUE%)
     INC(#setopencount)
     PUSH(#setcamefrom[],%#npm%)
     PUSH(#setcamefromid[],%#cid%)
     #bin=((%@#goalx%-%#nx%)*(%@#goalx%-%#nx%))+((%@#goalz%-%#nz%)*(%@#goalz%-%#nz%))
     SQRT(%#bin%,#fsc)
     #climb=%#holescore%*10
     IF(%#climb%<0)
     #climb=0-%#climb%
     ENDIF
     #fsc=(%#fsc%*10)+%#climb%
     IF((%#npl%==0) || (%#npl%==2) || (%#npl%==4) || (%#npl%==6))
     #travel=10
     ELSE
     #travel=20
     ENDIF
     #gcost=%#setgscore[%#cid%]%+%#climb%+%#travel%
     PUSH(#setgscore[],%#gcost%)
     #fc=%#fsc%+%#gcost%
     PUSH(#setfscore[],%#fc%)
     #nid=%#size%+1
     PUSH(#openids[],%#nid%)
     LOGTO(PathLog, %#npm% New node was created)
     endif
     LOGTO(PathLog,%#npm% Neighbor has been identified with ID %#nid%)
     //Check if is already closed, Ignore if it is
     if(!setisopen(%#nid%))
     SET(fail)
     endif
     
     
     // The distance from start to a neighbor, plus preferences
     #bin=((%@#goalx%-%#setx[%#nid%]%)*(%@#goalx%-%#setx[%#nid%]%))+((%@#goalz%-%#setz[%#nid%]%)*(%@#goalz%-%#setz[%#nid%]%))
     SQRT(%#bin%,#fsc)
     #climb=%#holescore%*10
     IF(%#climb%<0)
     #climb=0-%#climb%
     ENDIF
     #fsc=%#fsc%+%#climb%
     IF((%#npl%==0) || (%#npl%==2) || (%#npl%==4) || (%#npl%==6))
     #travel=10
     ELSE
     #travel=20
     ENDIF
     #gcost=%#setgscore[%#cid%]%+%#climb%+%#travel%
     if(%#gcost%>=%#setgscore[%#nid%]%)
     SET(fail)
     endif
     ENDIF
     IF(!%fail%)
     // This path is the best until now. Record it!
     #setcamefrom[%#nid%]=%#npm%
     #setcamefromid[%#nid%]=%#cid%
     #setgscore[%#nid%]=%#gcost%
     #setfscore[%#nid%]=%#fsc%+%#gcost%
     ENDIF
     NEXT
     ENDIF
     WHILE((%#setopencount%>0) && (!%makepath%))
    LOGTO(PathLog,Exited with %#setopencount% and %makepath%)
    #currentid=%@#cid%
    UNSET(@#xgoto[])
    UNSET(@#zgoto[])
    UNSET(@&nav1goto[])
    UNSET(@&nav2goto[])
    #cnt=-1
    DO
     INC(#cnt)
     @#xgoto[%#cnt%]=%#setx[%#currentid%]%
     @#zgoto[%#cnt%]=%#setz[%#currentid%]%
     @&nav1goto[%#cnt%]=Forward
     LOGTO(PathLog,Setting %#setx[%#currentid%]% and %#setz[%#currentid%]% with ID (%#currentid%)))
     IF(%#setzdiff[%#currentid%]%<0)
     @&nav2goto[%#cnt%]=Jump
     ELSE
     @&nav2goto[%#cnt%]=NUL
     ENDIF
     #currentid=%#setcamefromid[%#currentid%]%
    WHILE(%#currentid%>=0)
    LOGTO(PathLog,Ready!)
    LOGTO(PathLog,%#totalloopc%)
    
    
    //OTHERMACRO
    INC(#cnt)
    DO;
     DEC(#cnt)
     #xgoal=%@#xgoto[%#cnt%]%
     #zgoal=%@#zgoto[%#cnt%]%
     &movement1=%@&nav1goto[%#cnt%]%
     &movement2=%@&nav2goto[%#cnt%]%
     LOGTO(PathLog,Moving to (%#xgoal% %#zgoal%) with %&movement1% %&movement2%);
     DO;
     CALCYAWTO(%#xgoal%,%#zgoal%,#yaw,#dist);
     #y=%#yaw%+180;
     LOOKS(%#y%,+0);
     KEYDOWN(%&movement1%);
     KEYDOWN(%&movement2%);
     UNSPRINT;
     UNTIL((%XPOS%==%#xgoal%)&&(%ZPOS%==%#zgoal%) || %&movement1%!=Forward);
     KEYUP(%&movement2%);
     WAIT(50ms);
     KEYUP(%&movement1%);
    WHILE((%receipt%==%@callid%) || (%#cnt% > 0))
    //END


    So basically, this is a pathfinder macro for Minecraft.


    With this being a macro, it's extremely slow, and gets even slower the more there is added to the array of nodes.

    It's also not too smart. It's knowledge of the world around it is a bit limited, as blocks are either solid, and non-solid. Only threat that this can detect are walls and big drops. Also, macro prefers not to jump as frequently to get over obstacles. But it will if it has to.

    NOYTISMEPLES

    Posted in: Mods Discussion
  • 1

    posted a message on Macro / Keybind Mod

    Hey, Mumfrey, I have something for you to check out (and pretty much anyone else):

    A* based Pathfinder Macro for Minecraft 1.11.2 (Made by WhitePaw2002)


    The two macros supplied log to a GUI element called PathLog. You can probably put that in somewhere, or change it.


    First part of two: Small ish macro to place goal position.


    ${SHOWGUI(Empty);&destination=$p}$ ${IFMATCHES(%&destination%,(\w+) (\w+) (\w+),@&destx,1);ENDIF;IFMATCHES(%&destination%,(\w+) (\w+) (\w+),@&desty,2);ENDIF;IFMATCHES(%&destination%,(\w+) (\w+) (\w+),@&destz,3);ENDIF;LOGTO(PathLog,"Destination has changed to (%@&destx% %@&destz%) with height of (%@&desty%));}$




    Main part. The Pathfinder itself. It's a biggie, here's a spoiler.


     @#goalx=%@&destx%
     @#goaly=%@&desty%
     @#goalz=%@&destz%
     LOGTO(PathLog,%@#goalx%, %@#goaly%, %@#goalz%)
     INC(@#goaly)
     #startx=%XPOS%
     #starty=%YPOS%
     #startz=%ZPOS%
     LOGTO(PathLog,%#startx%, %#starty%, %#startz%)
     CALCYAWTO(%@#goalx%,%@#goalz%,#bin,#fsc)
     #climb=%#starty%-%@#goaly%
     #climb=%#climb%*10
     IF(%#climb%<0)
     #climb=0-%#climb%
     ENDIF
     #fsc=(%#fsc%*10)+%#climb%
     // The set of nodes already evaluated
    
     // The set of currently discovered nodes that are not evaluated yet.
     // Initially, only the start node is known.
     @#cid=0
     UNSET(#setx[])
     #setx[0]=%#startx%
    
     UNSET(#sety[])
     #sety[0]=%#starty%
    
     UNSET(#setz[])
     #setz[0]=%#startz%
    
     UNSET(#setzdiff[])
     #setzdiff[0]=0
    
     UNSET(setisopen[])
     setisopen[0]=%TRUE%
    
     #setopencount=1
    
     UNSET(#openids[])
     #openids[0]=0
    
     UNSET(#setcamefrom[])
     #setcamefrom[0]=-1
    
     UNSET(#setcamefromid[])
     #setcamefromid[0]=-1
    
     UNSET(#setgscore[])
     #setgscore[0]=0
    
     UNSET(#setfscore[])
     #setfscore[0]=%#fsc%
     // For each node, which node it can most efficiently be reached from.
     // If a node can be reached from many nodes, cameFrom will eventually contain the
     // most efficient previous step.
    
    
     // For each node, the cost of getting from the start node to that node.
    
     // The cost of going from start to start is zero.
    
     // For each node, the total cost of getting from the start node to the goal
     // by passing by that node. That value is partly known, partly heuristic.
    
     // For the first node, that value is completely heuristic.
     TOGGLE(@callid)
     UNSET(makepath)
     #totalloopc=0
     DO
     INC(#totalloopc)
     LOGTO(PathLog,Round %#totalloopc%)
     //Find lowest f
     ARRAYSIZE(#openids[],#idc)
     DEC(#idc)
     #lowestf=-17
     #idoflowest=-1
     #arrayplacement=0
     FOR(#num,0,%#idc%)
     #id=%#openids[%#num%]%
     IF(((%#setfscore[%#id%]%<%#lowestf%) || (%#lowestf%==-17)) && (%setisopen[%#id%]%))
     #lowestf=%#setfscore[%#id%]%
     #idoflowest=%#id%
     #arrayplacement=%#num%
     LOGTO(PathLog,>>>>>>>>>>>>>>>>>>>>> %#setfscore[%#id%]% %setisopen[%#id%]% %#id%)
     endif
     NEXT
     @#cid =%#idoflowest%
     #cid=%@#cid%
     setisopen[%#cid%]=%FALSE%
     //Remove from openids
     ARRAYSIZE(#openids[],#asize)
     DEC(#asize)
     FOR(#i,%#cid%,%#asize%)
     #ii=%#i%+1
     IF(%#ii%<=%#asize%)
     #openids[%#i%]=%#openids[%#ii%]%
     ENDIF
     NEXT
     LOGTO(PathLog,Node %#cid% has lowest F score, removed from open array)
     //Check if path close
     DEC(#setopencount)
     #cx=%#setx[%#cid%]%
     #cy=%#sety[%#cid%]%
     #cz=%#setz[%#cid%]%
     UNSET(calibrated)
     DO
     GETID(%#cx%,%#cy%,%#cz%,&id)
     #id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     #cy=%#cy%-1
     ELSE
     #cy=%#cy%+2
     SET(calibrated)
     ENDIF
     UNTIL(%calibrated%)
     if((%#setx[%#cid%]%==%@#goalx%) && (%#sety[%#cid%]%==%@#goaly%) && (%#setz[%#cid%]%==%@#goalz%))
     SET(makepath)
     LOGTO(PathLog,Done Finding Path, with ID %#cid% and evidence (%#setx[%#cid%]%==%@#goalx%) (%#setz[%#cid%]%==%@#goalz%))
     endif
     IF(!%makepath%)
     for(#npm,0,7)
     LOGTO(PathLog,%#npm% Neighbor %#npm% has been called)
     UNSET(corner)
     //Define placement
     if(%#npm%==0);#nx=%#cx%+1;#nz=%#cz%;endif
     if(%#npm%==1);#nx=%#cx%+1;#nz=%#cz%+1;corner=%TRUE%;endif
     if(%#npm%==2);#nx=%#cx%;#nz=%#cz%+1;endif
     if(%#npm%==3);#nx=%#cx%-1;#nz=%#cz%+1;corner=%TRUE%;endif
     if(%#npm%==4);#nx=%#cx%-1;#nz=%#cz%;endif
     if(%#npm%==5);#nx=%#cx%-1;#nz=%#cz%-1;corner=%TRUE%;endif
     if(%#npm%==6);#nx=%#cx%;#nz=%#cz%-1;endif
     if(%#npm%==7);#nx=%#cx%+1;#nz=%#cz%-1;corner=%TRUE%;endif
     #ny=%#cy%
     UNSET(fail)
     //Check if node is pass-able
     GETID(%#nx%,%#ny%,%#nz%,&id);#id=TILEID(%&id%)
     UNSET(goodtogo)
     IF(%corner%)
     GETID(%#cx%,%#ny%,%#nz%,&id)
     #id1=TILEID(%&id%)
     GETID(%#nx%,%#ny%,%#cz%,&id)
     #id2=TILEID(%&id%)
     IF(((%#id1%==0) || (%#id1%==64) || (%#id1%==176) || (%#id1%==321) || (%#id1%==63) || (%#id1%==68)) && ((%#id2%==0) || (%#id2%==64) || (%#id2%==176) || (%#id2%==321) || (%#id2%==63) || (%#id2%==68)))
     #biny=%#ny%-1
     GETID(%#cx%,%#biny%,%#nz%,&id)
     #id1=TILEID(%&id%)
     GETID(%#nx%,%#biny%,%#cz%,&id)
     #id2=TILEID(%&id%)
     IF(((%#id1%==0) || (%#id1%==64) || (%#id1%==176) || (%#id1%==321) || (%#id1%==63) || (%#id1%==68)) && ((%#id2%==0) || (%#id2%==64) || (%#id2%==176) || (%#id2%==321) || (%#id2%==63) || (%#id2%==68)))
     SET(goodtogo)
     ENDIF
     ENDIF
     ELSE
     SET(goodtogo)
     ENDIF
     #holescore=-2
     IF(((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68)) && (goodtogo))
     
     UNSET(breaksearch)
     FOR(#down,1,5)
     #biny=%#ny%-%#down%
     GETID(%#nx%,%#biny%,%#nz%,&id)
     #id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     IF(!%breaksearch%)
     #holescore=%#down%-1
     ENDIF
     ELSE
     SET(breaksearch)
     ENDIF
     NEXT
     IF(%#holescore%==4)
     #holescore=-2
     ENDIF
     #biny=%#ny%+1
     GETID(%#nx%,%#biny%,%#nz%,&id);#id=TILEID(%&id%)
     IF((((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68)) && (!corner)) && (%#holescore%==-2))
     #biny=%#cy%+1
     GETID(%#cx%,%#biny%,%#cz%,&id);#id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     #biny=%#ny%-1
     GETID(%#nx%,%#biny%,%#nz%,&id);#id=TILEID(%&id%)
     IF(!((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68)))
     #holescore=-1
     ENDIF
     ENDIF
     ENDIF
     ENDIF
     IF(%#holescore%==-2)
     SET(fail)
     LOGTO(PathLog,%#npm% Neighbor is unreachable)
     ENDIF
     IF(!%fail%)
     UNSET(calibrated)
     DO
     GETID(%#nx%,%#ny%,%#nz%,&id)
     #id=TILEID(%&id%)
     IF((%#id%==0) || (%#id%==64) || (%#id%==176) || (%#id%==321) || (%#id%==63) || (%#id%==68))
     #ny=%#ny%-1
     ELSE
     #ny=%#ny%+2
     SET(calibrated)
     ENDIF
     UNTIL(%calibrated%)
     LOGTO(PathLog,%#npm% Neighbor can be reached, and has a holescore of %#holescore%)
     //Check if node has been created before
     ARRAYSIZE(#setx[],#size)
     DEC(#size)
     #nid=-1
     FOR(#i,0,%#size%)
     IF(%#setx[%#i%]%==%#nx%)
     IF(%#sety[%#i%]%==%#ny%)
     IF(%#setz[%#i%]%==%#nz%)
     #nid=%#i%
     LOGTO(PathLog,%#npm% Node has been linked to Neighbor)
     ENDIF
     ENDIF
     ENDIF
     NEXT
     //Discover new node
     IF(%#nid%==-1)
     PUSH(#setx[],%#nx%)
     PUSH(#sety[],%#ny%)
     PUSH(#setz[],%#nz%)
     PUSH(#setzdiff[],%#holescore%)
     PUSH(setisopen[],%TRUE%)
     INC(#setopencount)
     PUSH(#setcamefrom[],%#npm%)
     PUSH(#setcamefromid[],%#cid%)
     #bin=((%@#goalx%-%#nx%)*(%@#goalx%-%#nx%))+((%@#goalz%-%#nz%)*(%@#goalz%-%#nz%))
     SQRT(%#bin%,#fsc)
     #climb=%#holescore%*10
     IF(%#climb%<0)
     #climb=0-%#climb%
     ENDIF
     #fsc=(%#fsc%*10)+%#climb%
     IF((%#npl%==0) || (%#npl%==2) || (%#npl%==4) || (%#npl%==6))
     #travel=10
     ELSE
     #travel=20
     ENDIF
     #gcost=%#setgscore[%#cid%]%+%#climb%+%#travel%
     PUSH(#setgscore[],%#gcost%)
     #fc=%#fsc%+%#gcost%
     PUSH(#setfscore[],%#fc%)
     #nid=%#size%+1
     PUSH(#openids[],%#nid%)
     LOGTO(PathLog, %#npm% New node was created)
     endif
     LOGTO(PathLog,%#npm% Neighbor has been identified with ID %#nid%)
     //Check if is already closed, Ignore if it is
     if(!setisopen(%#nid%))
     SET(fail)
     endif
     
     
     // The distance from start to a neighbor, plus preferences
     #bin=((%@#goalx%-%#setx[%#nid%]%)*(%@#goalx%-%#setx[%#nid%]%))+((%@#goalz%-%#setz[%#nid%]%)*(%@#goalz%-%#setz[%#nid%]%))
     SQRT(%#bin%,#fsc)
     #climb=%#holescore%*10
     IF(%#climb%<0)
     #climb=0-%#climb%
     ENDIF
     #fsc=%#fsc%+%#climb%
     IF((%#npl%==0) || (%#npl%==2) || (%#npl%==4) || (%#npl%==6))
     #travel=10
     ELSE
     #travel=20
     ENDIF
     #gcost=%#setgscore[%#cid%]%+%#climb%+%#travel%
     if(%#gcost%>=%#setgscore[%#nid%]%)
     SET(fail)
     endif
     ENDIF
     IF(!%fail%)
     // This path is the best until now. Record it!
     #setcamefrom[%#nid%]=%#npm%
     #setcamefromid[%#nid%]=%#cid%
     #setgscore[%#nid%]=%#gcost%
     #setfscore[%#nid%]=%#fsc%+%#gcost%
     ENDIF
     NEXT
     ENDIF
     WHILE((%#setopencount%>0) && (!%makepath%))
    LOGTO(PathLog,Exited with %#setopencount% and %makepath%)
    #currentid=%@#cid%
    UNSET(@#xgoto[])
    UNSET(@#zgoto[])
    UNSET(@&nav1goto[])
    UNSET(@&nav2goto[])
    #cnt=-1
    DO
     INC(#cnt)
     @#xgoto[%#cnt%]=%#setx[%#currentid%]%
     @#zgoto[%#cnt%]=%#setz[%#currentid%]%
     @&nav1goto[%#cnt%]=Forward
     LOGTO(PathLog,Setting %#setx[%#currentid%]% and %#setz[%#currentid%]% with ID (%#currentid%)))
     IF(%#setzdiff[%#currentid%]%<0)
     @&nav2goto[%#cnt%]=Jump
     ELSE
     @&nav2goto[%#cnt%]=NUL
     ENDIF
     #currentid=%#setcamefromid[%#currentid%]%
    WHILE(%#currentid%>=0)
    LOGTO(PathLog,Ready!)
    LOGTO(PathLog,%#totalloopc%)
    
    
    //OTHERMACRO
    INC(#cnt)
    DO;
     DEC(#cnt)
     #xgoal=%@#xgoto[%#cnt%]%
     #zgoal=%@#zgoto[%#cnt%]%
     &movement1=%@&nav1goto[%#cnt%]%
     &movement2=%@&nav2goto[%#cnt%]%
     LOGTO(PathLog,Moving to (%#xgoal% %#zgoal%) with %&movement1% %&movement2%);
     DO;
     CALCYAWTO(%#xgoal%,%#zgoal%,#yaw,#dist);
     #y=%#yaw%+180;
     LOOKS(%#y%,+0);
     KEYDOWN(%&movement1%);
     KEYDOWN(%&movement2%);
     UNTIL(%#dist%<1 || %#cnt%<=0);
     KEYUP(%&movement2%); 
     WAIT(50ms);
     KEYUP(%&movement1%);
    WHILE((%receipt%==%@callid%) || (%#cnt% > 0))
    //END

    So basically, this is a pathfinder macro for Minecraft.

    With this being a macro, it's extremely slow, and gets even slower the more there is added to the array of nodes. So I was wondering. Could there be a way to harvest the existent Pathfinder for the mobs and apply it to some form of a macro command, to remove such as this?


    Also, this post is so big in scale, it takes a rather long time to type due to lag.


    Macro itself is not too smert. It does not know of any threats other than falling. And even then doesn't do too well at avoiding it. Anything that takes over 100 nodes is a pretty big waste of time.

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    Another question about arrays: Is there a command to remove a specified variable from an array, and move the rest upwards? Or would I have to do that through code?


    EDIT: I found a way to do it with code, but I still want to know, is it possible with a different method that is possibly faster?
    My method:

    #aremove=1
    ARRAYSIZE(#array[],#asize)
    DEC(#asize)
    FOR(#i,%#aremove%,%#asize%)
      #ii=%#i%+1
      IF(%#ii%<=%#asize%)
        #array[%#i%]=%#array[%#ii%]%
      ELSE
        POP(#array[],#bin)
      ENDIF
    NEXT
    Posted in: Minecraft Mods
  • 0

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

    Can someone make a macro that just plants, like holding down right click.


    Spams right-click, eh?
    I have this laying around for auto farming and stuff. Here, take it. Don't put blocks in front of it, or you will have a bad time.

    WAIT(250ms);
    IF(!%KEY_RIGHT%);
    DO;
       KEY(USE);
    UNTIL(%KEY_RIGHT%);
    ENDIF;
    Posted in: Minecraft Mods
  • 1

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


    1)

    How would I check if a certain macro is running? For example, I do:

    exec(guivital.txt,"name")






    Would it be possible to check if the text file named "guivital.txt" is running, or if the process named "name" is running?





    Have you tried using global variables?
    This is just one of the ways to solve this problem: (Well, in two forms, but I think you understand)



    If the code is supposed to run more than once in one occurrence, then you can use this method.

    pc / process count

    ${
     //Before start of code
     INC(@#filenamepc);
     //Code Starts
     //...
     //Code Ends
     DEC(@#filenamepc)
    }$



    If the code is supposed to run ONLY once, then you can make that global variable a flag instead.


    ${
     //Before start of code 
     IF(!@filenamepc);
     SET(@filenamepc);
     //Code Starts
     //...
     //Code Ends
     UNSET(@filenamepc)
     ENDIF;
    }$



    You can use that same variable in different scripts to check whether or not that macro is running, or how many occurrences of that macro exists.

    LOG(There are currently %@#filenamepc% occurences of the script filename)


    //There are currently (0-) occurrences of the script ______





    LOG(filename's current state is %@filenamepc%)


    //____'s current state is (False-True)

    Hope you got something good out of this

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    Thanks fellow humans:

    For the GETID and GETIDREL, I was using the in-game Cmd help. It stated to use # instead of &. I fixed my problem with this:

    GETIDREL(%#x%,%#y%,%#z%,&id); #id=TILEID(%&id%);

    Thank you also for telling me about how arrays work for this form of script. I kind-of got used to other formats.

    Off I go to create a pathfinder.

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    I have a few questions, again.

    __________________________


    How do I get the block ID at a specific coordinate? I have attempted using GETID() and GETIDREL(), but they always give me a value of 0.


    How do I use arrays in a macro? I already know that # is for integer, and & might be for string. Not sure if there is such for floats, but I do know there is some way to get arrays, based on some commands provided. What do I do?

    __________________________

    I want to create an A* pathfinder into a macro, and the Readme (readme.txt) isn't giving me any answers to my questions. Intended game version: 1.11.2


    Please reply as soon as possible

    Posted in: Minecraft Mods
  • 0

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


    I was trying to, then gave up. Also, variables for velocity would be nice.
    I was working on this:


    Place in onHealthChange
    Also have water bucket on 9th inventory slot
    
    
    #count = 0;
    WAIT(100ms);
    #intheight = YPOS;
    WAIT(500ms);
    IF(#intheight > YPOS);
        LOOK(+0,90);
        #panic = 6;
        DO();
            INC(#count);
            SLOT(9);
            LOOK(+0,90);
            IF(ITEM="water_bucket");
                KEY(USE);
                LOG(Used Water Object);
            ELSE;
                #panic = 0;
                LOG(Object is not Water);
            ENDIF;
            IF(#intheight = YPOS);
                #panic = #panic - 1;
                IF(#panic=0);
                    LOG(Panic ran out);
                ENDIF;
            ELSEIF(#panic!=0);
                #panic = 6;
            ENDIF;
            LOG(PANIC is %#panic%);
            #intheight = YPOS;
        WHILE(#panic>0);
        LOG(Script ended);
    ENDIF;
    LOG(Loops: %#count%)



    It works, somewhat.

    Posted in: Minecraft Mods
  • 0

    posted a message on Macro / Keybind Mod

    Will there ever be a boolean variable for whether the player is standing, on a ladder/vine, or variables for the direction that a player is looking?

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