NPC Combat Bot v0.000001 :D

Da_Teach

Active Member
NPC Combat Bot v0.2

I initially wanted to write this bot in C# but with the .NET library still not being very stable I started writing this in LavischScript.

Here's my initial version. Please note this version is made with 0.0 activity in mind.

This is what it will do:

# It will go to a belt
# It will target all the rats
# It will shoot (with missiles only !!) the rats
# It will activate its hardeners
# It will activate its shield booster if shield HP drops below 80%
# It will deactivate its shield booster if shield HP is above 98%
# It will warp to a safespot if a pilot is in local that does not conform to SafeAllianceIDs or SafeCorporationIDs
# At the safespot it will cloak (if a cloak is fitted)
# It will warp to the next belt if a player is in the belt already
# It will warp to the next belt if all the rats died

For this to work you need to edit npcbot.iss file:

# Edit the safespot string at the top
# Edit/add corps&alliances to the safe list a bit lower in the code (marked by " alliance id's here"

After that it should work without user intervention.

There's a bunch of things I want to add (for example drone-control), but thats all for 'the future' (e.g. upcomming week or so).

A list of 'ToDo' sofar is:

# Safespot if shield drops below x%
# Stay safespotted if armor drops below x%
# Safespot if ammo is depleted
# Alert when a faction or officer spawn is in the belt
# Drone control, take down frigs with the drones after everything agro'd
# Target priority (if there are T2 rats, dire, arch, etc kill those first)

What you shouldnt expect is:

# A nice UI
# Easy setup
# Anything that I dont find usefull or need (e.g. guns/webbing/armor repping), its probably not hard to add but I really dont give a shit :D

--------------------

New in v0.2:

# Reload weapons when entering a belt
# Reload weapons when switching targets and ammo capacity is below 30%
# Chaining support (see post on my views on chaining)
# Fixed numerous bugs

I should have added some of the remarks from this thread but I'm a lazy git so didnt get around to it. But seeing this version has chaining added I thought I'd release it.

I've still got mixed feelings about chaining, it could be great but still undecided. Although I gain more isk/hour with it enabled, I get less special spawns. Its a trade-off I guess.

To upgrade just replace npcbot.iss , note that safespot is no longer a variable (somehow that didnt work for me last time). And DoGetPilots might still require a mod thats listed below.

Note that the target object might require editing as it now assumes guristas rats.
 

Attachments

Last edited:

Antifly

Active Member
It would be nice to have aprroach/orbit/keepatrange support, as well as using velocity increasing modules.
 
Last edited:

alcor75

Well-Known Member
big hug for sharing this script, i'll test it as the server go online.

getting an error saying "No such 'eve method 'DoGetPilots'"

what does it expect as alliance/corp id?
pls help i do not know what to put in there, the name of my corp? alliance?
 
Last edited:

Da_Teach

Active Member
I forgot 1 small thing it seems, Amadeus has to update ISXEVE for this to work.

The DoGetPilots function in ISXEVE was disabled / not working in the current release.

I'll check with him late tonight to see when this is going to be put live.
 

Charles2584

Well-Known Member
Antifly's suggestion fixes it.

As for the bot functionality, it just shoots any npc it can target, it targets everything (of course largest ships get targeted first because of lock time / sig radius) and shoots in order and continues shooting till it's all gone.

Do not expect a torp raven (hi short distance torpedos) to work for this bot out in 0.0 where NPC's stay out past 30km and kite you with long range weapons, cruise raven is necissary for that to work or to have some inplants and rigs to improve torpedo range.

Very nice start so far

what does it expect as alliance/corp id?
pls help i do not know what to put in there, the name of my corp? alliance?
Go into the console and type this:

echo ${Me.AllianceID}

for your alliance

echo ${Local[CharacterName].AllianceID}

for allianceID of someone else.

For multiple ID's I'd assume a comma inbetween, I'm not sure though what delimter is expected.
 
Last edited:

Da_Teach

Active Member
Actually multiple corps / alliances can be added by copying the insert line.

SafeAllianceIDs:Insert[1234567]
SafeAllianceIDs:Insert[7654321]
etc

I have a couple of alliances & corps added that way, works like a charm.

Indeed this bot doesnt care about range nor does it care about target priority.

However while in bed yesterday I was thinking how easy it would be to add target priority, so expect that to be added shortly (e.g. shoot elite-frigates first, I cant have them scramble me in belts).

I'm also not entirely sure at the moment what will happen if you cant target all the rats in a belt (e.g. can have 4 targets locked instead of the maximum 6). I think it'll try to retarget until the end of days, hey its v0.0000001 for a reason :p (this is one I might be tempted to fix just because its probably not 'that' much work)

