SRL Archive - OSR Help

need help with clicking ground items


dw171

2012-05-17 14:42:52

Ok so I'm trying to create a Swamp Toad collector script. So far all I have managed to do is have the script search for the colors and its supposed to click on them to pick up the toad. But after it picks up the first toad it will continue to search for the other ones (which it finds them all accurately) but never pick them up. I can paste the procedure I'm working on if that helps figure things out.

punkd

2012-05-17 14:49:11

Use repeat until (invfull)

dw171

2012-05-17 15:19:53

I'm thinking it might just be something wrong with my color selection so I'll mess with that and see if anything changes.

dw171

2012-05-17 16:04:40

Okay I used ACA to find colors and create a autocolorfunction, but now its searching randomly on the ground when it cant find a toad even though on ACA there is no red on the ground and I have 10+ colors selected. Any suggestions or other ways of finding the toads?

iBlank

2012-05-17 17:12:42

From: dw171
Okay I used ACA to find colors and create a autocolorfunction, but now its searching randomly on the ground when it cant find a toad even though on ACA there is no red on the ground and I have 10+ colors selected. Any suggestions or other ways of finding the toads?


How similar are the color of the toads to the ground and surrounding environment? If they aren't too similar then ACA should work just fine. Can you post your code? If you want to keep it private you can pm it to me and I can take a look if you would like.

J J

2012-05-17 17:14:27

If the toads are the only red dots popping up on ACA you actually have the right colors. If you can post your script here we can look at it and see what's wrong.

Another way of finding it is the MMtoMS function.
This is interesting to read: http://villavu.com/forum/showthread.php?t=73768

iBlank

2012-05-17 17:28:31

From: J J
If the toads are the only red dots popping up on ACA you actually have the right colors. If you can post your script here we can look at it and see what's wrong.

Another way of finding it is the MMtoMS function.
This is interesting to read: http://villavu.com/forum/showthread.php?t=73768


J J is right on with the MMtoMS but it can be a bit tricky to learn. That link he gave is helpful but took me a little time to read/learn it from there. Here is an example of how you could possibly use it in your script:


Function FindHidden(x, y: Integer): Boolean;
Var
I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
InvPoint: TPoint;

Begin
TPA := GetMMDotsOnMS('npc') /// If the toads show as yellow dot on minimap leave it as NPC, if they show as red then put it as 'item'.
ATPA := TPAToATPAEx(TPA, 15, 15);
MiddleTPAEx(ATPA[i], x, y);
InvPoint := MMToMSEx(0, -20, Point(x,y)); /// You could take this line out since the toads are on the ground. This changes the height of the point. More for NPCs up off the ground.
Begin
MMouse(InvPoint.x, InvPoint.y, 0, 0);
If(WaitUpTextMulti(['Clan','Vex','illum'],700)) Then Result:= True; /// Obviously put in the correct uptext!
End;
End;

That could be rewritten in a much more proper manner I am sure, but gives you a general idea I hope.

dw171

2012-05-17 17:34:40

Trying to work on walking right now, and with ACA its not detecting that the toads are similar to the ground, but when I run the script it searches the ground more than the toads. There's the script if it helps any,



program SwampToadCollector;

//{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}
//==============================================================================
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
LampSkill := Skill_MINING;
Active := True;
end;
end;
//==============================================================================
function ToadColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.21, 1.24);

if not (FindColorsTolerance(arP, 1466934, MSX1, MSY1, MSX2, MSY2, 10)) then
begin
//Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;
//==============================================================================
procedure PickUpToads;
Var
x, y, PlusOne: Integer;
begin
Repeat
PlusOne:= InvCount +1;
If FindObjCustom(x, y, ['Swamp', 'p toa', 'wam', 'oad'], [ToadColor], 0)Then
Mouse(x, y, 1, 1, True);
Flag;
Until (InvFull)
end;
//==============================================================================

begin

SetupSRL;
DeclarePLayers;
//Repeat
PickUpToads;
//Until(false);

end.

dw171

2012-05-17 18:13:44

Are there any updated RS surface maps for Gnome Stronghold because the one included in SPS will not work.