@main:
gotoifbagfull(@bury)
setvarinvcount(%items)
gotoifnum1belownum2(@cakes1,%items,14)
setvarcurrentstat(%hp,3)
gotoifnum1belownum2(@eat,%hp,45)
gotoiffighting(@reattackc)
gotoifnpcnear(@attack,594)
gotoiffighting(@main)
wait(200)
goto(@pickbones)

@reattackc:
setvarfatigue(%f)
gotoifnum1abovenum2(@sleep,%f,99)
setvarmyx(%x)
setvarmyy(%y)
walknowait(%x,%y)
wait(300)
attacknearestnpcincombat(594)
wait(300)
gotoiffighting(@reattack)
wait(300)
gotoifitemwithindist(@pickbones,413,0)
goto(@main)

@pickbones:
setvarsnearestitem(%x,%y,413)
takeitembyname(%x,%y,big bones)
wait(400)
goto(@main)

@bury:
setvarfatigue(%f)
gotoifnum1equalnum2(@sleep,%f,100)
useitembyid(413)
wait(500)
gotoifininventory(@bury,413)
goto(@main)

@bury3:
setvarfatigue(%f)
gotoifnum1equalnum2(@sleep,%f,100)
useitembyid(413)
wait(500)
gotoifininventory(@bury3,413)
goto(@cakes)

@attack:
setvarfatigue(%f)
gotoifnum1abovenum2(@sleep,%f,99)
fightmode(3)
attacknearestnpc(594,true)
wait(200)
goto(@main)

@sleep:
opendoor(520,663)
walknowait(519,664)
wait(500)
gotoifcoordsin(@sleep2,518,663,521,666)
goto(@sleep)
@sleep2:
wait(2000)
objcmd1(519,665)
wait(2000)
waitforwakeup(28000)
gotoifsleeping(@sleep2)
goto(@bury3)

@eat:
setvarmyx(%x)
setvarmyy(%y)
walknowait(%x,%y)
wait(100)
gotoiffighting(@eat)
@eat2:
eatanything()
wait(2000)
goto(@main)

@cakes1:
opendoor(520,663)
walknowait(519,664)
wait(500)
gotoifcoordsin(@bury3,518,663,521,666)
goto(@cakes1)
@cakes:
takeitembyname(519,663,Slice of Cake)
setvarinvcount(%items)
wait(1000)
gotoifnum1abovenum2(@leave,%items,26)
goto(@cakes)

@leave:
opendoor(520,663)
walknowait(520,662)
wait(500)
setvarmyy(%y)
gotoifnum1belownum2(@main,%y,663)
goto(@leave)

@kill:
stopandlogout()