Newb Help - Eve Dscan Script

Don’t know what is wrong it works fine with me One thing it could be … is it putting 'V’s in chat? You might want to replace the Keyboard press function with the actual mouse click. But that requires you to find the dscan window
which your code already has and click the Scan button.
My function was written quickly and needs a bath. I tested it for a couple iterations I called it like DScan(60);
so 60 iterations at 10 seconds each
Which ran perfectly while I was killing sleepers in a wormhole.

Maniac

Thanks for the help - this is a nice and simple little bit of code that will be good for me to troubleshoot and learn.

I also want to definitely figure out how to do it via ‘finding the window’ and a mouse click. Once I have that knowledge, I can start customizing some more in small increments to build a perfect script for my needs :slight_smile:

Thanks again!

EDIT: …and yes, the motivation for my script is to make life a little easier in the wormholes!
EDIT2: Oh, and no - it wasn’t entering anything in chat. It simply ran once (without appearing to do anything), no errors and did not run 9 more intervals, like was specified. I’ll try and figure it out, though. If it worked once - it can work again.

My 2 pence:

If you want to be sure that your script does not write “v” in the chat window, you can add something like that (it will left clic on your ship UI center (capacitor))

var ListSurroundingsButton =Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.Center;
Sanderling.MouseClickLeft(ListSurroundingsButton);

if you put that in the “while” instruction it will do it at each call of DScan. If before, only once (witch might be enough)