As for adding approach / keep at range / follow / etc, dont expect that to be added anytime soon (or at all). I use a cruise raven, I have 100km lock range of the raven (and the missiles hit that far), and I dont care about looting (takes too much time).

Dont expect this to become a nice script like EVEBot is, because I wrote this script primarily for me and while I share this with the community its (unlike EVEBot) not written for the community (sounds harsh, I know, I suck :evil: ).

Anyways expect a next version in a couple of days with a few improvements.
 

Charles2584

Well-Known Member
I changed up the targeting call to add in a check for kiting npc's

Though it only checks for Angel npc's...4 days till Missle Launcher Operation 5 is complete then I can get into a torp raven myself.

Code:
member:bool TargetNPCs()
	{
		variable index:entity Targets
		variable iterator Target

		EVE:DoGetEntities[Targets, CategoryID, CATEGORYID_ENTITY]
		Targets:GetIterator[Target]
		
		if !${Target:First(exists)}
		{
			echo "No targets found..."
			return FALSE
		}
		
		if ${Me.Ship.MaxLockedTargets} == 0
		{
			echo "Jammed, cant target..."
			return TRUE
		}
		
		do
		{
			if !${Target.Value.IsLockedTarget} && !${Target.Value.BeingTargeted}
			{
				echo "Locking ${Target.Value.Name}"
				Target.Value:LockTarget
			}
		
[B]		    if ${Target.Value.Name.Find[Saint]} || ${Target.Value.Name.Find[Seraphim]} || ${Target.Value.Name.Find[Nephilim]} || ${Target.Value.Name.Find[Cherubim]}
			{
			    echo "Kiting spawns, moving on"
			    return FALSE
			}[/B]
		}
		while ${Target:Next(exists)}
		
		return TRUE
	}
 

Da_Teach

Active Member
Arent those the most valuable spawns ?

Wouldnt it be better to just switch to cruise missiles?

Yes you wont have as much DPS (though pre-trinity, DPS of torps wasnt really that much higher then cruise, so I dont get what the fuss is about anyways).

I'm dishing out a nice 500ish dps with my Raven with cruise, ok its shy of the 890ish I can dish out with torps, but the time lost getting to the spawn easily makes up for the lower dps. (not counting drones in either case)

Anyways if you wanted to handle mwd/ab-ing to spawns (no I wont add this), you could just check the range (in the targeting function), if its outside your range turn on your mwd/ab and approach the spawn (in the targeting function).

Trust me when I say though, this will only get you less isk/hour.

(yes I know the targeting function really shouldnt be used for approach but in the end who gives a frak if it works it works :D)
 

Antifly

Active Member
By adding salvager script callen within belt warping wireframe (for other account), by adding NPC counter check for it, and keeping all "safe from PC" routines) - it gives 100% output :) by adding loot and salvaged materials as source of income ::)

1 account runs the belts for bounty, another one loots and salvages still being able to hide on own safespot :)
 

Da_Teach

Active Member
I'm running out of accounts (3 miners 1 hauler 1 ratter 2 pvp chars :dazed: ), so cant really have a salvager running around as well. But if I did have a spare account for hauling / salvaging that would be exactly what I'd be doing.

Now the big question is if I can build in the 'standings check' into EVEBot or if I have to write my own miner bot. I'm hoping the first, fearing the second.
 

Charles2584

Well-Known Member
Da_Teach said:
Arent those the most valuable spawns ?

Wouldnt it be better to just switch to cruise missiles?
You missed the part where I said I don't have Missle Laucher Operation 5 (a prereq for Cruise Missles)

So to modify your script for those of us that don't have that skill yet (notice key word being yet...I've got 3 days of training to go) so that it works in the mean time for torp raven without sitting at a belt firing torps that miss the target by 20 KM I've told the targeting function to just treat it like there is no targets in that belt and warp to the next.

It's a cheap method of doing it, but makes the script functional for me in the meantime.

Really that change would be detrimental to anyone using a cruise raven (which is the proper PVE setup now post-Trinity)
 

Antifly

Active Member
Need advise. I'm selecting :First of all targeted NPCs, then making following things:

1. Target.Value:MakeActiveTarget
2. Me.ActiveTarget:Orbit[20000]

But the ship doesn't even bother to keep the orbit (same with keeping at range).

What's wrong :) ?
 

Da_Teach

Active Member
Here's a new cls_Targets class:

