Ok i am kinda confused. What are you wanting to do exatly? Are you wanting to recall to the bank, unload your stuff, restock you if needed and continue on your way? You ask for code on how to bring up a target cursor and then use it to pick a bag. I was assumeing that you wanted that as part of your setup section of your script.
I just wrote my first fully auto leather gathering script and this is the basic jest of it
;-----------------------------------------------------------------------
; stuff you need to set to make script work RIGHT
;-----------------------------------------------------------------------
Set %beatle MAGK ; Id of your beetle
set %beatlepack UTFSZMD ; pack inside of beetle
set %lootbag RHIJJND ; bag inside your backpack for loot
set %resourcebox CZANLMD ; ID of secure within reach of homerune
set %heavyshit JJG_sto_pof_guf ; items you want moved to the beetle
set %dropspot_runebookid ZFUEBRD ; default runebook for drop location
set %hunted_runebookid BYLKBRD ; default runebook for dungeon
set %magery false ; true = recall false = sacred journey
set %healspell 202 ; 28 = greater heal, 3 = Heal, 202 = Close Wounds
set %loot JJG_OZF_DEG_rwf_guf_sto_pof_TTO_GMF_OKF ; stuff you want to loot
set %the_hunted ih_FE_AE_uf_QE_AF_ye_XE_DF_CD_RGB_PGB_SGB_JD_gb ; critters to kill
set %Evade_Critters ye_XE_DF_CD
;--------------------------------------------------------------------
set %knives CNF_GMH ; tools use to cut corpses dagger_skinning knife_
set %VSwait 5 ; very short wait
set %MSwait 10 ; medium wait
set %LSwait 15 ; long wait
gosub setup
gosub Define_rail
gosub steed setup
;------------------------------
;Main loop
;------------------------------
start:
gosub weightcheck
gosub recall_to_spot %dropspot_runebookid
gosub positionpacks
gosub unloadall
gosub recall_to_spot %hunted_runebookid
gosub positionpacks
gosub enter_level_1
if %menu_check = start
{
for %i 1 %endspot
{
gosub remount
gosub check_health
gosub menu_check
set %oldcharposx #charposx
set %oldcharposy #charposy
set %oldcharposz #charposz
set %x %x . %i
set %y %y . %i
set %z %z . %i
gosub Weightcheck
gosub moveto_spot %x %y %z %oldcharposx %oldcharposy
set %enemyfound false
repeat
{
gosub kill
}
until %enemyfound = false
set %corpsefound false
repeat
{
gosub findcorpse
gosub moveto_spot %x %y %z %oldcharposx %oldcharposy
gosub check_health
gosub kill
}
until %corpsefound = false
}
gosub leave_level_1
goto start
that is just the main loop, I have 21 other subs that handle the auto killing, moving, checking health, weight, mana, when to recall to unload, when to restock..... The list goes on.
this is the restock sub
Sub Supply_check
Finditem RWF C_ , #backpackid ; this is arrows
if #FINDSTACK < 100
{
set %tograb 300 - #FINDSTACK
set #lobjectid %resourcebox
wait %vSwait
event macro 17 0
wait %vSwait
contpos 0 0
wait %vSwait
Finditem RWF C_ , %resourcebox
IF #FINDSTACK >= %tograb
{
exevent drag #findid %tograb
exevent dropc #backpackid
wait %MSwait
}
Else
{
event exmsg #charid 3 70 Out of arrows
halt
}
}
finditem ZLF C_ , #backpackid ; this is bandaids
if #findstack < 25
{
set %tograb 100 - #FINDSTACK
set #lobjectid %resourcebox
wait %vSwait
event macro 17 0
wait %vSwait
contpos 0 0
wait %vSwait
Finditem ZLF C_ , %resourcebox
IF #FINDSTACK >= %tograb
{
exevent drag #findid %tograb
exevent dropc #backpackid
wait %MSwait
}
Else
{
event exmsg #charid 3 70 Out of arrows
halt
}
}
return
As you can see in that sub, i search my pack for arrows and then if the amount of arrows are lower than 100 it will restock me back to 300 arrows. The same goes with the bandaids. You just need to make sure you have enough on you to make a complete round between what you are doing and your recalling to the bank.
The restocking code above is about the best I have come up with so it should give you a good start on how its done.