Problem with scavenger

Lestar73

Active Member
ship warp to belt_bookmark
ship warp to closest wreck
open wreck, open ship_cargo
Get Entites in wreck

NOT loot

warp to next belt bookmark

Code:
	function LootClosestWreck()
	{
		variable index:entity Wrecks
		variable iterator     Wreck
		variable index:item   Items
		variable iterator     Item
		variable index:int    ItemsToMove
		variable float        TotalVolume = 0
		variable float        ItemVolume = 0

		/* only look for wrecks within 3000 meters */
		EVE:DoGetEntities[Wrecks,GroupID,GROUPID_WRECK,Radius,3000]
		Wrecks:GetIterator[Wreck]
		if ${Wreck:First(exists)}
		{
			do
			{
				if ${Wreck.Value(exists)} && ${Wreck.Value.IsWreckEmpty} == FALSE
				{
					call Ship.Approach ${Wreck.Value.ID} LOOT_RANGE
					Wreck.Value:OpenCargo
					wait 10				
					call Ship.OpenCargo
					wait 10				
					Wreck.Value:DoGetCargo[Items]
					UI:UpdateConsole["obj_Scavenger: DEBUG:  Wreck contains ${Items.Used} items."]
					
					Items:GetIterator[Item]
					if ${Item:First(exists)}
					{
						do
						{
							ItemVolume:Set[${Item.Value.Quantity} * ${Item.Value.Volume}]
							if ${Math.Calc[${ItemVolume} + ${TotalVolume}]} < ${Ship.CargoFreeSpace}				
							{
								ItemsToMove:Insert[${Item.Value.ID}]
								TotalVolume:Set[${Math.Calc[${ItemVolume} + ${TotalVolume}]}]
							}
						}
						while ${Item:Next(exists)}
					}
					
					if ${ItemsToMove.Used} > 0
					{
echo "in IF"   <==== work, ItemsToMove.Used > 0 
[COLOR="Red"]EVE:MoveItemsTo[ItemsToMove, MyShip][/COLOR] <==== not   work
						wait 10 <==== if wait  100 or  wait  200 - not    work
					}

					return
				}
			}
			while ${Wreck:Next(exists)}
		}
	}
}
help please
 

GliderPro

Active Member
What did this line print in the log?

UI:UpdateConsole["obj_Scavenger: DEBUG: Wreck contains ${Items.Used} items."]
 

Lestar73

Active Member
What did this line print in the log?

UI:UpdateConsole["obj_Scavenger: DEBUG: Wreck contains ${Items.Used} items."]
full log