Code:
objectdef cls_Targets
{
	variable index:string PriorityTargets
	variable iterator PriorityTarget

	method Initialize()
	{
		; Priority targets will be targeted (and killed) 
		; before other targets, they often do special things
		; which we cant use (scramble / web / damp / etc)
		; You can specify the entire rat name, for example 
		; leave rats that dont scramble which would help
		; later when chaining gets added
		PriorityTargets:Insert["Dire Guristas"]
		PriorityTargets:Insert["Arch Angel"]
		PriorityTargets:Insert["Sansha's Loyal"]
		
		; Get the iterator
		PriorityTargets:GetIterator[PriorityTarget]
	}

	member:bool TargetNPCs()
	{
		variable index:entity Targets
		variable iterator Target

		EVE:DoGetEntities[Targets, CategoryID, CATEGORYID_ENTITY]
		Targets:GetIterator[Target]

		if !${Target:First(exists)}
		{
			echo "No targets found..."
			return FALSE
		}

		if ${Me.Ship.MaxLockedTargets} == 0
		{
			echo "Jammed, cant target..."
			return TRUE
		}

		; Start looking for (and locking) priority targets
		variable bool HasPriorityTarget = FALSE
		do
		{
			; Loop through the priority targets
			if ${PriorityTarget:First(exists)}
			do
			{
				; Is it a priority target?
				if ${Target.Value.Name.Find[${PriorityTarget.Value}]} == 1
				{
					; Yes, is it locked?
					if !${Target.Value.IsLockedTarget} && !${Target.Value.BeingTargeted}
					{
						; No, report it and lock it.
						echo "Locking priority target ${Target.Value.Name}"
						Target.Value:LockTarget
					}
					
					HasPriorityTarget:Set[TRUE]
				}
			}
			while ${PriorityTarget:Next(exists)}
		}
		while ${Target:Next(exists)}
		
		; If there was a priority target, dont worry about targeting the rest
		if !${HasPriorityTarget} && ${Target:First(exists)}
		do
		{
			if !${Target.Value.IsLockedTarget} && !${Target.Value.BeingTargeted}
			{
				echo "Locking ${Target.Value.Name}"
				Target.Value:LockTarget
			}
		}
		while ${Target:Next(exists)}
		
		return TRUE
	}
	
	member:bool PC()
	{
		variable index:entity Targets
		variable iterator Target

		EVE:DoGetEntities[Targets, CategoryID, CATEGORYID_SHIP]
		Targets:GetIterator[Target]
		
		if !${Target:First(exists)}
		do
		{
			if ${Target.Value.OwnerID} != ${Me.CharID}
			{
				; A player is already present here !
				echo "Player found ${Target.Value.Owner}"
				return TRUE
			}
		}
		while ${Target:Next(exists)}
		
		; No other players around 
		return FALSE
	}
}
This adds target priority to the bot, this is very intresting when it comes to scrambling rats. Pretty sure thats the only change so far.
 

Charles2584

Well-Known Member
A change I made to the IsSafe() call (wrong term I'm sure)

Code:
	member:bool IsSafe()
	{
		if ${Me.Ship.ArmorPct} < 50
		{
		Safe:Set[FALSE]
		return FALSE
		}
If you aren't going to rep armor or don't have them, no reason to take your ship out and get it popped by rats if for some reason your shield tank doesn't hold up.

Basically it puts your ship at the safespot and cloaks at that point till servers quit or you come back.

Can set it at 75 or whatever.
 
Last edited:

Da_Teach

Active Member
I was thinking about adding that as well, though I would do it on shields myself. I'd also would have added a cap-check, if below 15% cap.

If your shield tank isnt going to hold, then once you get below 30-40% shield its time to warp out. Considering it starts boosting at 80% shield, once you hit 30-40% your pretty sure you cant tank it.

And if you get below 15% cap, your shield booster will most likely stop working reasonably fast, and then your shields will die fast.

Anyways I'll probably add that to the main bot and once Ama has added ReloadAll to ISXEvE (or Reload per module), I will release a new (bug fixed) bot. There's at least one bug that I fixed, and there's also some features. I'll probably add chaining, found that it might be interesting to have if your ratting in a system with some corp members.
 

GliderPro

Active Member
Etiquette

Another thing you might want to add is etiquette. Basically, if you warp to a belt and there are any players around, warp away. Also, if you warp into the belt and there are no battle ships, warp away. That is because the belt is most-likely chained. You might want to recognize some exceptions like triple battlecruiser spawns.

It is considered very rude to shoot someone's rat, break a chain, or disrupt a tanked belt. If you do it often you will find yourself in a NPC corp.
 

Da_Teach

Active Member
GliderPro said:
Another thing you might want to add is etiquette. Basically, if you warp to a belt and there are any players around, warp away. Also, if you warp into the belt and there are no battle ships, warp away. That is because the belt is most-likely chained. You might want to recognize some exceptions like triple battlecruiser spawns.

It is considered very rude to shoot someone's rat, break a chain, or disrupt a tanked belt. If you do it often you will find yourself in a NPC corp.
It already warps away if a person is in the belt (actually the bot that can be downloaded here doesnt due to a bug, but it should do that ;)).

As for the chaining part, this is in the makes. The thing is what makes it harder is my knowledge of LS. If I wrote this in C# it would be finished already but having some issues with it atm.

The rules I'm looking at are:

* If there's 1 type of spawn in a belt, its a chain and as such leave it alone
* If there's 2 types of spawn but no BS spawns, then kill it
* If there's 2 types of spawn but the BS arent high enough (e.g. triple 500k), kill it
- For the above option, bounties would be nice to have in isxeve
* Kill the spawn if it has a priority spawn (this includes elite cruisers)
* Leave non-bs alive if its an acceptable chain

Thats how I see chaining, correct me if I'm wrong.
 

GliderPro

Active Member
Da_Teach said:
* If there's 2 types of spawn but no BS spawns, then kill it
I'm not sure about that one but the others seem right. Without bounty information from ISXEVE you are going to have to create a table of NPC names. I am pretty sure each of the different bounty levels have different spawn names. It would probably be best to log every spawn combo you come across so we can start to build up a table.
 

Da_Teach

Active Member
Well the two types means frigs + cruisers or cruisers + bc or frigs + bc ... E.g. 2 different types (frigs / cruisers / battlecruisers) with no battleships means its not a BS spawn and as such can be killed without making anyone mad :)

