$${
if(autoputv4);
log("&d» &6AutoPUT &c[OFF]");
unset(autoputv4);
keyup(back);
keyup(sneak);
stop();
else;
log("&d» &6AutoPUT &a[ON]");
#tic2=%@#tic2%;
set(autoputv4);
PROMPT(&itemid,$$i,"Item que será usado:"); ifmatches(%#itemid%,^$);unset(autoputv4);stop();endif;
PROMPT(#nlado,$$?,"Comprimento:"); if(%#nlado%=0);unset(autoputv4);stop();endif;
PROMPT(#nlado1,$$?,"Largura:"); if(%#nlado1%=0);unset(autoputv4);stop();endif;
log("&d» &6Deixe o inventório aberto!");
#calc1=%#lado%/2;
#calc2=%#calc1%*2;
#ih45=%#lado%-%#calc1%;
#nladox=%#nlado%;
#nlado1x=%#nlado1%
#nlado=%#nlado%;
#impvar=%#nlado1%;
#nlado1=%#nlado1%/2;
#imp=%#impvar%-(%#nlado1%*2);
if(%#imp%=1);#nlado1=%#nlado1%+1;endif;
&dir = %DIRECTION%;
ifmatches(%&dir%,N);&dir=NORTH;endif;
ifmatches(%&dir%,S);&dir=SOUTH;endif;
ifmatches(%&dir%,E);&dir=EAST;endif;
ifmatches(%&dir%,W);&dir=WEST;endif;
set(ftpass);
gui(inventory);
wait(800ms);
#dims=%#nladox%*%#nlado1x%;
#tpacks=%#dims%/64;
&tpacks=;
if(%#tpacks%!=0);&tpacks="%#tpacks% packs e ";endif;
#trest=%#dims%-(#tpacks*64);
if(%#trest%!=0);&trest="%#trest% blocos";else;&trest=;endif;
#stack=0;
#stackx=0;
gui(inventory);
wait(1);
for(#capac,9,44);
getslotitem(%#capac%,&id,#stack);
ifmatches(%&id%,%&itemid%);#stackx=%#stackx%+%#stack%;endif;
next;
if(%#dims%>%#stackx%);
gui();
log("&d» &cOps! &6Total de itens no inventário insuficiente.
");
log("&d» &6Para esse tamanho são necessários &9%&tpacks%%&trest%.");
log("&d» &6AutoPUT &c[OFF]");
unset(autoputv4);
stop();
endif;
log("&d» &6Área de dimensões &9%#nladox% &6por &9%#nlado1x%&6.");
log("&d» &6Total de blocos: &9%#dims% &6blocos. ");
for(#nii,1,%#nlado1%);
for(#ucris,1,2);
getslot(%&itemid%,#i);
if(%#i%<36);
slotclick(%#i%,l,true);
endif;
if(%#i%=-1);unset(autoputv4);log("&d» &6Acabaram os itens :/ &c[OFF]");log("&d» &6AutoPUT &c[OFF]");stop();endif;
if((%#ucris%=2)&&(%#nlado1%=%#nii%)&&(%#imp%=1));
else;
if(%#ucris%=1);
&loc=+90;
&side=left;
endif;
if(%#ucris%=2);
&loc=-90;
&side=right;
endif;
&dir=%DIRECTION%;
ifmatches(%&dir%,N);&dir=NORTH;endif;
ifmatches(%&dir%,S);&dir=SOUTH;endif;
ifmatches(%&dir%,E);&dir=EAST;endif;
ifmatches(%&dir%,W);&dir=WEST;endif;
do(%#nlado%);
keydown(sneak);
look(%&dir%);
look(,+83);
#nposx1 = %XPOS%; #nposx2 = %ZPOS%;
do;
keydown(back);
pick(%&itemid%);
key(use);
until((%XPOS%=%#nposx1%+1)|(%XPOS%=%#nposx1%-1)|(%ZPOS%=%#nposx2%+1)|(%ZPOS%=%#nposx2%-1));
loop;
#nposx1 = %XPOS%; #nposx2 = %ZPOS%;
if(((%#ucris%=1)&&(%#nlado1%=%#nii%)&&(%#imp%=1))|((%#ucris%=2)&&(%#nlado1%=%#nii%)&&(%#imp%=0)));
else;
look(%&loc%,);
do;
keydown(back);
until((%XPOS%=%#nposx1%+1)|(%XPOS%=%#nposx1%-1)|(%ZPOS%=%#nposx2%+1)|(%ZPOS%=%#nposx2%-1));
wait(200ms);
keyup(back);
#nposx1 = %XPOS%; #nposx2 = %ZPOS%;
do;
keydown(%&side%);
until((%XPOS%=%#nposx1%+1)|(%XPOS%=%#nposx1%-1)|(%ZPOS%=%#nposx2%+1)|(%ZPOS%=%#nposx2%-1));
wait(100ms);
pick(%&itemid%);
key(use);
wait(100ms);
key(use);
wait(100ms);
key(use);
wait(200ms);
keyup(%&side%);
look(%&loc%,);
endif;
endif;
next;
next;
keyup(back);
do;
keydown(FORWARD);
until((%XPOS%=%#nposx1%+1)|(%XPOS%=%#nposx1%-1)|(%ZPOS%=%#nposx2%+1)|(%ZPOS%=%#nposx2%-1));
wait(40ms);
keyup(FORWARD);
keyup(sneak);
gui();
log("&d» &6AutoPUT &c[OFF]");
unset(autoputv4);
stop();
endif;
}$$