SRL Archive - OSR Help

Pokemon Fisher


Giant Panda

2012-09-13 07:40:35

Hey everyone,

I'm looking for a bit of help with a script I made for fishing in a pokemon game that runs out of java. I have a version that works 100% with wait timers but that means it's slow because I have had to allow for the slowest possibilities.

I'm trying to upgrade it so I'm using FindColorSpiralTolerance however for someone reason even though I can use the tool to find the colour once the script is running it just cant see what I'm looking for, unless I start it in the battle.

I'll quickly run you through the sequence

F2 casts the line - After this either nothing happens or the battle starts.
Battle starts - A bunch of red boxes appear and this is where I want simba to find them.
Battle - I press 'Z' twice, this is fine as it is.
Battle finishes - The battle window closes and I'm back to needing to fish. This can be done more easily with a wait timer as it's not random like casting a line and I one hit the wild pokemon.

I would like help trying to fix the part where it's finding the red boxes. The box that is selected by default is the colour '7175130' and the 3 other boxes are colour 5070016. They are found within the box x=262, y=454 x x=745, y=539

program Fish;

procedure Battle;

begin
Writeln('Battle');
wait(5000)
SendKeys('z', 100, 100); // Z Key
wait(1000)
SendKeys('z', 100, 100); // Z Key
wait(10000)
end;


procedure UseRod;

begin
wait(100)
Writeln('Fishing');
PressKey(113); // F2 Key
wait(100)
End;


procedure Fish;
var
x, y:Integer;


begin
wait(100)
FindColorSpiralTolerance(x, y, 14186568, 0, 0, 100, 100, 100)
Writeln('Colour');
if FindColorSpiralTolerance(x, y, 7175130, 262, 454, 745, 539, 20) Or
FindColorSpiralTolerance(x, y, 5070016, 262, 454, 745, 539, 20) Then
begin
Battle;
End Else UseRod;
end;


begin

wait(2000)

repeat

Fish;

until(false)

end.

Any ideas what I've done wrong/how to fix it?

Thanks,

Josh

Giant Panda

2012-09-13 19:09:30

Bump

Nebula

2012-09-13 19:12:20

While not (GetColor(x, y) = 7175130) do
Wait(100);

Try that. Put the coordinates as x and y. This does what it looks like- While the point isn't color 7175130, it waits.

Ian

2012-09-13 19:12:45

I like the idea of using simba for pokemon, but I don't have the game so I can't test. Also my scripting knowledge is not at the level where I can tell the problem by sight.

BraK

2012-09-13 19:15:51

Why not try using Waitfunc….

Giant Panda

2012-09-14 03:59:59

From: BraK
Why not try using Waitfunc….


I currently have a script that uses wait functions and it works perfectly. The problem is that It's random whether you get a pokemon when fishing or not. therefore I have to do a long wait incase I don't get one for a while. Often I catch one on the first time and ~10 seconds is wasted. Just trying to improve my script to make it better and learn a little more

Giant Panda

2012-09-14 04:02:49

From: Nebula
While not (GetColor(x, y) = 7175130) do
Wait(100);

Try that. Put the coordinates as x and y. This does what it looks like- While the point isn't color 7175130, it waits.


So could I do


begin
Writeln('Colour');
While not (GetColor(281, 467) = 7175130) do
UseRod;
Battle;
end;

Thanks for taking your time to help,

Josh

EDIT: I tried this and it still doesn't work. Perhaps it's an issue where simba can't find the colours properly?

Giant Panda

2012-09-14 17:38:43

Bump

BraK

2012-09-14 19:34:43

That's not a Waitfunc…

Waitfunc(Func:Function:Boolean; WaitPerLoop, MaxTime : Integer): Boolean; 

Giant Panda

2012-09-15 06:27:31

From: BraK
That's not a Waitfunc…

Waitfunc(Func:Function:Boolean; WaitPerLoop, MaxTime : Integer): Boolean; 


How will this make it quicker?

Surely it's just a condensed version of wait(####)?

BraK

2012-09-15 09:18:10

Say that you have a function to see if you caught something. this will repeat that check until a. Something is caught or be max time is reached.


CaughtSomthing:Boolean;

WaitFunc('CaughtSomething',500, 5000);


The waitfunc shown will check caught something every 500 milliseconds until 5000 milliseconds have passed or it has returned true.

Giant Panda

2012-09-17 12:24:00

From: BraK
Say that you have a function to see if you caught something. this will repeat that check until a. Something is caught or be max time is reached.


CaughtSomthing:Boolean;

WaitFunc('CaughtSomething',500, 5000);


The waitfunc shown will check caught something every 500 milliseconds until 5000 milliseconds have passed or it has returned true.


Aah i see, thank you very much. I'll definitely include this in my script!


Does anyone have any ideas about the colour finding problem? The software is all updated and I can find the colour using the the pippet tool thingy.

thanks,

Josh

bump

Bump

BraK

2012-09-17 15:43:26

Look up TPAs and Findcolors and use a Tolerance possibly with a countcolor to ensure that you are finding the correct object. Those will be the most help to you with object finding.