rayitaly
(Toni)
January 16, 2019, 6:13pm
1
Hello Guys,
i am Using Sanderling now for sametime and i try to ehance the code to my needs.
My biggest Problem in the moment is that my Internetconnection is pretty unstable. 5 to 10 Times a day it lost.
So i Try to program the Mining bot to Stop.
I figure out that Eve-online bring a big “Connection Lost” Window and sanderling can mesure it:
MemoryMeasurement?.Value?.WindowOther …
So i want to make a if-statemant when the “Connection Lost” Popup comes. but i have problems to build the boolean.
Can someone write for me the right syntax for the boolean?
Thanks in advance!
Toni
1 Like
here you have what you need:
and even
Sanderling.MouseClickLeft(ButtonClose);
}
void CloseWindowTelecom()
{
var WindowTelecom = Measurement?.WindowTelecom?.FirstOrDefault(w => (w?.Caption.RegexMatchSuccessIgnoreCase("Information") ?? false));
var CloseButton = WindowTelecom?.ButtonText?.FirstOrDefault(text => text.Text.RegexMatchSuccessIgnoreCase("Close"));
var HavenTelecom = Measurement?.WindowTelecom?.FirstOrDefault()?.LabelText?.FirstOrDefault(text => (text?.Text.RegexMatchSuccessIgnoreCase("Ship Computer") ?? false));
if (CloseButton != null)
Sanderling.MouseClickLeft(CloseButton);
}
public void CloseWindowOther()
{
var ConnectionLost = Measurement?.WindowOther?.FirstOrDefault()?.LabelText?.FirstOrDefault(text => (text?.Text.RegexMatchSuccessIgnoreCase("Connection") ?? false));
var ButtonQuit =
ModalUIElement?.ButtonText?.FirstOrDefault(button => (button?.Text).RegexMatchSuccessIgnoreCase("quit|close|ok"));
if (ConnectionLost != null)
{
Host.Log(" Lost connection at : " + DateTime.Now.ToString(" HH:mm")+ "" );
Console.Beep(1047,150);
Host.Delay(150);
another way was posted here
So I finally downloaded an updated version of Sanderling today and it’s complaining that “System.Diagnostics.Process” is not supported.
I have this at the top of my script #r “System.Diagnostics.Process”
I use it to kill the eve client if I detect a connection lost window.
Is this no longer supported or can I do something fix it?
Thanks all.
but you have to ask the ower how it solve entire thing ( kill eve process + sanderling and restart the game+sanderling)
1 Like
rayitaly
(Toni)
January 16, 2019, 6:34pm
3
Very Nice!
i think i was near
So i put it now in my script and will test it!
Thank You!
1 Like
i use them both, in close modal element and close windowother because sometimes modal one doesn’t react
rayitaly
(Toni)
February 1, 2019, 4:45pm
5
hello kaboonus,
so i have try something like this:
if (ConnectionLost != null){
Host.Log(" *** Lost connection at : " + DateTime.Now.ToString(" HH:mm")+ " *** " );
Console.Beep(1047,150);
Host.Delay(150);
} else {
Host.Log(" *** Online: " + DateTime.Now.ToString(" HH:mm")+ " *** " );
}
so far so good, but i have no command to stop the bot.
When i try to use “break;” then i get the message “no loop”
i use the block inside a function.
so have you a hint for me?
Thanks!
if is inside a void, use
ModalUIElement?.ButtonText?.FirstOrDefault(button => (button?.Text).RegexMatchSuccessIgnoreCase("quit|close|ok"));
if (ConnectionLost != null)
{
Host.Log(" Lost connection (modal) at : " + DateTime.Now.ToString(" HH:mm")+ "" );
Console.Beep(1047,150);
Host.Delay(150);
Console.Beep(784,150);
Sanderling.MouseClickLeft(ButtonClose);
Sanderling.MouseClickLeft(ButtonQuit);
Host.Delay(1111);
Sanderling.KeyboardPressCombined(new[] { lockTargetKeyCode, VirtualKeyCode.LMENU });
//return BotStopActivity;
}
if (NotEnoughCargo != null)
{
var OkyButton = Sanderling?.MemoryMeasurementParsed?.Value?.WindowOther?.FirstOrDefault()?.ButtonText?.FirstOrDefault(text => text.Text.RegexMatchSuccessIgnoreCase("ok"));
if (OkyButton != null)
with
Sanderling.KillEveProcess();
or like in the script
( and in this case you have to auto ok ingame) => the bot will stop automaticaly
If is in a function like Func<object> DefenseStep()
then you use
if (string.IsNullOrEmpty(Dasher))
{ Sanderling.MouseMove(MerryChristmas);
Sanderling.WaitForMeasurement(); }
Host.Log(" dasher ++ " +Dasher+ "");
Paracelsus =Regex.Replace(Dasher ?? "", "[^0-9]+", "") ;
Host.Log(Paracelsus);
HocusPocusPreparatus = Convert.ToInt64(Paracelsus);
Host.Log(" ⊙ Kaboonus Gift From Yesterday : " +HocusPocusPreparatus.ToString("N0")+ "");
Host.Log(" System : " +currentLocationName+ " ");
Func<object> BotStopActivity = () => null;
Func<object> NextActivity = MainStep;
for(;;)
{
MemoryUpdate();
Host.Log(
" > " +CharName?.ToUpper()+ " Started in " +currentLocationName+ " script: " +VersionScript+// " at: " + startSession.ToString(" HH:mm") +// alternative (" dd/MM/yyyy HH:mm")
" ; Logout in: " + ((TimeSpan.FromMinutes(logoutgame) < TimeSpan.Zero) ? "-" : "") + (TimeSpan.FromMinutes(logoutgame)).ToString(@"hh\:mm\:ss")+
" ; Sites " + sitescount+ "" +
" ; HP: Shield: " + ShieldHpPercent + "% ; Armor: " + ArmorHpPercent + "%" +
and
where you need you use return botstopactivity
like here
KaboonusTalk ();
ReviewSettings();
K--;
return MainStep;
}
if ( ReasonTimeElapsed || ReasonCapsuled ||ReasonDrones)
{
Host.Log(" Refill your drones / Times up or you are capsuled = bot stop");
//Sanderling.KeyboardPressCombined(new[]{ VirtualKeyCode.LMENU, VirtualKeyCode.SHIFT, VirtualKeyCode.VK_Q});
Host.Delay(3111);
return BotStopActivity;
}
while ((RetreatOnNeutralOrHostileInLocal && hostileOrNeutralsInLocal) || tooManyOnLocal)
{ Host.Log(" I feel a great disturbance in the Force ... taking a nap into station until hostiles go from this system");
Host.Delay(4111);
return MainStep;
}
Host.Delay(4111);
CheckLocation();
EnsureWindowInventoryOpen();
1 Like
rayitaly
(Toni)
February 1, 2019, 6:19pm
7
hmm… my bot did not stop when the bot lost the eve prozess
it only stop when i use break in a loop and the script run to the end. in the travel script it runs without problems
Better copy your script in pastebin ( make an accoun) in private mode and send me the link, too see all. From your picrure i dont understand
1 Like
rayitaly
(Toni)
February 1, 2019, 6:52pm
9
here it is
i am not firm in C Sorry!
2 Likes
ok, wait to finish a site and I take a look ( 10 min from now)
your line 160 it is:
if(BotStopActivity == NextActivity){
Host.Log("BotStop, no Next Activity?");
break;
than means :
only if BotStopActivity == NextActivity
then he execute
Host.Log(“BotStop, no Next Activity?”);
and a new command,
break;
in other words, only if ( etc) then he show a log.
after that, the script break, even if ( ) is not true.
it should execute like that:
if ()
then execute ( hostlog and after that break)
in other words:
if(BotStopActivity == NextActivity){
{
Host.Log("BotStop, no Next Activity?");
break;
}
that means:
if (a=true) then execute(like a block) { first command+second+third+…+n} all only because if is true.
if you use
if (a=true)
execute first command (a)
then after that ; even if is not true, then B , C , D , etc.
1 Like
rayitaly
(Toni)
February 1, 2019, 9:19pm
12
ok, i understand that , but it never happens. it only stops some times after unloading in the dock. maybe this cod epart is the reason. i have copy this from the old code.
but i think this is not the reason why the script dont stop when the eve-client lost the connection. or not?
Your script it stop thz bot only when the ship is in station and his shield is small
Connectionlost window os an modal window.
At lines 340,where you detect connection lost you should add sanderling. Killeve . Use the dev interface from sanderlig, i tape on phone
later:
if (ConnectionLost != null){
Host.Log(" *** Lost connection at : " + DateTime.Now.ToString(" HH:mm")+ " *** " );
Console.Beep(1047,150);
Host.Delay(150);
return BotStopActivity; // or kill eve, normally sanderling should stop taking your credit
}
1 Like
rayitaly
(Toni)
February 5, 2019, 5:23pm
14
very nice! thank you for the command. it look like the peace i have missed.
i will test i now.
rayitaly
(Toni)
February 18, 2019, 5:44pm
15
The End!
This works now well for me:
var ConnectionLost = Measurement?.WindowOther?.FirstOrDefault()?.LabelText?.FirstOrDefault(text => (text?.Text.RegexMatchSuccessIgnoreCase("Connection") ?? false));
if (ConnectionLost != null){
Host.Log(" *** Lost connection at : " + DateTime.Now.ToString(" HH:mm")+ " *** " );
Console.Beep(1047,150);
Host.Delay(150);
return BotStopActivity;
} else {
Host.Log(" *** Online: " + DateTime.Now.ToString(" HH:mm")+ " *** " );
}
1 Like