A spawn will never exist out of three types (e.g. frigs + cruisers + bs).

As for the bounty table, that already exists with an SQL/CSV dump from eve. Would just have to consolidate the data into a nice xml file. However I havent looked into XML interaction with LS yet, I dont know if its hard / easy / whatever.
 

Charles2584

Well-Known Member
I've made some more changes

Basically my version warps out if cap is below 10

It quits going back if your armor is below 25%, no reason to lose your ship.

I've added a "Am I at the belt" check so that if you do warp out for any reason you warp back to your old belt and finish off the spawn

I've added a Modules:ReloadWeapons which is ugly as fuck, it basically looks at ${MaxMissleCount} and reloads whatever is in your first inventory slot into the launchers. I don't know if it's because I'm on satalite intarweb or what but sometimes it fails for me, maybe you guys will have more luck with it.

I've also added a "Am I out of ammo in my hold" by using ${Me.Ship.UsedCargoCapacity}, it will flip out if cargo isn't opened, one thing about this is that if you are reloading sometimes ${Me.Ship.UsedCargoCapacity} returns null. So I added a counter for how many times ${Me.Ship.UsedCargoCapacity} is below 10, it requires 10 times before it will warp to your safespot, 5 is probably enough but yeah.

All my changes (that I noticed) are marked RED

Code:
#include defines.iss

variable string Safespot = "Safespot"
[COLOR="Red"]variable bool CapFlag = FALSE
variable int CargoCount = 0
variable int MaxMissleCount = 23[/COLOR]
function main()
{
[COLOR="Red"]turbo 20[/COLOR]
	variable cls_Belts Belts
	variable cls_Targets Targets
	variable cls_Modules Modules
	variable cls_Local LocalInformation
	variable cls_Safespot Safespot

	[COLOR="Red"]Belts:NextBelt[/COLOR]
	while TRUE
	{
		while ${LocalInformation.IsSafe}
		{
			; Make sure we're not cloaked
			Modules:ActivateCloak[FALSE]

[COLOR="Red"]			; Warp to the next belt
			if ${Belts.IsAtBelt}
			{
			; Made this change so that if I warp out for any reason to go to safe spot I will come back to the same belt
			Belts:NextBelt
			}[/COLOR]
			

			echo "Warping to belt ${Belts.Belt.Value.Name}"
			Belts.Belt.Value:WarpTo[0]

			; Wait till warp starts
			wait 50
            
			
			while ${Me.ToEntity.Mode} == 3 && ${LocalInformation.IsSafe}
			{
			wait 3
[COLOR="Red"]			;Uncomment the line below to reload between belts
			;Modules:ReloadWeapons
			}[/COLOR]
			; Make sure we dropped out of warp
			wait 30
			
			
			; Before opening fire, lets see if there are any friendlies here
			if !${Targets.PC}
			while ${Targets.TargetNPCs} && ${LocalInformation.IsSafe}
			{
				; Make sure our hardeners are running
				Modules:ActivateHardeners

				; Activate the weapons, the modules class checks if there's a target
				Modules:ActivateWeapons
				
				if ${Me.Ship.ShieldPct} < 80
				{
					; Turn on the shield booster
					Modules:ActivateShieldBooster[TRUE]
				}
				
				if ${Me.Ship.ShieldPct} > 90
				{
					; Turn off the shield booster
					Modules:ActivateShieldBooster[FALSE]
				}

				; Wait 2 seconds
				wait 20
			}
		}
	
		if !${LocalInformation.IsSafe}
		{

			
			; Are we at the safespot and not warping?
			if !${Safespot.IsAtSafespot} && ${Me.ToEntity.Mode} != 3
			{
				Safespot:WarpTo
				
				; Wait 3 seconds
				wait 30
			}
[COLOR="Red"]			if !${Safespot.IsAtSafespot}
			{
			wait 30
			}[/COLOR]
			
			if ${Safespot.IsAtSafespot}
			{
				wait 200
				Modules:ActivateCloak[TRUE]
				
				; Wait 1 minute, there was hostiles so who cares how long we wait
			}
			[COLOR="Red"]while ${Me.Ship.CapacitorPct} < 90 && ${Safespot.IsAtSafespot}
			{
			wait 20
			}
			if ${Me.Ship.CapacitorPct} > 90
			{
			CapFlag:Set[FALSE]
			}[/COLOR]
		}
		
		; Wait 2 seconds
		wait 20
	}
}

