Hi,
I just wrote my first script line for line by myself, and im having trouble with the first sub getting skipped. I'm not sure what the problem is, so i figured i would try to get some help here.
Im sure i did lots of things the hard way and ass backwards, but im still learning.
Btw, this script is meant to farm feathers from chickens, and when you get full drop them off at home.
EDIT: To be more clear the gosub setup book gets skipped when i start the script, it goes straight to gosub setup box.
;================================
;Kills chickens and loots feathers.
;By Slacker.
;================================
;set %box AYBUPMD ;set your drop box id here.
set %kill AG ; monster's id to kill, in this case chicken.
Set %cut HNF ;Item that cuts the corpse like a dagger.
Set %body YFM ; Id of bodies on ground, dont touch this.
set %loot VLK ;Id of items to loot off bodie.
;Set %Rbook WSMIMMD ;set your rune book id here.
;================================
gosub setup book
gosub setup box
gosub stablecheck
goto Main loop
;================================
Main loop:
gosub Find
gosub Kill
gosub Findncut
gosub Open Dead
gosub Loot
gosub Unload
goto Main loop
;================================
Sub Find
finditem %kill G_10
if #findkind = -1
{
Gosub Find
}
Return
Sub Kill
Set #ltargetid #FINDID
event macro 15 17
target 3s
event macro 22 0
wait 3s
return
sub Findncut
finditem %cut C_ , #BACKPACKID
Set #LOBJECTID #FINDID
event macro 17 0
wait 1s
finditem YFM G_10
move #FINDX #FINDY
wait
Set #ltargetid #FINDID
event macro 22
Return
Sub Open Dead
FINDITEM %body G_
set #LobjectID #FINDID
event macro 17 0
set %deadbody #CONTID
Return
Sub Loot
wait 1s
finditem %loot C_
if #findkind <> -1
{
exevent drag #FINDID #FINDSTACK
wait 15
exevent dropc #BACKPACKID
wait 15
ignoreitem #findid
}
finditem %items C_
if #findkind <> -1
{
goto loot
}
ignoreitem %deadbody
Return
Sub Unload
set %weight #MAXWEIGHT - 25
if #WEIGHT > %weight
{
wait 1s
finditem %Rbook C_ , #BACKPACKID
set #LobjectID #findID
event macro 17 0
wait 8
set %xclick #contposx + 135
set %yclick #contposy + 192
click %xclick %yclick
wait 8
set %xclick #contposx + 136
set %yclick #contposy + 144
click %xclick %yclick
wait 4s
Drop:
finditem %loot C_ #BACKPACKID
exevent drag #FINDID #FINDSTACK
wait 15
exevent dropc %box
wait 15
finditem %loot C_ #BACKPACKID
if #findkind <> -1
{
goto Drop
}
wait 2s
finditem %Rbook C_ , #BACKPACKID
set #LobjectID #findID
event macro 17 0
wait 8
set %xclick #contposx + 135
set %yclick #contposy + 192
click %xclick %yclick
wait 8
set %xclick #contposx + 295
set %yclick #contposy + 144
click %xclick %yclick
wait 4s
move 1294 1768
}
Return
Sub setup book
event SysMessage pls Target your rune book fool!!!
event SysMessage pls Target your rune book fool!!!
event SysMessage pls Target your rune book fool!!!
event SysMessage pls Target your rune book fool!!!
set #lTargetID X
set #targCurs 1
wait 2
Bookid:
if #lTargetID = X
{
goto Bookid
}
set %Rbook #LTARGETID
finditem %Rbook C_ , #BACKPACKID
set #LobjectID #findID
event macro 17 0
wait 8
set %xclick #contposx + 135
set %yclick #contposy + 192
click %xclick %yclick
wait 8
set %xclick #contposx + 136
set %yclick #contposy + 144
click %xclick %yclick
wait 1s
set %boxcheck #CHARPOSX
return
Sub setup box
event SysMessage Now target your box hoe!!!
event SysMessage Now target your box hoe!!!
event SysMessage Now target your box hoe!!!
event SysMessage Now target your box hoe!!!
set #lTargetID X
set #targCurs 1
wait 2
boxid:
if #lTargetID = X
{
goto boxid
}
set %box #LTARGETID
return
Sub stablecheck
finditem %Rbook C_ , #BACKPACKID
set #LobjectID #findID
event macro 17 0
wait 8
set %xclick #contposx + 135
set %yclick #contposy + 192
click %xclick %yclick
wait 8
set %xclick #contposx + 295
set %yclick #contposy + 144
click %xclick %yclick
wait 4s
set %stallcheck #CHARPOSX
wait 1s
move 1294 1768
return