PDA

View Full Version : Lodestone Failsafe



Clutch
03-13-2015, 03:48 AM
Not sure exactly what else to say. I've created over 50 accounts testing this and can't get it to be flawless. Any suggestions on a failsafe to detect if the lodestones actually been unlocked? Right now I'm still testing to try and get the ATPA to pick up 100% of the time but due to them being a one chance type of thing it takes an extremely long time...


procedure ULumToAl;
begin
repeat

findColorsSpiralTolerance(x, y, TPA, 7511227, mainScreen.getBounds(), 2, colorSetting(2, 0.21, 1.72));

if (Length(TPA) < 1) then
exit;

ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['harid', 'lodesto'], 500) then
begin
fastClick(MOUSE_RIGHT);
begin
chooseOption.select(['Activate Al Kharid lodestone'], 500);
writeLn('Al Kharid Lodestone Unlocked');
smartImage.clear;
break;
end;
end;
end;
until
UnlockTimer.getTime() >10000;
wait(randomRange(3000,3500));
mouse(point(288,211),MOUSE_LEFT)

Above is one of my lodestones that NEVER misses. I have 3 of them that will miss fairly often though either on the right-click or the left click to select option. I've altered filter and TPA box above (that picks up how big it needs to be) and the settings that they are at are pretty much as close as I can get it so that it can at least pick up the TPA boxes at all times. (Yes, I've checked colors, went through all F2p worlds 3-44 and got ~10-14 different colors on each). Basically I just need a failsafe so that when it right-clicks when it picks up active lodestone that it will loop through the process again until the lodestones been activated. I have no idea what the code would be to make the check that it's been activated though.

The Mayor
03-13-2015, 04:55 AM
procedure ULumToAl;
var
x, y, i: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
unlockTimer: TTimeMarker;
begin
unlockTimer.start();

repeat
findColorsSpiralTolerance(x, y, TPA, 7511227, mainScreen.getBounds(), 2, colorSetting(2, 0.21, 1.72));

if (length(TPA) < 1) then exit();

ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['harid', 'lodesto'], 500) then
begin
fastClick(MOUSE_RIGHT);
if chooseOption.select(['ctivate'], 500) then
begin
writeLn('Al Kharid Lodestone Unlocked');
smartImage.clear();
break(2);
end;
end;
end;

until (unlockTimer.getTime() > 20000);

end;

Clutch
03-13-2015, 06:18 AM
The Mayor;

Thanks will test it out soon. That being said the until function.. does it only take the next line? In this case the until is ONLY for the unlock timer. The wait random and mouse point will occur regardless or is it only for the until function?

until UnlockTimer.getTime() >20000;
wait(randomRange(3000,3500));
mouse(point(288,211),MOUSE_LEFT)
end;

Or does it need to be like this for the mousepoint to interact after the successful unlocking of lodestone;

until UnlockTimer.getTime() >20000;
begin;
wait(randomRange(3000,3500));
mouse(point(288,211),MOUSE_LEFT)
end;
end;

The Mayor
03-13-2015, 07:38 AM
The Mayor;

Thanks will test it out soon. That being said the until function.. does it only take the next line? In this case the until is ONLY for the unlock timer. The wait random and mouse point will occur regardless or is it only for the until function?

until UnlockTimer.getTime() >20000;
wait(randomRange(3000,3500));
mouse(point(288,211),MOUSE_LEFT)
end;

Or does it need to be like this for the mousepoint to interact after the successful unlocking of lodestone;

until UnlockTimer.getTime() >20000;
begin;
wait(randomRange(3000,3500));
mouse(point(288,211),MOUSE_LEFT)
end;
end;


I don't think you understand how the until condition works. It will repeat the loop (everything between the repeat and until) until the 'until condition' is met. Basically:

repeat
//repeat everything here
until "some boolean = true"


Currently, your loop will do this:

repeat
// code
until UnlockTimer.getTime() >20000;

