Newb Help - Eve Dscan Script


#21
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


#22

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.


#23

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


#24

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:


#25

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);


#26
//config section
var MinimDelayDscan = 5;//in seconds //random number range mimimun
var MaximDelayDscan = 15;//in seconds //random number range maximum
// end of config section

Random rand => new System.Random();
int Variation(int min, int max) {return rand.Next(min, max);}

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) 
{
		Sanderling.KeyboardPress(VirtualKeyCode.VK_V);	//virtual keyboard press "v"
		Host.Delay(1000*Variation(MinimDelayDscan,MaximDelayDscan));	
HowMany --;
}
}

With this peace of script, I don’t know how to have a log of the delay randomly generated.
Advantage is: You can reuse Variation(min,max) in other functions all over your script.

edit: Wich is the 4th way explained by Kaboonus just above.


#27

This is a good idea. One of my plans is to add some mining into this script (in case you have not guessed, this script is being designed with WH and NS space, with no “home”, in mind) as well and I want some randomness to how often the ore is offloaded (ie; 85%-100%). I think the method you and Kaboonus are showing me is the best way. The logging was really only there so I could watch the script “work” and get a feel for functionality. I don’t think there would be a need for it in the completed project.

My plan for the week:

  1. add sound when ship appears on overview and/ or dscan (would prefer Dscan for first version)
    1a. Retreat ship to BM safe when ship appears on overview
  2. merge autopilot functionality
  3. Add mining functionality w/ random orehold unload %
    3a. Add ability to jettison ore in space (I want my main to pick up the ore at a BM- yet have no easily traceable relation to the scripted toon for detection)
  4. Eventually, I would like to make toggles to enable all or some of the sections depending on what I am doing in space. For now, I will use separate scripts for each section.

Most of this code is available in other scripts so, I just need to figure out how to put it together and make it look pretty :slight_smile:


#28

I was planned to do an combat/mining for WH script, but this will be next week, when I will be availble to code again


#29

I can’t wait to see what you come up with - I’m certain it will be very useful! I’d like to help but, I’m afraid I have very little to offer :smiley:


#30

I ended up using a V macro. Just have to have the Dscanner window open.

Sanderling.KeyboardPress(VirtualKeyCode.VK_V);


#31

So - here is the finished functioning script - it is a little sloppy, since I left my “learning notes” in there but, if someone needs a simple Dscan script, that works - here it is:

/// Simple function to dscan no error checking
/// Default usage runs indefinitely with a random delay between scans

/// 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
		Random rnd = new System.Random();	//another 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
		Host.Delay(DelayTime*1000); //=> delay of random generated in seconds
		//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