Code:
12:07:44: 2: Warping to bookmark BELT 1	 (Attempt #1)
12:07:49: Warping...
12:07:49: Reloading Weapons...
12:08:29: Dropped out of warp
12:08:32: obj_Scavenger: DEBUG: Found 1 wrecks.
12:08:32: obj_Scavenger: DEBUG: 2100278032 197582.421875 FALSE
12:08:32: Preparing for warp
12:08:32: Warping to NPC Wreck @ 0km
12:08:35: Warping...
12:08:35: Reloading Weapons...
12:08:42: Memory: Microsoft Windows XP Process: 367076kb Free: 402mb Texture Mem Free: 338mb FPS: 11 Windowed: TRUE(TRUE) Foreground: FALSE
12:08:54: Dropped out of warp
12:08:55: Approaching: NPC - 4 Seconds away
12:08:55: Activating LiF Fueled I Booster Rockets
12:09:05: Deactivating LiF Fueled I Booster Rockets
12:09:06: Opening Ship Cargohold
[COLOR="Red"]12:09:09: obj_Scavenger: DEBUG:  Wreck contains 8 items.[/COLOR]
12:09:18: Preparing for warp
12:09:18: 2: Warping to bookmark BELT 2	 (Attempt #1)
 

GliderPro

Active Member
I don't have time to test this. Are you comfortable changing the code? Try this version with more debug in it and post the output.

Code:
   function LootClosestWreck()
   {
      variable index:entity Wrecks
      variable iterator     Wreck
      variable index:item   Items
      variable iterator     Item
      variable index:int    ItemsToMove
      variable float        TotalVolume = 0
      variable float        ItemVolume = 0

      /* only look for wrecks within 3000 meters */
      EVE:DoGetEntities[Wrecks,GroupID,GROUPID_WRECK,Radius,3000]
      Wrecks:GetIterator[Wreck]
      if ${Wreck:First(exists)}
      {
         do
         {
            if ${Wreck.Value(exists)} && ${Wreck.Value.IsWreckEmpty} == FALSE
            {
               call Ship.Approach ${Wreck.Value.ID} LOOT_RANGE
               Wreck.Value:OpenCargo
               wait 10           
               call Ship.OpenCargo
               wait 10           
               Wreck.Value:DoGetCargo[Items]
               UI:UpdateConsole["obj_Scavenger: DEBUG:  Wreck contains ${Items.Used} items."]
               
               Items:GetIterator[Item]
               if ${Item:First(exists)}
               {
                  do
                  {
                     ItemVolume:Set[${Item.Value.Quantity} * ${Item.Value.Volume}]
                     UI:UpdateConsole["obj_Scavenger: DEBUG:  volume =  ${ItemVolume}, total =  ${TotalVolume}, free space = ${Ship.CargoFreeSpace}."]
                      if ${Math.Calc[${ItemVolume} + ${TotalVolume}]} < ${Ship.CargoFreeSpace}            
                     {
                        ItemsToMove:Insert[${Item.Value.ID}]
                        TotalVolume:Set[${Math.Calc[${ItemVolume} + ${TotalVolume}]}]
                     }
                  }
                  while ${Item:Next(exists)}
               }
               
               if ${ItemsToMove.Used} > 0
               {
                  UI:UpdateConsole["obj_Scavenger: DEBUG:  moving ${ItemsToMove.Used} items."]
                  EVE:MoveItemsTo[ItemsToMove, MyShip]
                  wait 10
               }

               return
            }
         }
         while ${Wreck:Next(exists)}
      }
   }
}
 

Lestar73

Active Member
20:21:04: Preparing for warp
20:21:05: 2: Warping to bookmark BOOKMARK1 (Attempt #1)
20:21:09: Warping...
20:21:09: Reloading Weapons...
20:21:20: Memory: Windows Vista (TM) Enterprise Process: 362652kb Free: 111mb Texture Mem Free: 437mb FPS: 18 Windowed: TRUE(TRUE) Foreground: FALSE
20:21:41: Dropped out of warp
20:21:44: obj_Scavenger: DEBUG: Found 3 wrecks.
20:21:44: obj_Scavenger: DEBUG: 2100138580 184596.375000 FALSE
20:21:44: Preparing for warp
20:21:44: Warping to Angel War General Wreck @ 0km
20:21:48: Warping...
20:21:48: Reloading Weapons...
20:22:06: Dropped out of warp
20:22:07: Approaching: Angel War General Wreck - 4 Seconds away
20:22:07: Activating LiF Fueled I Booster Rockets
20:22:17: Deactivating LiF Fueled I Booster Rockets
20:22:18: Opening Ship Cargohold
20:22:20: Memory: Windows Vista (TM) Enterprise Process: 335540kb Free: 283mb Texture Mem Free: 426mb FPS: 50 Windowed: TRUE(TRUE) Foreground: TRUE
20:22:20: obj_Scavenger: DEBUG: Wreck contains 6 items.
20:22:20: obj_Scavenger: DEBUG: moving 6 items.
20:22:28: Preparing for warp
20:22:28: 2: Warping to bookmark BOOKMARK2 (Attempt #1)
20:22:31: Warping...
ship for loot - drake
 

GliderPro

Active Member
Hmm. That is odd. It got into the if statement at the end but it didn't print out the item info from the debug statement about. Did you edit the function exactly as I entered it?

Since it is getting into the if statement, EVE:MoveItemsTo is being called. This same function is used all over EveBot so I doubt it is broken.
 

Lestar73

Active Member
i sorry
after copy/paste full function

00:18:51: obj_Freighter: Initialized
00:18:51: obj_Combat: Initialized
00:18:51: obj_Combat: Initialized
00:18:51: obj_Ratter: Initialized
00:18:51: obj_Missioneer: Initialized
00:18:52: -=Paused: Press Run-=
00:18:54: Resumed
00:18:56: Undocking
00:19:03: Enabling 3D Rendering
00:19:10: Undock: Complete
00:19:23: Module Inventory:
00:19:23: Weapons:
00:19:23: Active Resistance Modules:
00:19:23: Slot: MedSlot5 V-M15 Braced Multispectral Shield Matrix
00:19:23: Slot: MedSlot4 F-S15 Braced Deflection Shield Matrix
00:19:23: Passive Modules:
00:19:23: Mining Modules:
00:19:23: Armor Repair Modules:
00:19:23: Shield Regen Modules:
00:19:23: AfterBurner Modules:
00:19:23: Slot: MedSlot0 LiF Fueled I Booster Rockets
00:19:23: Salvaging Modules:
00:19:23: Slot: HiSlot7 Salvager I
00:19:23: Slot: HiSlot4 Salvager I
00:19:23: Slot: HiSlot5 Salvager I
00:19:23: Slot: HiSlot6 Salvager I
00:19:23: Tractor Beam Modules:
00:19:23: Slot: HiSlot1 Small Tractor Beam I
00:19:23: Slot: HiSlot0 Small Tractor Beam I
00:19:23: Slot: HiSlot3 Small Tractor Beam I
00:19:23: Slot: HiSlot2 Small Tractor Beam I
00:19:23: Cloaking Device Modules:
00:19:23: Stasis Web Modules:
00:19:23: Sensor Boost Modules:
00:19:23: obj_Ship: DEBUG: Setting ship type to Drake
00:19:23: obj_Ship: DEBUG: Setting ship type ID to 24698
00:19:24: Preparing for warp
00:19:24: 2: Warping to bookmark Bookmark1 (Attempt #1)
00:19:26: Warping...
00:19:26: Reloading Weapons...
00:19:47: Memory: Windows Vista (TM) Enterprise Process: 327868kb Free: 369mb Texture Mem Free: 426mb FPS: 58 Windowed: TRUE(TRUE) Foreground: TRUE
00:19:57: Dropped out of warp
00:20:00: obj_Scavenger: DEBUG: Found 0 wrecks.
00:20:08: Preparing for warp
00:20:08: 2: Warping to bookmark Bookmark2 (Attempt #1)
00:20:10: Warping...
00:20:10: Reloading Weapons...
00:20:47: Memory: Windows Vista (TM) Enterprise Process: 339576kb Free: 355mb Texture Mem Free: 428mb FPS: 47 Windowed: TRUE(TRUE) Foreground: TRUE
00:20:57: Dropped out of warp
00:21:00: obj_Scavenger: DEBUG: Found 1 wrecks.
00:21:00: obj_Scavenger: DEBUG: 2100254960 224491.984375 FALSE
00:21:00: Preparing for warp
00:21:00: Warping to Angel Saint Wreck @ 0km
00:21:03: Warping...
00:21:03: Reloading Weapons...
00:21:18: Dropped out of warp
00:21:19: Approaching: Angel Saint Wreck - 4 Seconds away
00:21:19: Activating LiF Fueled I Booster Rockets
00:21:29: Deactivating LiF Fueled I Booster Rockets
00:21:30: Opening Ship Cargohold
00:21:33: obj_Scavenger: DEBUG: Wreck contains 6 items.
00:21:33: obj_Scavenger: DEBUG: volume = 50.000000, total = 0.000000, free space = 345.000000.
00:21:33: obj_Scavenger: DEBUG: volume = 3.500000, total = 50.000000, free space = 345.000000.
00:21:33: obj_Scavenger: DEBUG: volume = 20.000000, total = 53.500000, free space = 345.000000.
00:21:33: obj_Scavenger: DEBUG: volume = 5.000000, total = 73.500000, free space = 345.000000.
00:21:33: obj_Scavenger: DEBUG: volume = 25.000000, total = 78.500000, free space = 345.000000.
00:21:33: obj_Scavenger: DEBUG: volume = 20.000000, total = 103.500000, free space = 345.000000.
00:21:33: obj_Scavenger: DEBUG: moving 6 items.
00:21:40: Preparing for warp
00:21:40: 2: Warping to bookmark Bookmark3 (Attempt #1)
00:21:42: Warping...
00:21:42: Reloading Weapons...
00:21:47: Memory: Windows Vista (TM) Enterprise Process: 358036kb Free: 359mb Texture Mem Free: 427mb FPS: 32 Windowed: TRUE(TRUE) Foreground: TRUE
00:21:56: Paused
 

Lestar73

Active Member
Hmm. That is odd. It got into the if statement at the end but it didn't print out the item info from the debug statement about. Did you edit the function exactly as I entered it?

Since it is getting into the if statement, EVE:MoveItemsTo is being called. This same function is used all over EveBot so I doubt it is broken.

from obj_hauler
Code:
	function LootEntity(int id, int leave = 0)
	{
		variable index:item ContainerCargo
		variable iterator Cargo
		variable int QuantityToMove

		UI:UpdateConsole["DEBUG: obj_OreHauler.LootEntity ${id} ${leave}"]
		
		Entity[${id}]:DoGetCargo[ContainerCargo]
		ContainerCargo:GetIterator[Cargo]
		if ${Cargo:First(exists)}
		{
			do
			{
				UI:UpdateConsole["Hauler: Found ${Cargo.Value.Quantity} x ${Cargo.Value.Name} - ${Math.Calc[${Cargo.Value.Quantity} * ${Cargo.Value.Volume}]}m3"]
				if (${Cargo.Value.Quantity} * ${Cargo.Value.Volume}) > ${Ship.CargoFreeSpace}
				{
					/* Move only what will fit, minus 1 to account for CCP rounding errors. */
					QuantityToMove:Set[${Ship.CargoFreeSpace} / ${Cargo.Value.Volume} - 1]
				}
				else
				{
					QuantityToMove:Set[${Cargo.Value.Quantity} - ${leave}]
					leave:Set[0]
				}

				UI:UpdateConsole["Hauler: Moving ${QuantityToMove} units: ${Math.Calc[${QuantityToMove} * ${Cargo.Value.Volume}]}m3"]
				if ${QuantityToMove} > 0
				{
					[COLOR="Red"]Cargo.Value:MoveTo[MyShip,${QuantityToMove}][/COLOR]
					wait 30
				}
				else
				{
					This.PickupFailed:Set[TRUE]
				}
								
				if ${Ship.CargoFreeSpace} < ${Ship.CargoMinimumFreeSpace}
				{
					/* TODO - this needs to keep a queue of bookmarks, named for the can ie, "Can CORP hh:mm", of partially looted cans */
					/* Be sure its names, and not ID.  We shouldn't store anything in a bookmark name that we shouldnt know */
					
					UI:UpdateConsole["DEBUG: obj_Hauler.LootEntity: Ship Cargo: ${Ship.CargoFreeSpace} < ${Ship.CargoMinimumFreeSpace}"]
					break
				}
			} 
			while ${Cargo:Next(exists)}
		}

		Me.Ship:StackAllCargo
		wait 10
	}
from tsusalvage
Code:
			  if (${Math.Calc[${CargoIterator.Value.Quantity} * ${CargoIterator.Value.Volume}]} > ${Math.Calc[${Me.Ship.CargoCapacity} - ${Me.Ship.UsedCargoCapacity}]})
			  {
				  CargoIterator.Value:MoveTo[MyShip,${Math.Calc[${Math.Calc[${Me.Ship.CargoCapacity} - ${Me.Ship.UsedCargoCapacity}]} / ${CargoIterator.Value.Volume}]}]
					CargoholdLoot:Set[${CargoIterator.Value.ID},1]
					;echo "DEBUG: Added ${CargoIterator.Value.ID} to CargoholdLoot (CargoholdLoot Used now: ${CargoholdLoot.Used})"
				  wait 20
				}
				else
				{
[COLOR="Red"]				  CargoIterator.Value:MoveTo[MyShip][/COLOR]
				  CargoholdLoot:Set[${CargoIterator.Value.ID},1]
				  ;echo "DEBUG: Added ${CargoIterator.Value.ID} to CargoholdLoot (CargoholdLoot Used now: ${CargoholdLoot.Used})"
				  wait 20
				}

code EVE:MoveItemsTo[ItemsToMove, MyShip] not in use
 
Top Bottom