wait(randomRange(3000,3500)); // These are outside of the repeat..until
mouse(point(288,211),MOUSE_LEFT);


The wait and mouse procecures will only run after the script had broken out of the repeat...until loop, they have nothing to do with the 'until condition'.

Clutch
03-13-2015, 07:41 AM
I don't think you understand how the until condition works. It will repeat the loop (everything between the repeat and until) until the 'until condition' is met. Basically:

repeat
//repeat everything here
until "some boolean = true"


Currently, your loop will do this:

repeat
// code
until UnlockTimer.getTime() >20000;

wait(randomRange(3000,3500)); // These are outside of the repeat..until
mouse(point(288,211),MOUSE_LEFT);


The wait and mouse procecures will only run after the script had broken out of the repeat...until loop, they have nothing to do with the 'until condition'.

Right, so if I wanted to add another until condition then I would have to use UnlockTimer.GetTime() >20000 or something something;
Thanks for clarifying that and I do a poor job explaining how I interpret it, lack of experience!

The Mayor
03-13-2015, 07:45 AM
Right, so if I wanted to add another until condition then I would have to use UnlockTimer.GetTime() >20000 or something something;
Thanks for clarifying that and I do a poor job explaining how I interpret it, lack of experience!

Yeah, you can add additional conditions with or. Just remember that the conditions have to return a boolean (True or False):


repeat
//stuff
until boolean1 or boolean2 or (not boolean3);
;

Clutch
03-13-2015, 02:48 PM
Yeah, you can add additional conditions with or. Just remember that the conditions have to return a boolean (True or False):


repeat
//stuff
until boolean1 or boolean2 or (not boolean3);
;

Alright thank you a lot! Slightly off topic but, where do I find all these little details on how to do things, ex. TTimer, is there information on it within like the includes or is all of those "little things" just learned from experience over time? (Yes TTimer was probably a horrible example but I couldn't think of anything else)

3Garrett3
03-13-2015, 03:41 PM
Alright thank you a lot! Slightly off topic but, where do I find all these little details on how to do things, ex. TTimer, is there information on it within like the includes or is all of those "little things" just learned from experience over time? (Yes TTimer was probably a horrible example but I couldn't think of anything else)

The best and most up-to-date tutorials for SRL-6 are by The Mayor. There are probably things that are left out of that due to space and time restrictions, but the most important stuff is definitely in there. I know when I first started learning to script (8 years ago wow) I printed off a copy of a script by one of the high-ranking members of the time. I looked through the code line-by-line and wrote comments on what that line of code should have done. Anything I didn't know what it did, I made a point to search on the forums for a thread about it.

If you're running dry on knowledge from the tutorials, then I would suggest doing the same sort of thing. The Mayor's scripts are all very well written and he's currently the go-to guy for SRL updates, so learning his style would be a good step if you're interested. I also find Ashaman's and Coh3n's scripts to be extremely well written, but don't be surprised if stuff is over your head. I still get the *woosh* feeling when I look through Coh3n's stuff, I've given up on figuring out some of the magic he weaves.

Clutch
03-14-2015, 05:13 PM
The best and most up-to-date tutorials for SRL-6 are by The Mayor. There are probably things that are left out of that due to space and time restrictions, but the most important stuff is definitely in there. I know when I first started learning to script (8 years ago wow) I printed off a copy of a script by one of the high-ranking members of the time. I looked through the code line-by-line and wrote comments on what that line of code should have done. Anything I didn't know what it did, I made a point to search on the forums for a thread about it.

If you're running dry on knowledge from the tutorials, then I would suggest doing the same sort of thing. The Mayor's scripts are all very well written and he's currently the go-to guy for SRL updates, so learning his style would be a good step if you're interested. I also find Ashaman's and Coh3n's scripts to be extremely well written, but don't be surprised if stuff is over your head. I still get the *woosh* feeling when I look through Coh3n's stuff, I've given up on figuring out some of the magic he weaves.

Thanks, sorry for not getting back so caught up with work, didn't even get to try the fixes suggested yet.