objectdef cls_Safespot
{
	member:bool IsAtSafespot()
	{
		; Are we within 150km off th bookmark?
		if ${Math.Distance[${Me.ToEntity.X}, ${Me.ToEntity.Y}, ${Me.ToEntity.Z}, ${EVE.Bookmark[${Safespot}].X}, ${EVE.Bookmark[${Safespot}].Y}, ${EVE.Bookmark[${Safespot}].Z}]} < 150000
		{
			return TRUE
		}
		
		return FALSE
	}
	
	method WarpTo()
	{
		EVE.Bookmark[${Safespot}]:WarpTo[0]
	}
}

objectdef cls_Local
{
	variable index:int SafeAllianceIDs
	variable index:int SafeCorporationIDs

	method Initialize()
	{
		IsSafe:Set[FALSE]
		
		; Insert alliance id's here
		SafeAllianceIDs:Insert[]
		; Insert corp id's here
		SafeCorporationIDs:Insert[]
	}
	
	member:bool IsSafe()
	{	
[COLOR="Red"]		if ${CapFlag} && ${Me.Ship.CapacitorPct} < 90
		{
		return FALSE
		}
		
		if ${Me.Ship.CapacitorPct} < 10
		{
		echo "Cap low, warping the fuck away"
		Safe:Set[FALSE]
		CapFlag:Set[TRUE]
		return FALSE
		}
		if ${Me.Ship.ArmorPct} < 25
		
		{
		;; Pretty much self explanatory, right?
		echo "ARMOR LOW!!!"
		Safe:Set[FALSE]
		return FALSE
		}
		if ${Me.Ship.UsedCargoCapacity} < 10
		{
			CargoCount:Set[${CargoCount}+1]
			;; When reloading UsedCargoCapacity sometimes freaks out so have to make sure it's not one of those, otherwise
			;; Otherwise you warp to your safespot alot.
			if (${Me.Ship.UsedCargoCapacity} < 10 && ${CargoCount} > 10)
			{
				echo "CARGO LOW Warping to safespot and camping for the night!"
				Safe:Set[FALSE]
				return FALSE
			}
		}
		elseif ${CargoCount} > 0
		{
		CargoCount:Set[0]
		}[/COLOR]
		variable index:pilot Pilots
		variable iterator Pilot
	
		Eve:DoGetPilots[Pilots]
		Pilots:GetIterator[Pilot]

		if ${Pilot:First(exists)}
		do
		{
			variable bool Safe
			Safe:Set[FALSE]
			
			variable iterator SafeAllianceID
			SafeAllianceIDs:GetIterator[SafeAllianceID]
			
			if ${SafeAllianceID:First(exists)}
			do
			{
				if ${SafeAllianceID.Value} == ${Pilot.Value.AllianceID}
				{
					Safe:Set[TRUE]
				}
			}
			while ${SafeAllianceID:Next(exists)}
			
			variable iterator SafeCorporationID
			SafeCorporationIDs:GetIterator[SafeCorporationID]
			
			if ${SafeCorporationID:First(exists)}
			do
			{
				if ${SafeCorporationID.Value} == ${Pilot.Value.CorporationID}
				{
					Safe:Set[TRUE]
				}
			}
			while ${SafeCorporationID:Next(exists)}
			
			if !${Safe}
			{
				echo "Enemy in local: ${Pilot.Value.Name} [${Pilot.Value.Corporation}|${Pilot.Value.CorporationID}][${Pilot.Value.Alliance}|${Pilot.Value.AllianceID}]"
				return FALSE
			}
		}
		while ${Pilot:Next(exists)}
		
		return TRUE
	}
}

