This snippet loots everything from a container entity called "Cargo Container". You could easily modify this for looting wrecks as well as specifying particular types of things you wanted to loot (rather than looting everything.)
Code:
function main()
{
variable string ContainerName = "Cargo Container"
variable index:item ContainerCargo
variable int i = 1
; Make sure that there is actually a cargo container there that matches the name we set
if (!${Entity[Name =- "${ContainerName}"](exists)})
{
echo No Entities in the area that match the name you provided.
return
}
; If it exists, get close enough to it!
if (${Entity[Name =- "${ContainerName}"].Distance} > 1300)
{
Entity[Name =- "${ContainerName}"]:Approach
do
{
wait 20
}
while ${Entity[Name =- "${ContainerName}"].Distance} > 1300
}
; Always open the cargo container window
Entity[Name =- "${ContainerName}"]:OpenCargo
wait 30
Entity[Name =- "${ContainerName}"]:GetCargo[ContainerCargo]
do
{
ContainerCargo.Get[${i}]:MoveTo[MyShip]
wait 15
}
while ${i:Inc} <= ${ContainerCargo.Used}
; After everything is looted...let's clean up our Cargo
Me.Ship:StackAllCargo
; Now close the cargo window (if it's still open)
Entity[${ContainerName}]:CloseCargo
wait 5
echo Script Ended
}