POS Finder Script

GliderPro

Active Member
This is for people in alliances that only publish one POS location per system. This script warps from moon to moon and logs all the control towers that it finds. Make sure the system is safe before running this script! Do not run this script in a system where hostile control towers are anchored!!

Code:
#define CATEGORYID_CELESTIAL    2
#define GROUPID_MOON            8

#define CATEGORYID_STRUCTURE    23
#define GROUPID_CONTROL_TOWER   365

variable string LogFile

function atexit()
{
    call LogEcho "EVE POS Finder Script -- Ended"
    return
}

function LogEcho(string aString)
{
    echo "${aString}"
    redirect -append "${LogFile}" echo "${aString}"
}

function WarpWait()
{
    variable bool Warped = FALSE
    
    variable int Count
    for (Count:Set[0] ; ${Count}<10 ; Count:Inc)
    {
        if ${Me.ToEntity.Mode} == 3
        {
            call LogEcho "Warping..."
            break
        }
        wait 20
    }
    
    while ${Me.ToEntity.Mode} == 3
    {
        Warped:Set[TRUE]
        wait 20
    }
    call LogEcho "Dropped out of warp"
    wait 20
    return ${Warped}
}   

function WarpToID(int Id)
{ 
    if (${Id} <= 0)
    {
        call LogEcho "Error: WarpToID: Id is <= 0 (${Id})"
        return
    }
    
    if !${Entity[${Id}](exists)}
    {
        call LogEcho "Error: WarpToID: No entity matched the ID given."
        return
    }

    /* The warp-in point for a moon is usually quite far   */
    /* away from the actual moon entity.  Most of the time */
    /* it is just over 5 million meters from the moon.     */
    while ${Entity[${Id}].Distance} >= 5500000
    {
        call LogEcho "Warping to ${Entity[${Id}].Name}"
        Entity[${Id}]:WarpTo
        call WarpWait
    }
}   

; 'Args' is an array
function main(... Args)
{
    LogFile:Set["${Script.CurrentDirectory}/${Universe[${Me.SolarSystemID}]}-pos.log"]

    call LogEcho "EVE POS Finder Script"
    call LogEcho "EVE POS Finder will log to ${LogFile}"
    
    variable index:entity moonIndex
    variable iterator moonIterator
    variable index:entity posIndex
    variable iterator posIterator

    EVE:DoGetEntities[moonIndex,CategoryID,CATEGORYID_CELESTIAL,GroupID,GROUPID_MOON]
    moonIndex:GetIterator[moonIterator]
    
    if ${moonIterator:First(exists)}
    do
    {
        call WarpToID ${moonIterator.Value.ID}

        EVE:DoGetEntities[posIndex,CategoryID,CATEGORYID_STRUCTURE,GroupID,GROUPID_CONTROL_TOWER]
        posIndex:GetIterator[posIterator]
        if ${posIterator:First(exists)}
        do
        {
            call LogEcho "==================== POS Found! ===================="
            call LogEcho "++ Name        -- ${posIterator.Value.Name}"
            call LogEcho "++ Alliance    -- ${posIterator.Value.Alliance} (${posIterator.Value.AllianceTicker})"
            call LogEcho "++ Corporation -- ${posIterator.Value.Corporation} (${posIterator.Value.CorporationTicker})"
            ;; only works if player is in local 
            ;; call LogEcho "++ Owner       -- ${posIterator.Value.Owner.Name}"
            call LogEcho "++ Group       -- ${posIterator.Value.Group} (${posIterator.Value.GroupID})"
            call LogEcho "++ Type        -- ${posIterator.Value.Type} (${posIterator.Value.TypeID})"
            call LogEcho "===================================================="
        }
        while ${posIterator:Next(exists)}
    }
    while ${moonIterator:Next(exists)}  
}
 

Charles2584

Well-Known Member
I liked this script, I went ahead and improved on it some though. I included an iteration for checking on shields, weapons, etc.

I can't remember if you have to create the folder PoS_Log in your scripts folder or if this script makes the folder so if it cries about the folder not existing just make it.

Code:
#define CATEGORYID_CELESTIAL    2
#define GROUPID_MOON            8

#define CATEGORYID_STRUCTURE    23
#define GROUPID_CONTROL_TOWER   365

variable string LogFile
variable string WeaponLogFile

function atexit()
{
    call LogEcho "-------------EVE POS Finder Script -- Ended ${Time}"
    return
}

function LogEcho(string aString)
{
    echo "${aString}"
    redirect -append "${LogFile}" echo "${aString}"
}

function WeaponLogEcho(string wString)
{
    redirect -append "${WeaponLogFile}" echo "${wString}"
}

function WarpWait()
{
    variable bool Warped = FALSE
    
    variable int Count
    for (Count:Set[0] ; ${Count}<10 ; Count:Inc)
    {
        if ${Me.ToEntity.Mode} == 3
        {
            echo "Warping..."
            break
        }
        wait 20
    }
    
    while ${Me.ToEntity.Mode} == 3
    {
        Warped:Set[TRUE]
        wait 20
    }
    echo "Dropped out of warp"
    wait 20
    return ${Warped}
}   

function WarpToID(int Id)
{ 
    if (${Id} <= 0)
    {
        echo "Error: WarpToID: Id is <= 0 (${Id})"
        return
    }
    
    if !${Entity[${Id}](exists)}
    {
        echo "Error: WarpToID: No entity matched the ID given."
        return
    }

    /* The warp-in point for a moon is usually quite far   */
    /* away from the actual moon entity.  Most of the time */
    /* it is just over 5 million meters from the moon.     */
    while ${Entity[${Id}].Distance} >= 10000000
    {
        echo "Warping to ${Entity[${Id}].Name}"
        Entity[${Id}]:WarpTo[30]
        call WarpWait
    }
}   