objectdef cls_Modules
{
	variable index:module Modules

	variable index:module Weapons
	
	variable index:module ShieldBoosters
	variable index:module ArmorRepairers
	
	variable index:module Hardeners
	
	variable index:module Cloaks

	method Initialize()
	{
		Me.Ship:DoGetModules[Modules]
		
		variable iterator Module
		Modules:GetIterator[Module]
		
		if ${Module:First(exists)}
		do
		{
			variable int GroupID
			GroupID:Set[${Module.Value.ToItem.GroupID}]
		
			switch ${GroupID}
			{
				case GROUPID_SHIELD_BOOSTER
					echo "Shield booster ${Module.Value.ToItem.Name} found..."
					ShieldBoosters:Insert[${Module.Value}]
					continue

				case GROUPID_ARMOR_REPAIRERS
					echo "Armor repairer ${Module.Value.ToItem.Name} found..."
					ArmorRepairers:Insert[${Module.Value}]
					continue
					
				case GROUPID_SHIELD_HARDENERS
				case GROUPID_ARMOR_HARDENERS
					echo "Active hardener ${Module.Value.ToItem.Name} found..."
					Hardeners:Insert[${Module.Value}]
					continue
					
				case GROUPID_MISSILE_LAUNCHER_CRUISE
				case GROUPID_MISSILE_LAUNCHER_ROCKET 
				case GROUPID_MISSILE_LAUNCHER_SIEGE
				case GROUPID_MISSILE_LAUNCHER_STANDARD
				case GROUPID_MISSILE_LAUNCHER_HEAVY
					echo "Weapon ${Module.Value.ToItem.Name} found..."
					Weapons:Insert[${Module.Value}]
					continue
					
				case GROUPID_CLOAK
					echo "Cloak ${Module.Value.ToItem.Name} found..."
					Cloaks:Insert[${Module.Value}]
					continue
			}
		}
		while ${Module:Next(exists)}
	}
	
	method ActivateWeapons()
	{
		if ${Me.GetTargets} == 0
		{
			echo "No target locked, cant activate weapons"
			return
		}
	
		variable iterator Weapon
		Weapons:GetIterator[Weapon]

		if ${Weapon:First(exists)}
		do
		{
			if !${Weapon.Value.IsActive} && !${Weapon.Value.IsChangingAmmo} && !${Weapon.Value.IsReloadingAmmo}
			{
				Weapon.Value:Click
			}
		}
		while ${Weapon:Next(exists)}
	}
	
[COLOR="Red"]	method ReloadWeapons()
	{
		variable iterator Weapon
		Weapons:GetIterator[Weapon]
		
		if ${Weapon:First(exists)}
		do
		{
			if !${Weapon.Value.IsChangingAmmo} && !${Weapon.Value.IsReloadingAmmo} && ${MaxMissleCount} > ${Weapon.Value.CurrentCharges}
			{
				Weapon.Value:ChangeAmmo[${Me.Ship.Cargo[1].ID},${MaxMissleCount}]
			}
		}
		while ${Weapon:Next(exists)}
	}[/COLOR]
	method ActivateHardeners()
	{
		if ${Me.GetTargets} == 0
		{
			echo "No target locked, cant activate weapons"
			return
		}
	
		variable iterator Module
		Hardeners:GetIterator[Module]

		if ${Module:First(exists)}
		do
		{
			if !${Module.Value.IsActive}
			{
				Module.Value:Click
			}
		}
		while ${Module:Next(exists)}
	}

	method ActivateCloak(bool activate)
	{
		variable iterator Module
		Cloaks:GetIterator[Module]

		if ${Module:First(exists)}
		do
		{
			if !${Module.Value.IsActive} && ${activate}
			{
				echo "Cloaking..."
				Module.Value:Click
			}

			if ${Module.Value.IsActive} && !${activate}
			{
				echo "Uncloaking..."
				Module.Value:Click
			}
		}
		while ${Module:Next(exists)}
	}
	
	method ActivateShieldBooster(bool activate)
	{
		variable iterator Module
		ShieldBoosters:GetIterator[Module]

		if ${Module:First(exists)}
		do
		{
			if !${Module.Value.IsActive} && ${activate}
			{
				echo "Turning on shield booster..."
				Module.Value:Click
			}

			if ${Module.Value.IsActive} && !${activate}
			{
				echo "Turning off shield booster..."
				Module.Value:Click
			}
		}
		while ${Module:Next(exists)}
	}
}

