Moving all ship cargo to hangar

I cannot get my bot to move my ship's cargo to my item hangar for the life of me. I read the documentation here, and I tried basically every combination of possible arguments for the MoveTo() method to no avail.

My Code:
Code:
echo("Storing Cargo");
using (new FrameLock(true))
{
    Ext.Me.Ship.StackAllCargo();
    List<Item> cargo = Ext.Me.Ship.GetCargo();
    foreach (Item i in cargo)
    {
        echo("Storing " + i.Name + ".");
        Ext.Me.Ship.Cargo(i.Name).MoveTo(1, "Hangar");
    }
}
In MoveTo, I tried basically every combination, not just the one above.

In the docs, it says
Possible Destinations:
1. CargoHold (The traditional cargo hold)
2. DroneBay
....
13. Hangar (For this destination, you can enter any positive integer for the ID#)
So I tried that. But the part that confuses me is that just before the list of possible destinations, it says
Can be used in place of <ID#>
1. MyShip
2. MyStationHangar
3. MyStationCorporateHangar
So which is it? What do I put if I want to move an item from my ship to my item hangar?
 

MitzuriX

Member
Since the hauler is able to unload cargo without a problem in the current version of evebot, i started poking around there and went thru hauler.iss and cargo.iss, to eventually find what I think you need:

EVE:MoveItemsTo
[ListToMove, MyStationHangar, Hangar] (this is one line, not sure why the forum makes it two, even with #code tags)

I'm not sure exactly how much of evebots code can translate to writing a bot in .NET but, I think that evebot's code is a good place to look for this kinda thing, even better than the wiki. provided you can read it..
 
Resolved. Final source code that got it to work:
Code:
using (new FrameLock(true))
{
   Ext.Me.Ship.StackAllCargo();
   List<Item> cargo = Ext.Me.Ship.GetCargo();
   foreach (Item i in cargo)
   {
      //echo("Storing " + i.Name + ".");
      i.MoveTo("MyStationHangar", "Hangar");
   }
}
 

Amadeus

The Maestro
Staff member
If you're going to move everything (or a large number of items) you really should use MoveItemsTo and send the entire list -- rather than doing them one at a time.

This script, from EVESalvage, shows this and should be easily portable to .net:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Populate the Cargo To Transfer (when salvaging is complete)
function PopulateCargoToTransfer(string CargoType)
{
    
    variable iterator ThisCargo

  wait 10
  call OpenShipCargo
    wait 20

    MyShip:GetCargo[MyCargo]
    if (${MyCargo.Used} == 0)
    {
        call CloseShipCargo
        wait 10
        call OpenShipCargo
        wait 10
        MyShip:GetCargo[MyCargo]
    }                    
                    
    CargoToTransfer:Clear[]
    MyCargo:GetIterator[ThisCargo]
    if ${ThisCargo:First(exists)}
    {
        if (${CargoType.Equal["Salvage"]})
        {
            do
            {
                variable int GroupID
                GroupID:Set[${ThisCargo.Value.GroupID}]
                
                ;variable string Name
                ;Name:Set[${ThisCargo.Value.Name}]
                ;echo "EVESalvage->PopulateCargoToTransfer[DEBUG]::  GroupID: ${GroupID} ${Name} - ${ThisCargo.Value.Quantity}"            
                
                switch ${GroupID}
                {
                    case GROUPID_SALVAGEDITEM
                        CargoToTransfer:Insert[${ThisCargo.Value.ID}]
                        break
                    default
                        break
                }
            }
            while ${ThisCargo:Next(exists)}
        }
        elseif (${CargoType.Equal["Loot"]})
        {
            do
            {
                ;echo "EVESalvage->PopulateCargoToTransfer[DEBUG]::  CargoholdLoot.Element[ThisCargo.Value.ID]: ${CargoholdLoot.Element[${ThisCargo.Value.ID}]}"
                if (${CargoholdLoot.Element[${ThisCargo.Value.ID}](exists)})
                    CargoToTransfer:Insert[${ThisCargo.Value.ID}]
            }
            while ${ThisCargo:Next(exists)}
        }
    }
    
    return
}
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Transfer all salvaged items and loot to the station hanger present when this function is called
;; (NOTE:  This function will only transfer those items looted since the library was initialized, 
;;         not everything that is in the ship's cargo hold.)
function TransferSalvagedItemsAndLootToHangar()
{    
    if (!${Me.InStation})
    {
        return
    }    
    
    echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  --- Opening Hangar..."
    if !${EVEWindow[ByName,"Inventory"](exists)}
    {
        EVE:Execute[OpenInventory]
        wait 25
    }    
    
    echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  --- Unloading Salvaged Items..."
    call PopulateCargoToTransfer "Salvage"
    if (${CargoToTransfer.Used} > 0)
    {
        echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  ---- ${CargoToTransfer.Used} items found..."
        if (${UseCorpHangar})
        {
            echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  ----- Transferring items to your corporation's hangar ['${CorpFolderToUse}']"
            EVE:MoveItemsTo[CargoToTransfer, MyStationCorporateHangar, StationCorporateHangar, ${CorpFolderToUse}]
        }
        else
        {
            echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  ----- Transferring items to your personal hangar"
            EVE:MoveItemsTo[CargoToTransfer, MyStationHangar, Hangar]
        }
    }
    if (${DoLoot})
    {
        echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  --- Unloading Loot..."
        call PopulateCargoToTransfer "Loot"
        if (${CargoToTransfer.Used} > 0)
        {
            echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  ---- ${CargoToTransfer.Used} items found..."
            if (${UseCorpHangar})
            {
                echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  ----- Transferring items to your corporation's hangar ['${CorpFolderToUse}']"
                EVE:MoveItemsTo[CargoToTransfer, MyStationCorporateHangar, StationCorporateHangar, ${CorpFolderToUse}]
            }
            else
            {
                echo "EVESalvage->TransferSalvagedItemsAndLootToHangar::  ----- Transferring items to your personal hangar"
                EVE:MoveItemsTo[CargoToTransfer, MyStationHangar, Hangar]    
            }
        }
    }
    
    EVEWindow[ByName,"Inventory"]:MakeChildActive[StationItems]
    wait 5
    EVEWindow[ByName,"Inventory"]:StackAll
    wait 10
    EVEWindow[ByName,"Inventory"]:MakeChildActive[ShipCargo]
    wait 5
    EVEWindow[ByName,"Inventory"]:StackAll
    wait 5
    EVEWindow[byName, "Inventory"]:Close
}
 

stealthy

ISX Specialist
Resolved. Final source code that got it to work:
Code:
using (new FrameLock(true))
{
   Ext.Me.Ship.StackAllCargo();
   List<Item> cargo = Ext.Me.Ship.GetCargo();
   foreach (Item i in cargo)
   {
      //echo("Storing " + i.Name + ".");
      i.MoveTo("MyStationHangar", "Hangar");
   }
}
Ship.StackAllCargo is deprecated. Use the EveInvWindow stack method, which will stack cargo of the active cargohold window.

Don't stack cargo and move cargo in the same frame. No human can do so; your bot shouldn't do it.
 
Top Bottom