function main(... Args)
{
    LogFile:Set["${Script.CurrentDirectory}/PoS_Log/${Universe[${Me.SolarSystemID}]}-pos.log"]
	WeaponLogFile:Set["${Script.CurrentDirectory}/PoS_Log/${Universe[${Me.SolarSystemID}]}-weapon.log"]

    call LogEcho "==========EVE POS Finder Script ${Time} ${Time.Date}"
        
    variable index:entity moonIndex
    variable iterator moonIterator
    variable index:entity posIndex
    variable iterator posIterator
	variable index:entity WeaponIndex
    variable iterator WeaponIterator
	variable index:entity ShieldIndex
    variable iterator ShieldIterator
	
	variable string shieldflag
	variable int i
	declare TypeArray[500] int
	declare QuantityArray[500] int
	declare NameArray[500] string
	declare ArrayCheckFlag int
	
	variable int ArrayPosition
	
	
	variable int WeaponFlag
	
	variable int flag
	variable int towerID
	
    EVE:DoGetEntities[moonIndex,CategoryID,CATEGORYID_CELESTIAL,GroupID,GROUPID_MOON]
    moonIndex:GetIterator[moonIterator]
    	
	if ${moonIterator:First(exists)}
    do
    {
			
	
		flag:Set[0]
		weaponflag:Set[0]
		call WarpToID ${moonIterator.Value.ID}

        EVE:DoGetEntities[posIndex,CategoryID,CATEGORYID_STRUCTURE,GroupID,GROUPID_CONTROL_TOWER]
        posIndex:GetIterator[posIterator]
        
		EVE:DoGetEntities[ShieldIndex,CategoryID,2,GroupID,411]
		ShieldIndex:GetIterator[ShieldIterator]
		
		shieldflag:Set["!!!!SHIELDS OFFLINE!!!!"]
		
		if ${ShieldIterator:First(exists)}
        do
        {
		shieldflag:Set[""]
		} 
		while ${ShieldIterator:Next(exists)}
		
		
		if ${posIterator:First(exists)}
        do
        {
            call LogEcho "${Entity[${moonIterator.Value.ID}].Name} : ${posIterator.Value.Type} (${posIterator.Value.CorporationTicker}) [${posIterator.Value.AllianceTicker}] ${shieldflag}"
				flag:Set[1]
		
				;; OK NOW WE START CHECKING FOR WEAPONS
				towerID:Set[${posIterator.Value.ID}]
				EVE:DoGetEntities[WeaponIndex,CategoryID,CATEGORYID_STRUCTURE, notID,${towerID},Radius,5000000]
				WeaponIndex:GetIterator[WeaponIterator]
				
				call WeaponLogEcho "-----${Entity[${moonIterator.Value.ID}].Name} [${posIterator.Value.AllianceTicker}] START-----"
				
				ArrayPosition:Set[0]
				WeaponFlag:Set[0]
				
				if ${WeaponIterator:First(exists)}
				do 
				{
				ArrayCheckFlag:Set[0]
				for (i:Set[0] ; ${i}<=${ArrayPosition} ; i:Inc)
				{
					if ${Entity[${WeaponIterator.Value.ID}].TypeID}==${TypeArray[${i}]}
					{
						ArrayCheckFlag:Set[${i}]
					}
				}

				if ${ArrayCheckFlag}>0
				{
					QuantityArray[${ArrayCheckFlag}]:Inc
				}
				
				if ${ArrayCheckFlag}==0
				{
					ArrayPosition:Inc
					TypeArray[${ArrayPosition}]:Set[${Entity[${WeaponIterator.Value.ID}].TypeID}]
					QuantityArray[${ArrayPosition}]:Set[1]
					NameArray[${ArrayPosition}]:Set[${Entity[${WeaponIterator.Value.ID}].Name}]
				
				}
				WeaponFlag:Set[1]
				}
				while ${WeaponIterator:Next(exists)}
				
				if ${WeaponFlag}==1
				{
					for (i:Set[1] ; ${i}<=${ArrayPosition} ; i:Inc)
					{
					call WeaponLogEcho "${QuantityArray[${i}]} x ${NameArray[${i}]}"
					}
				}
				
				if ${WeaponFlag}==0
				{
						call WeaponLogEcho "No Weapons at this PoS"
				}
				
				call WeaponLogEcho "-----${Entity[${moonIterator.Value.ID}].Name} END-----"
		}
        while ${posIterator:Next(exists)}
		
		if ${flag}==0
		{
		call LogEcho "${Entity[${moonIterator.Value.ID}].Name} EMPTY"
		}
	}
    while ${moonIterator:Next(exists)}  
}
What would make this script better? Being able to scout which weapons are actually online / anchored / unanchored.
 

Attachments

Charles2584

Well-Known Member
oh another important change that was just brought to my attention in IRC.

while ${Entity[${Id}].Distance} >= 10000000

(Checks if you are within 10000km of a moon. the original script has 5500km as it's check which means if you warped to the warpin point and are sitting at the warpin point but it's greater then 5500km away, you will sit there and loop in a "entering warp".

Figured that out when a lot of moons in Feythabolis have warpins more around 7500km away from the moon.

=====

Too long didn't read? Change the line that reads "While ${Entity" to what I posted here if you are going to use the original version.
 
Top Bottom