objectdef cls_Targets
{
	method Initialize()
	{
	}

	member:bool TargetNPCs()
	{
		variable index:entity Targets
		variable iterator Target

		EVE:DoGetEntities[Targets, CategoryID, CATEGORYID_ENTITY]
		Targets:GetIterator[Target]
		
		if !${Target:First(exists)}
		{
			echo "No targets found..."
			return FALSE
		}
		
		if ${Me.Ship.MaxLockedTargets} == 0
		{
			echo "Jammed, cant target..."
			return TRUE
		}
		
		do
		{
			if !${Target.Value.IsLockedTarget} && !${Target.Value.BeingTargeted}
			{
				echo "Locking ${Target.Value.Name}"
				Target.Value:LockTarget
			}
		
		    
		}
		while ${Target:Next(exists)}
		
		return TRUE
	}
	
	member:bool PC()
	{
		variable index:entity Targets
		variable iterator Target

		EVE:DoGetEntities[Targets, CategoryID, CATEGORYID_SHIP]
		Targets:GetIterator[Target]
		
		if !${Target:First(exists)}
		do
		{
			if ${Target.Value.OwnerID} != ${Me.CharID}
			{
				; A player is already present here !
				echo "Player found ${Target.Value.Owner}"
				return TRUE
			}
		}
		while ${Target:Next(exists)}
		
		; No other players around 
		return FALSE
	}
}

objectdef cls_Belts
{
	variable index:entity Belts
	variable iterator Belt

	method Initialize()
	{
		EVE:DoGetEntities[Belts, GroupID, GROUPID_ASTEROID_BELT]
		Belts:GetIterator[Belt]

		variable int Counter

		Counter:Set[0]
		if ${Belt:First(exists)}
		do
		{
			Counter:Inc[1]
		}
		while ${Belt:Next(exists)}

		echo "${Counter} belts found..."
	}

[COLOR="Red"]	member:bool IsAtBelt()
	{
		; Are we within 150km off the belt?
		if ${Math.Distance[${Me.ToEntity.X}, ${Me.ToEntity.Y}, ${Me.ToEntity.Z}, ${Belt.Value.X}, ${Belt.Value.Y}, ${Belt.Value.Z}]} < 150000
		{
			return TRUE
		}
		
		return FALSE
	}[/COLOR]

	method NextBelt()
	{
		if !${Belt:Next(exists)}
			Belt:First(exists)

		return
	}
}
 

Charles2584

Well-Known Member
Notice: I've not taken on the prioritized targeting and I don't have the check for hostiles in there because I changed it to Eve:DoGetPilots which returns null of course. Basically making IsSafe() return TRUE unless somethings wrong with our ship.

I don't know if Amadeus added that method back in yet or not.

Some of my code may be ugly or just plain bad practice, I'm learning, I've not really had any other experience with LavishScript beyond what I've done here, most of my scripting knowledge comes from MacroQuest so if you see a /return ever from me...you know why :)
 
Last edited:

Charles2584

Well-Known Member
Another change:

So it won't keep targeting rats over and over again that you can't target due to you not having enough targeting skill. (Or just more then 8 targets, good god!)

This is a edit to the original code posted, I've not looked at the second version posted yet (mainly because I don't need it)

Again, my changes are in red.

