ISEXQ2 losing Customactor array?

mycroft

Script Author: MyPrices
I'm using this routine to check for harvestable nodes with checks to see if a flag is set , if it is then the routine to harvest that node is called.

What I'm finding is sometime during the looping the CustomActorarray values (name and ID) are becoming NULL when before they were previously the name of a node and it's ID..

is it this routine , a bug or something I'm missing?

Scan is a variable passed to it for the distance to scan using CreateCustomActorArray

Code:
function startharvest(int scan)
{
	variable int harvestcount
	variable int harvestloop
	variable string actorname

	variable int tempvar
	While 1
	{
		if ${pauseharvest}
			break
		if !${Me.InCombat}
		{
			EQ2:CreateCustomActorArray[byDist,${scan}]
			harvestloop:Set[1]
			harvestcount:Set[${EQ2.CustomActorArraySize}]
			do
			{
				actorname:Set[${CustomActor[${harvestloop}]}]
				if ${CustomActor[${harvestloop}].Type.Equal[resource]} && !${actorname.Equal[NULL]}
				{
					tempvar:Set[1]
					do
					{
						if ${HarvestNode[${tempvar}]}
						{
							if ${actorname.Equal[${NodeName[${tempvar}]}]}
							{
								call harvestnode ${CustomActor[${harvestloop}].ID}
								break
							}
						}
					}
					while ${tempvar:Inc} <=9
				}
			}
			while ${harvestloop:Inc} <= ${harvestcount}
		}
	}
}
 

Amadeus

The Maestro
Staff member
It is possible that an actor might cease to exist while you're looping. The extension has to take that into account because accessing an actor that is no longer valid would crash you.

Just have it do something like this in the loop:

if !${CustomActor[${harvestloop}](exists)}
continue
 
Top Bottom