Mining bot

Is there a code to launch the drones on warpin to belt. i have noticed that when using a venture in highsec that is its a jammer rat, you can stay jammed forever and if the drones were launched upon landing in site they would attack on aggresing and counter the jamming.

TY
Niotras

What about the method from Sanderling/Mine.ore.cs at f80fab8ca73e9cd1ccc0dcbeed84d40ab0380379 · Arcitectus/Sanderling · GitHub to launch the drones?

Tried the script you linked, same thing happends. bot wont launch drones untill my enter defense limit has been reached and cant send drones to attack target because the rat is jamming me.

I see I should have explained this in more detail: What I meant is using the portion with is from line 199 to line 204 and call that to launch the drones.

What do you think about this approach to cover the part of launching?

I guess it should work, have never done any coding before but il see if i can put those lines in somwhere after entering site.
will have to wait till i get off work.

I see, in this case, I point out that there is no need to copy the lines in order to use them. You can instead call those with the following code:

DroneLaunch();
```

So, i’m trying to do that ^ but i cant seem to figure out how to know what happens when? I’ve tried using DroneLaunch(); in multiple places, the most puzzling being within the inbeltminestep(). the hope was that it would start up its function, and before it does anything else, it pops its drones out. later in the dock/retreat it has a gather drones piece in it so i figured if i could just get them to launch immediately after dropping out of warp, i could let the already written stuff do the cleanup. but they never launch and i’ve no idea why.

Blockquote
Func InBeltMineStep()
{
DroneLaunch();
if (DefenseEnter)
{
Host.Log(“enter defense.”);
return DefenseStep;
}
[…]
}

When you tested this, did execution of the script arrive at the point where you added the call to DroneLaunch?

I can only assume so, it does everything else just fine, mine, dock, move ore etc. here’s the whole function i modified in the script.

Func InBeltMineStep()
{
DroneLaunch();
if (DefenseEnter)
{
Host.Log(“enter defense.”);
return DefenseStep;
}

EnsureWindowInventoryOpenOreHold();

EnsureOverviewTypeSelectionLoaded();

if(OreHoldFilledForOffload)
	return null;

var moduleMinerInactive = SetModuleMinerInactive?.FirstOrDefault();

if (null == moduleMinerInactive)
{
	Host.Delay(7777);
	return InBeltMineStep;
}

var	setTargetAsteroidInRange	=
	SetTargetAsteroid?.Where(target => target?.DistanceMax <= MiningRange)?.ToArray();

var setTargetAsteroidInRangeNotAssigned =
	setTargetAsteroidInRange?.Where(target => !(0 < target?.Assigned?.Length))?.ToArray();

Host.Log("targeted asteroids in range (without assignment): " + setTargetAsteroidInRange?.Length + " (" + setTargetAsteroidInRangeNotAssigned?.Length + ")");

if(0 < setTargetAsteroidInRangeNotAssigned?.Length)
{
	var targetAsteroidInputFocus	=
		setTargetAsteroidInRangeNotAssigned?.FirstOrDefault(target => target?.IsSelected ?? false);

	if(null == targetAsteroidInputFocus)
		Sanderling.MouseClickLeft(setTargetAsteroidInRangeNotAssigned?.FirstOrDefault());

	ModuleToggle(moduleMinerInactive);

	return InBeltMineStep;
}

var asteroidOverviewEntryNext = ListAsteroidOverviewEntry?.FirstOrDefault();
var asteroidOverviewEntryNextNotTargeted = ListAsteroidOverviewEntry?.FirstOrDefault(entry => !((entry?.MeTargeted ?? false) || (entry?.MeTargeting ?? false)));

Host.Log("next asteroid: (" + asteroidOverviewEntryNext?.Name + " , distance: " + asteroidOverviewEntryNext?.DistanceMax + ")" + 
	", next asteroid not targeted: (" + asteroidOverviewEntryNext?.Name + " , distance: " + asteroidOverviewEntryNext?.DistanceMax + ")");

if(null == asteroidOverviewEntryNext)
{
	Host.Log("no asteroid available");
	return null;
}

if(null == asteroidOverviewEntryNextNotTargeted)
{
	Host.Log("all asteroids targeted");
	return null;
}

if (!(asteroidOverviewEntryNextNotTargeted.DistanceMax < MiningRange))
{
	if(!(1111 < asteroidOverviewEntryNext?.DistanceMin))
	{
		Host.Log("distance between asteroids too large");
		return null;
	}

	Host.Log("out of range, approaching");
	ClickMenuEntryOnMenuRoot(asteroidOverviewEntryNext, "approach");
}
else
{
	Host.Log("initiate lock asteroid");
	ClickMenuEntryOnMenuRoot(asteroidOverviewEntryNextNotTargeted, "^lock");
}

return InBeltMineStep;

}

ok so i grabbed a fresh copy of the mining script and made the change again. worked, i must have borked something up while tinkering somewhere else.

as half expected it launched the drones, but didn’t stop launching them since there is no qualifier for the launch. i need to do a check of some kind to see if i already have drones in space before i try to launch them. i saw some likely very related stuff somewhere else in the script. i will check it out.

but how do you reference a property in an “if”? i found the one i want:

image

pardon the fake code but i dont know how else to figure out what i’m looking for. i want to do something similar to the following:

Func InBeltMineStep()
if (ShipUISpeedLabelProperty.text = ‘(Warping)’) # the property from the screenie
{
Host.Delay(1000); # i’m assuming milliseconds? so 1 sec?
}
else
{
if ( ! ( Drones.In.Space = 5 ) )
{
DroneLaunch();
}
[…] # continue with InBeltMineStep()
}

i want a wait loop until i’ve dropped out of warp completely before attempting to launch the drones. i want it to happen before i start locking roids/rats. also, im kind of feeling like i shouldnt even need the defense steps included if i always have my drones out anyway yeah? so maybe i should dump/disable them? any way to comment out their calls?

sorry, i’m… prettyfamiliar with powershell which uses .net which seems fairly similar to this language, but i wouldn’t dream of calling myself even remotely fluent in .net so while it looks familiar to some ways, it’s pretty alien in others.

Why can you only assume? Is there a problem with measuring if this happens?

C# is the keyword you want to look for, as it is the name of the programming language used in the Sanderling IDE: c# comment - Google Suche

An example what you can find this way:

// this is a singleline comment.

/*
multiline comment
*/

i can only assume because i dont know how to do that. the best i came up with is to flank the command with Host.Logs, which i did, but like i said, i must have borked the previous script as launching them is no longer an issue. once i started fresh and re added the launch call it worked.

“Is there a problem with measuring if this happens?”

I have no idea how to measure anything.

I understand the original issue was resolved anyway, but in case you are facing such a problem again, we can look into how measuring works.

that would be great, ty. and this may be a case of me just not understanding what is meant by measuring.

but at this point my main issue is figuring out how to use property values in if statements and such. once i find a property i want to key off of, how do i check that value in the script? i tried a few different things that made some kind of sense to me but none of them worked so i kinda feel like I’m spinning my wheels and getting nowhere fast.