Ok. I've done a lot of debugging (and i hate debugging)
And my unsticking problem is solved.
The problem was with textboxes getting focus, but in two places in code.
1. First of all i had to clear focus from "To:" textbox in order to do some further scripting while MailFrame is open.
Code: Select all
RoMScript("MailFrameTab_OnClick(2)")
RoMScript("GetKeyboardFocus():ClearFocus()")
This wasn't causing the unsticking problem though.
Originally i got rid of the focus by double pickup macro:
Code: Select all
RoMScript("PickupBagItem(1)");yrest(100);
RoMScript("PickupBagItem(1)");yrest(100);
It worked, but the ClearFocus() function is better, and i wasn't aware of it, so thx a lot Rock5
2. Further in the code i used a SendMail() function. After that focus goes to "Subject:" textbox.
This was causing the unsticking problem, but also a strange behaviour of micromacro/bot occured
I'll post the two pieces of code . 1st caused unsticking problem.
Code: Select all
RoMScript("SendMail(\""..altName.."\", \"GuildNeedWeapons\", \"\", nil)")
--some code to count the mail
MailsSend=MailsSend+1;
if MailsSend >= MAX_MAILS then
currentAlt=currentAlt+1;
MailsSend=0;
end
if currentAlt> #altList then
endFarming();
end
--closing the mail UI
RoMScript("CloseMail()");
2nd is not causing the problem
Code: Select all
RoMScript("SendMail(\""..altName.."\", \"GuildNeedWeapons\", \"\", nil)")
yrest(1000);
RoMScript("CloseMail()"); --closing the mail UI
--some code to count the mail
MailsSend=MailsSend+1;
if MailsSend >= MAX_MAILS then
currentAlt=currentAlt+1;
MailsSend=0;
end
if currentAlt> #altList then
endFarming();
end
As you can see the difference is in the place where CloseMail() is called.
In the 1st example bot was starting to move immidiately after the SendMail() was called,
but the Mail UI was open for few secs and In the "Subject:" textbox some "wwwwww" were being writen until CloseMail() was called.
Ok, but why did the bot start to move?
Function called in waypoint N was not ended and bot was already moving to N+1 waypoint.
I thought that bot executes all instructions declared in a waypoint and after he finishes them he follows to the next waypoint.
I didn't understand that at beginning.
Now i think it was a delay in the RomScript() function.
Bot did execute the
instruction and moved on not waiting for Rom client to execute the CloseMail();
Again thx for help lisa and Rock5