Trying to get script to work

memory-reading
script
eve-online

#1

I’m just trying to get started making a script … I am trying to just measure some modules (hardners) and turn them on if they are off … I use the following script … execute it … no errors … but nothing happens …

using BotSharp.ToScript.Extension;
using MemoryStruct = Sanderling.Interface.MemoryStruct;
using Parse = Sanderling.Parse;

string OverviewPreset = null;

var ActivateHardener = true;

	
	Host.Log("Prior to void Main");

void Main()
{

	// measure modules
	ModuleMeasureAllTooltip();
	
	ActivateHardenerExecute();
		
}

Sanderling.Parse.IMemoryMeasurement	Measurement	=>
	Sanderling?.MemoryMeasurementParsed?.Value;

Parse.IShipUi ShipUi => Measurement?.ShipUi;

bool ReadyForManeuverNot =>
	Measurement?.ShipUi?.Indication?.LabelText?.Any(indicationLabel =>
		(indicationLabel?.Text).RegexMatchSuccessIgnoreCase("warp|docking")) ?? false;

bool ReadyForManeuver => !ReadyForManeuverNot && !(Measurement?.IsDocked ?? true);

void ModuleMeasureAllTooltip()
{
	
	Host.Log("measure tool tips of all modules.");

	for (;;)
	{
		var NextModule = Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule?.FirstOrDefault(m => null == m?.TooltipLast);

		if(null == NextModule)
			break;

		Host.Log("measure modules");
		//	take multiple measurements of module tool tip to reduce risk to keep bad read tooltip.
		Sanderling.MouseMove(NextModule);
		Sanderling.WaitForMeasurement();
		Sanderling.MouseMove(NextModule);
		Host.Log("Testing");
	}	
}

void ActivateHardenerExecute()

{
	Host.Log("Activate Hardener Function");
	
	var	SubsetModuleHardener =
		Sanderling.MemoryMeasurementAccu?.Value?.ShipUiModule
		?.Where(module => module?.TooltipLast?.Value?.IsHardener ?? false);

	var	SubsetModuleToToggle =
		SubsetModuleHardener
		?.Where(module => !(module?.RampActive ?? false));

	foreach (var Module in SubsetModuleToToggle.EmptyIfNull()) ModuleToggle(Module);
		
}

void ModuleToggle(Sanderling.Accumulation.IShipUiModule Module)
{
	var ToggleKey = Module?.TooltipLast?.Value?.ToggleKey;

	Host.Log("toggle module using " + (null == ToggleKey ? "mouse" : Module?.TooltipLast?.Value?.ToggleKeyTextLabel?.Text));

	if(null == ToggleKey)
		Sanderling.MouseClickLeft(Module);
	else
		Sanderling.KeyboardPressCombined(ToggleKey);
}


#2

I am not sure what you are seeing.

Do you see the log message "Prior to void Main" in the log section?


#3

yes i do see “prior to void main”

Nothing happens with the eve client …

I have used a-bot and you can see the mouse move about reading tooltips … nothing like that happens with the above script. I know its not a lot in there … just wanting to put a little bit at a time to understand whats going on … steps and so forth.


#4

To make something happen in the EVE client, you can give instructions what to do in the script.

I made this script which demonstrates how this can be done:

var menuEntry =
	Sanderling?.MemoryMeasurementParsed?.Value?.Menu?.FirstOrDefault();

if(null == menuEntry)
{
	Host.Log("I found no menu entry.");
	return;
}

Host.Log("I found a menu entry and move the mouse to there.");

Sanderling.MotionExecute(menuEntry.MouseMove());