/// Simple function to dscan no error checking
/// Default usage runs for 10 times with a delay of 10 seconds
void DScanner(int HowMany=9,int Delay=10)
{
var Capa=Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.Center;
Sanderling.MouseClickLeft(Capa);
while(0 < HowMany)
{
Sanderling.KeyboardPress(VirtualKeyCode.VK_V);
Host.Delay(1000*Delay);
HowMany–-;
}
}`

Edit: I said a nonsense about x10000 for millisecondes…

1 Like

That is a great function to add into this little script!

I am going to try and implement that as soon as I can resolve the script failure to run properly on my machine

Welcome @f-derf!

I had a look at this problem.
I took the code posted by @Maniac and modified it to fix the problem you are seeing. Following is the complete code:

/// Simple function to dscan no error checking
/// Default usage runs for 10 times with a delay of 10 seconds
/// The following code is contained in a 'method' and only executed when this method is called ->
void DScanner(int HowMany=9,int Delay=10)
{
while(0 < HowMany)
{
Host.Log("I press the key now....");
Sanderling.KeyboardPress(VirtualKeyCode.VK_V);
Host.Delay(1000*Delay);
HowMany--;
}
}

DScanner(4, 10); // This is a method call

Doh and that’s why I had no problem with running it… I was calling mine with DScanner(60);

Didn’t think like a novice just assumed that someone would see that this was a function/method and would have to call it.

You know the problem with assume…
Maniac :grin:

1 Like

Ahh-hah!

Ok, this is starting to make more sense to me. I need to get a better grasp of the syntax and the structure but, I think I am starting to understand the fundamentals. Thanks for that addition of the method call - that was a missing piece of the puzzle. I was never executing the function of the code section. It basically ran with no instructions - makes perfect sense.

Also, thanks for the “code block” reference… I must have overlooked it - I don’t want to look lazy :smiley:

I’ve used the code that all 3 of you helped me with and it works perfectly. …in an effort to stay stealthy - I would like to invoke the random number generator to define a period of delay between scans (I have other uses planned for this as well). Basically, I would specify that I want the scan to operate every, for example, 5 to 15 seconds.

I added a few lines (which I borrowed from @kaboonus and it seems to function. I am confused, though, as to what the numbers in “void DScanner(int HowMany=9,int Delay=10)” and the “DScanner(4, 10);”, do.

With my current script, it runs 4 times and then stops. It seems as though my random lines are overriding the 10 second delay… which is fine. The void statement seems to have no effect, though.

/// Simple function to dscan no error checking
/// Default usage runs for 10 times with a delay of 10 seconds
/// The following code is contained in a 'method' and only executed when this method is called ->
var MinimDelayDscan = 5;//in seconds //random number range mimimun
var MaximDelayDscan = 15;//in seconds //random number range maximum

void DScanner(int HowMany=9,int Delay=10) //????
{
	var Capa=Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.Center; //find this bit of the UI
		Sanderling.MouseClickLeft(Capa);	//click this bit ^^
while (true)//(0 < HowMany)  uncomment this and replace true to set number of cycles #1
{
		Random rnd = new Random();	//random number code
        int DelayTime = rnd.Next(MinimDelayDscan, MaximDelayDscan);	//random number code
        Host.Log("Dscan in :  " + DelayTime+ " s ");	//echo in log what is happening
		Sanderling.KeyboardPress(VirtualKeyCode.VK_V);	//virtual keyboard press "v"
		Host.Delay(789*Delay);	//time to wait between code runs
		//HowMany--; uncomment this and replace 'true' to set number of cycles #2
}
}
	 // This is a method call
	DScanner(10);//, 10); uncomment this and add ', 10);'to set number of cycles #3

Thanks again for your help and patience - I’m making small steps :slight_smile:

EDIT: Do the variables in the method call override the variables in the void statement? I now have this:
DScanner(4); // This is a method call
…and it didn’t break

1 Like

basicaly from your last post I understand that:
you click on center of shipui center.
while that is true, you take a random number between 5 and 15(delaytime)
you press V ( to scan system)
you wait 789*10 (delay ) => 7890 miliseconds = 7.8 sec.

so your random time have no impact.
for having an impact you have to have :slight_smile:

Host.Delay(DelayTIme*1000) //=> delay of random generated in seconds

dscan

Hmm… I am not sure how, but it appears to be working with random generated pause between “V” presses

EDIT: Here is exactly what I am running right now:

/// Simple function to dscan no error checking
/// Default usage runs for 10 times with a delay of 10 seconds

// DScanner(19,3) will run 20 times at 3 second intervals
// DScanner(19) will run 20 times at Delay=10 intervals
// DScanner() will run 10 times at Delay=10 intervals
// the int HowMany=9 and int Delay=10 are placeholders for arguments they will 
// default to 9 and 10 if they are not present

/// The following code is contained in a 'method' and only executed when this method is called ->
var MinimDelayDscan = 5;//in seconds //random number range mimimun
var MaximDelayDscan = 15;//in seconds //random number range maximum

void DScanner(int HowMany=9,int Delay=10) //????
{
	var Capa=Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.Center; //find this bit of the UI
		Sanderling.MouseClickLeft(Capa);	//click this bit to insure 'chat' is not focused ^^
while (true)//(0 < HowMany)  uncomment this and replace true to set number of cycles #1
{
		Random rnd = new Random();	//random number code
        int DelayTime = rnd.Next(MinimDelayDscan, MaximDelayDscan);	//random number code
        Host.Log("Dscan in :  " + DelayTime+ " s ");	//echo in log what is happening
		Sanderling.KeyboardPress(VirtualKeyCode.VK_V);	//virtual keyboard press "v"
		Host.Delay(789*Delay);	//time to wait between code runs
		//HowMany--; uncomment this to set number of cycles #2
}
}
	 // This is a method call
	DScanner();//(10, 10); uncomment this to set number of cycles #3

it says that, not apply.

 Host.Log("Dscan in :  " + DelayTime+ " s ");	

it just post a log, you can change him to say… " Im the best in the world 1" and you will see
if you want him to say the real thing, add after

Host.Delay(789*Delay);	
 Host.Log("Dscan in :  " + 789*Delay+ " s ");	
2 Likes

OK, I see what you are saying. My counter is not accurate.

I’m going to change that and test it.

Edit: Ok, I understand now. By setting the host delay to 7.89 seconds - the code will never run faster than that.
I have changed Host.Delay(789Delay) —> Host.Delay(499Delay);

It seems to work perfect.

Great observation - thank you!!! :+1:

EDIT2: Hmm maybe I don’t have it figured out. Now the scan fires every 4.99. lol. I am a blind man in the china shop. I will figure it out, though

@kaboonus I am sorry - you gave me the solution in your first post :frowning:

I didn’t catch the “DelayTime” item which references the “Int DelayTime” bit.

1 Like

try with:

Random rnd => new System.Random();

instead of

Random rnd = new Random();

I had an isue like this (always the same random) and it fixed my problem.

var MinimDelayDscan = 5;//in seconds //random number range mimimun
var MaximDelayDscan = 15;//in seconds //random number range maximum
void DScanner(int HowMany=9,int Delay=10) //????
{
	var Capa=Sanderling?.MemoryMeasurementParsed?.Value?.ShipUi?.Center; //find this bit of the UI
		Sanderling.MouseClickLeft(Capa);	//click this bit to insure 'chat' is not focused ^^
while (0 < HowMany) 
{
		Random rnd = new Random();	//random number code
        int DelayTime = rnd.Next(MinimDelayDscan, MaximDelayDscan);	//random number code

		Sanderling.KeyboardPress(VirtualKeyCode.VK_V);	//virtual keyboard press "v"
int fixeddelay = 789*Delay;
		Host.Delay(fixeddelay );	//if you want at 7.89s
Host.Log("Dscan in :  " + fixeddelay + " s ")
int randomdelay =DelayTime *1000;
//Host.Delay(randomdelay )// if you want at random generated seconds
		//Host.Log("Dscan in :  " + randomdelay + " s ");	//echo in log what is happening
//HowMany-- // if you want 9 times to scan
}
}

***fixed some things

1 Like

I’m going to search the site and find something that lists these syntax so I can tell what the differences are. You folks are being very patient and helpful with me, on this little project, and I want to make sure I understand better so I am not wasting people’s time.

I developed for you to understand better:
fixed delay - active in this code, with his log
and random delay - commented in this code lines, you comment the ones for fixed delay and uncomment this ones

This simple script is really helping me understand.

I learn better by ‘doing’ things and seeing what works and what doesn’t - this input is exactly what I need. Right now, I clearly have very little idea of what I am doing :rofl:

is simple:
usual you use

int x = 2000; 
Host.Delay(2000); 
or 
Host.Delay(x); 
are the same

how you calc x is in function of your need:
1 way : x = 789* 10
2 way x= 789*delayvalue and delayvalue is 10
3 way random generated number *1000 => to have seconds, because host.delay is in miliseconds
or 4rd way:
directly random generated between 5000 and 10000 ( value is in miliseonds directly
and in this case you have
Host.Delay(random);