Code:
objectdef cls_Targets
{
	method Initialize()
	{
	}

	member:bool TargetNPCs()
	{
[COLOR="Red"]		variable int NumberTargeted
		variable index:entity Targets
		variable iterator Target
		EVE:DoGetEntities[Targets, CategoryID, CATEGORYID_ENTITY]
		Targets:GetIterator[Target]
		NumberTargeted:Set[0][/COLOR]
		
		if !${Target:First(exists)}
		{
			echo "No targets found..."
			return FALSE
		}
		if ${Me.Ship.MaxLockedTargets} == 0
		{
			echo "Jammed, cant target..."
			return TRUE
		}
	        [COLOR="Red"]do
		{
			if ${Target.Value.IsLockedTarget}
			{
				NumberTargeted:Set[${NumberTargeted}+1]
			}
		}
		while ${Target:Next(exists)}[/COLOR]
		
		EVE:DoGetEntities[Targets, CategoryID, CATEGORYID_ENTITY]
		Targets:GetIterator[Target]
				
		[COLOR="Red"]if ${Me.MaxLockedTargets} > ${NumberTargeted}
		{
		do
		{
			if !${Target.Value.IsLockedTarget} && !${Target.Value.BeingTargeted} 
			{
				echo "Locking ${Target.Value.Name}"
     			        Target.Value:LockTarget
			}
		
		    
		}
		while ${Target:Next(exists)}
                }[/COLOR]
		return TRUE
	}
Edit: Apparantly there is a difference between ${Me.MaxLockedTargets} and ${Me.Ship.MaxLockedTargets} ...who knew?
 
Last edited:

CyberTech

Second-in-Command
Staff member
Ccomp5950 said:
Another change:

Edit: Apparantly there is a difference between ${Me.MaxLockedTargets} and ${Me.Ship.MaxLockedTargets} ...who knew?

One is skill based, the other (ship) is your ship capabilities. your ship # will drop to 0 when jammed. You need to use whichever # is smaller to determine the max.
 

Charles2584

Well-Known Member
CyberTech said:
One is skill based, the other (ship) is your ship capabilities. your ship # will drop to 0 when jammed. You need to use whichever # is smaller to determine the max.
Yeah, it took me a "Duh" moment to figure that out. Thanks for the tip on the "use the smallest number" though.
 

Da_Teach

Active Member
Released a version with chaining, I'll see about adding some of the remarks from this post in v0.3 but figured this would be nice for some people.
 

GliderPro

Active Member
Da_Teach said:
As for the bounty table, that already exists with an SQL/CSV dump from eve. Would just have to consolidate the data into a nice xml file. However I havent looked into XML interaction with LS yet, I dont know if its hard / easy / whatever.
This is the main reason I wanted to switch to C#. There are already nice libraries for accessing the EVE API and data dumps. I guess it is time to push Cade for some snippets. The more people we have sharing .NET code the more we will all benefit.
 

Da_Teach

Active Member
:lol:

On another note, why on earth, no in our solar system, no in the universe would someone run this bot in empire?
 

Charles2584

Well-Known Member
Da_Teach said:
....
Here's my initial version. Please note this version is made with 0.0 activity in mind.
...
Uhm,....well....uhm...

"Oops" ?

Also, attached is my changes added in with version .0000000002

Pretty much all my comments plus a little something else, I skipped the whole "DoGetPilots" stuff and just went with polling local, which I guess could be a problem if someone jumps in right as you poll local but I've not had a problem with it yet, it still flees to safety if someone comes in. DoGetPilots is the better way of doing it so when that method is fixed I'm changing it back.
 

Attachments

Last edited:

GliderPro

Active Member
I finally got my combat alt setup in 0.0 and tried this script out. It works nice but I am not making anywhere near the ISK/hour Da_Teach does. I made about 55mil in 8 hours of ratting. I was in a cruise Raven, in a -0.4 system with 15+ belts. There was a little competition in the system. This is still better than empire mining but I was expecting alot more.

Da_Teach what is your Raven setup? I notice you are fighting Guristas. I modified the script to recognize Serpentis officers and chain their high end battleships.
 

Antifly

Active Member
GliderPro... I suspect the biggest ISK/hour will be in 0.0 within claimed system with no enemies who can just jump in.
 

GliderPro

Active Member
Slightly off topic...

I was thinking of fielding a passive-tanked Raven for ratting. This thing soaks up 290 DPS (50% kin/50% therm) with the rigs and 148 DPS without. Dropping one of the BCS for another SPR pumps it up higher. Comments?

Code:
[Raven, Serpentis Ratter]
Shield Power Relay II
Shield Power Relay II
Ballistic Control System II
Ballistic Control System II
Ballistic Control System II

Large Shield Extender II
Large Shield Extender II
Large Shield Extender II
Large Shield Extender II
Ballistic Deflection Field II
Heat Dissipation Field II

'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
[empty high slot]
[empty high slot]

Core Defence Field Purger I
Core Defence Field Purger I
Core Defence Field Purger I
This active tanked version actually soaks up 351 DPS and it would be cap stable if I had Energy Mgmt. V.

Code:
[Raven, Serpentis Ratter (active tank)]
Power Diagnostic System II
Power Diagnostic System II
Power Diagnostic System II
Ballistic Control System II
Ballistic Control System II

Cap Recharger II
Cap Recharger II
Large Shield Booster II
Heat Dissipation Field II
Ballistic Deflection Field II
Heat Dissipation Field II

'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
'Arbalest' Cruise Launcher I, Wrath Cruise Missile
[empty high slot]
[empty high slot]

[empty rig slot]
[empty rig slot]
[empty rig slot]
 
Last edited:

GliderPro

Active Member
This change dramatically improved my survivability. In my case I can hit targets well outside my lock range.

Code:
echo "Warping to belt ${Belts.Belt.Value.Name} @ ${Math.Calc[${Me.Ship.MaxTargetRange}*0.80]}"
Belts.Belt.Value:WarpTo[${Math.Calc[${Me.Ship.MaxTargetRange}*0.80]}]
This is the code I'm using now.

Code:
variable int WarpToDistance
WarpToDistance:Set[${Math.Calc[${Me.Ship.MaxTargetRange}*0.85/1000].Round}]
WarpToDistance:Set[${Math.Calc[${WarpToDistance}*1000]}]
echo "Warping to belt ${Belts.Belt.Value.Name} @ ${WarpToDistance}"
Belts.Belt.Value:WarpTo[${WarpToDistance}]
 
Last edited:

Antifly

Active Member
Trying to adapt this script to afk-run missions :)

Currently debuggin in-mission activity.

But this still lacks the ISXEVE features to get Agent Bookmarks, and interface to conversate with agent, accept, decline missions e.t.c :)
 
Last edited:
Top Bottom