PDA

View Full Version : Randoms Development



Ashaman88
03-04-2013, 04:32 AM
To keep track of our status on the solvers. Edit this post with any changes needed and update for randoms I missed or added incorrectly (probably forgot quite a few, tried to grab most of wiki). We should also probably organize this post into type of random (chat one, combat one, telly one, etc). I'll leave that to someone who wants to edit :)




Random Event
Solver
Detection
Working on it


Mime
Not Started
Complete - Justin
Nobody


Mordaut
Complete - DannyRS
Complete - Ashaman88
Complete - DannyRS


Molly
Not Started
Complete - Unsure
Nobody


Maze
Not Started
Not Started
Nobody


Drunken Dwarf
Complete - Ashaman88
Complete - Ashaman88
Nobody


Drill Demon
Complete - DannyRS
Complete - DannyRS
Complete - DannyRS


Freaky Forrester
Not Started
Complete - slushpuppy
Nobody


Frog
Not Started
Complete - Ashaman88
Nobody


Frog (Cave)
Complete - Justin/Xrapsp
Complete - Justin
Complete - Justin/Xrapsp


Prison Pete
Not Started
Complete - Justin/DannyRS
Nobody


Cap'n Arrav Chest
Not Started
Not Started
Nobody


Quiz Master
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Sandwich Lady
Complete - DannyRS
Complete - Ashaman88
Complete - DannyRS


Evil Bob
Complete - Justin
Complete - Justin
Complete - Justin


Beekeeper
Not Started
Not Started
Nobody


Pinball
Complete - slushpuppy
Complete - Justin
Complete - slushpuppy


Grave Digger
Not Started
Not Started
Nobody


Pillory Cage
Complete - DannyRS
Complete - DannyRS
Complete - DannyRS


Exploding Rock
Not Started
Not Started
Nobody


Poison Gas
Not Started
Not Started
Nobody


Whirlpool
Not Started
Not Started
Nobody


Big Fish
Not Started
Not Started
Nobody


Ent
Not Started
Not Started
Nobody


Strange Box
Not Started
Complete - Ashaman88
Nobody


Watchman
Not Started
Complete - Ashaman88
Nobody


Zombie
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Evil Chicken
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Shade
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Rock Golem
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


River Troll
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Tree Spirit
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Swarm
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Strange Plant
Not Started
Not Started
Nobody


Rick Turpentine
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Security Guard
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Genie
Complete - Ashaman88
Complete - Ashaman88
Complete - Ashaman88


Lost Pirate
Not Started
Complete - Ashaman88
Nobody


Hyde
Complete - Ashaman88 (add dropping pots?)
Complete - Ashaman88
Complete - Ashaman88


Lost & Found (Abyss)
Not Started
Testing Needed

Justin
03-04-2013, 04:43 AM
I had Maze detection working, When using FindNormalRandoms() it would return false but when using Maze_Detect() (Or whatever the detection function is) it would return true

Olly
03-04-2013, 05:28 AM
I would love to tackle these (although at the moment SRL6 is a priority), Also take a look at the old scar includes im sure alot them still work fine :p

off topic, 6am here i will post the uptext ocr stuff tomorrow.

Hobbit
03-04-2013, 06:07 AM
Also take a look at the old scar includes im sure alot them still work fine :p


This would probably be the best approach. Dig out the old randoms and test them one by one. Get them all detecting then work on solving.
How long do you think it will take to get at least 90% of detections working? (33/36)

Flight
03-04-2013, 06:29 AM
Does anyone have a link to that old revision of SRL with the random solvers?

Le Jingle
03-04-2013, 06:31 AM
Flight;
I think Kave posted one, not sure if it's the one you're looking for or not though.
http://villavu.com/forum/showthread.php?t=34856%22

Hobbit
03-04-2013, 06:50 AM
Flight;
I think Kave posted one, not sure if it's the one you're looking for or not though.
http://villavu.com/forum/showthread.php?t=34856%22

Hey look, it's me! :p
Also, note that the posting date of all the SRL Rev4.x archive threads is not the date it was released. Im not sure exactly on the dates apart from before Sept 2, 2008.


Edited OP to put info into a table to make more readable and easier to update :)

Le Jingle
03-04-2013, 07:25 AM
Hey look, it's me! :p
Also, note that the posting date of all the SRL Rev4.x archive threads is not the date it was released. Im not sure exactly on the dates apart from before Sept 2, 2008.


Edited OP to put info into a table to make more readable and easier to update :)

Ah, yes, sorry, Kave linked to you, Hobbit, indeed! :p
Thanks for the table too, quicker reference with it!

YoHoJo
03-04-2013, 07:49 AM
Do randoms still work in the way such that you can get into one, log out, and then log back in to solve it?
So will developers need users' accounts which are stuck in random events to help solve them?

DannyRS
03-04-2013, 11:01 AM
Guess as we bot, we try to get randoms and solve them as we go :p

Could take a while to reach 100% with the luck involved, I seem to never get any "kidnap" randoms these days

Ashaman88
03-04-2013, 12:38 PM
Pretty table :)

Once we all take a look at the old solvers I think we will get a better idea of how long detection would take. And for a lot of them the solving should be pretty easy (Like for those attacking you just run away a little bit then run back)

DannyRS
03-04-2013, 01:05 PM
Pretty table :)

Once we all take a look at the old solvers I think we will get a better idea of how long detection would take. And for a lot of them the solving should be pretty easy (Like for those attacking you just run away a little bit then run back)

Only the swarm and strange plant attack you regardless of if you talk to them right? the rest you talk too and they go away, so the findname thing would do for alot of the randoms?

the real problem is detecting when for example evil bob or the old man get their hands on you lol, is there a way you's can think without using SPS or something to check if your inside one of those places? as far as I can remember the chat message goes away if you click after being grabbed, so if you got grabbed mid-walking in a script, you can't get chat message to check for them, unless all scripters are more careful in clicking, DTM simular problem,

maybe I'm over thinking it, we need to have a good look how it was done before :p

YoHoJo
03-04-2013, 01:10 PM
Only the swarm and strange plant attack you regardless of if you talk to them right? the rest you talk too and they go away, so the findname thing would do for alot of the randoms?

the real problem is detecting when for example evil bob or the old man get their hands on you lol, is there a way you's can think without using SPS or something to check if your inside one of those places?

I think we used to check for the lack of certain gametabs or we would check the music tab to see what song was playing in order to detect many randoms :). We can also use like MM Black Percent to help see if something is wrong.

The tabs/black percent don't tell exactly which random, but help know that something is up.

DannyRS
03-04-2013, 01:20 PM
I think we used to check for the lack of certain gametabs or we would check the music tab to see what song was playing in order to detect many randoms :). We can also use like MM Black Percent to help see if something is wrong.

The tabs/black percent don't tell exactly which random, but help know that something is up.

Ah I never thought about that! the music would be a really easy way!

theres several kidnap randoms that don't remove your 1-7 gametabs if I remember tho :/

and tabbing for music every call wouldn't be too great, so maybe some failsafe in a script if you can't find something for so long, another check checks your music tab with GetMusic,

from which ones I can remember, prison pete doesn't remove your gametabs for example

Hobbit
03-04-2013, 02:37 PM
Only the swarm and strange plant attack you regardless of if you talk to them right? the rest you talk too and they go away, so the findname thing would do for alot of the randoms?


Swarm, Strange Plant, Ent, Evil Chicken, River Troll, Big Fish, Rock Golem
I think all of those attack you regardless (If I remember correctly)

Ashaman88
03-04-2013, 02:44 PM
Swarm, Strange Plant, Ent, Evil Chicken, River Troll, Big Fish, Rock Golem
I think all of those attack you regardless (If I remember correctly)

Yeah so for those we just need to run away and run back - Have it be a random direction. Only thing that might be bad is if the direction it chooses is a direction you can't run to (like wall or ocean there). Maybe have a user option to determine which directions it can run?

Olly
03-04-2013, 04:01 PM
Yeah so for those we just need to run away and run back - Have it be a random direction. Only thing that might be bad is if the direction it chooses is a direction you can't run to (like wall or ocean there). Maybe have a user option to determine which directions it can run?

Not to hard to filter out non walk able places (red is non walk able points).
http://i.imgur.com/QuU1wpM.png


code(took like 1 min, should give a rough idea though :p)
program new;

var
mmBox: tbox;

function tpaFromMinimap: TPointArray;
var
BMP_MM: integer;
KMTarget, ITarget, W, H, t: Integer;
begin
KMTarget := GetKeyMouseTarget;
ITarget := GetImageTarget;

BMP_MM := BitmapFromString(147, 153, 'meJztlUF2wjAQxbj/pemORUsD' +
'dgiyEunpAOOvhW+3iBW4bxog22n2GEdwXK8KHsE3e1VwP2yvC o6CB' +
'6rgEHiOCo6C71++UfDNyzcBPnXtRsEXLt8o+KrlGwVfsnwT4A PWbg' +
'J8Olwd+GJLaQEfakHXB59oWVcGH2dxFwTfROQ64FPoXAF8BKl V81o' +
'1r1XzWjWvhZNaNa9V81o1r1XzWjipVfNaNa9V81o4qVXzWjip VfNa' +
'OKlV81o1r4WTWjWvhZNaNa+Fk1o4qVXzWjiphZNaNa+Fk1o4q YWTW' +
'jWvhZNaOKlVk1o4qYUz2gcntXBSCye1cFILJ7VwUgsntXBSCy e1cF' +
'ILJ7VwUgsn9VY7obfCOS2c1MJJLZzUwkktnNS/4CflS5+CX5UvLZz' +
'UwkktnNTCSS2c1P/AD8sNN8Bvyw0LJ3Ub/Lx86kvwC/OphZP6DviR' +
'+cs3we/MXxZO6vvgp+bDIfBr8+Eo+MF5H69WuEWcAz/74k6DX35x9' +
'4Aff1n3gz/hgn4K/CGX8oPgb7mUnwV/zkU8AvxRp/c48Ked2C+Av/' +
'FkfhP8safx++BPPoEg+NulrgA+gs7VwAdZ3MXB91lQC/hQS6kDXwz' +
'XCz5d1faAb1iyafAxq7YHfNWS7QFfuGTT4FNXbQ/45iWbBh+/anvA' +
'K5RsGjxH1abBo1RtGjxN1abBA1VtGjxT1abBY1VtGjxZ1aapm peqe' +
'amalMJJKZyXqkkpnJTCeamal6qpKZmXqkkpnJqSeanaaShWLM 0P+b' +
'5EFg==');

setTargetBitmap(BMP_MM);
getBitmapSize(BMP_MM, W, H);

findcolors(result, 255, 1, 1, w-1, h-1);
offsettpa(result, point(569, 8));

t := GetImageTarget;
SetKeyMouseTarget(KMTarget);
SetImageTarget(ITarget);
FreeTarget(t);

try
FreeBitmap(bmp_mm);
except
writeln('**** tpaFromMinimap: Unable to free bitmap!')
end;
end;


procedure filterpointsMM(var tpa: tpointarray);
var
tpa2: tpointarray;
mmtpa: tpointarray;
mmbtpa: tpointarray;
begin
returnpointsnotintpawrap(tpaFromMinimap, mmbox, tpa2);
cleartpafromtpawrap(tpa, tpa2, tpa);

end;

function getBlackBackground: Integer;
var
CTS, I, H, C, Count, MaxC: Integer;
TPA: TPointArray;
Cols: TIntegerArray;
begin
Result := -1;
CTS := GetToleranceSpeed;

setColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(100, 100);
FindColorsTolerance(TPA, clBlack, mmbox.X1, mmbox.Y1, mmbox.X2, mmbox.Y2, 3);
SetToleranceSpeed2Modifiers(0.2, 0.2);
setColorToleranceSpeed(CTS);
if (Length(TPA) < 1) then Exit;

Cols := GetColors(TPA);
ClearSameIntegers(Cols);

H := High(Cols);
for I := 0 to H do
begin
C := Cols[I];
Count := CountColor(C, mmbox.X1, mmbox.Y1, mmbox.X2, mmbox.Y2);
if (CountColor(C, mmbox.X1, mmbox.Y1, mmbox.X2, mmbox.Y2) > MaxC) then
begin
Result := C;
MaxC := Count;
end;
end;

end;

function removeNonWalkablePoints: tpointarray;
var
data: t2dintegerarray;
atpa: t2dpointarray;
i: integer;
tpa: tpointarray;
bmp: integer;
begin
data := [TIntegerArray([getBlackBackground, 0]), TIntegerArray([12227199, 40])];
setlength(atpa, length(data));

for i := 0 to high(data) do
findColorsTolerance(atpa[i], data[i][0], mmbox.X1, mmbox.Y1, mmbox.X2, mmbox.Y2, data[i][1]);

mergeatpawrap(atpa, tpa);
filterpointsmm(tpa);

bmp := bitmapfromclient(1, 1, 763, 502);
drawtpabitmap(bmp, tpa, clRed);
drawbitmapdebugimg(bmp);
displaydebugimgwindow(766, 503);
end;

begin
mmBox := intToBox(568, 8, 715, 160);
removeNonWalkablePoints
end.

YoHoJo
03-04-2013, 04:09 PM
^How does that work? What's the bitmap of? Are you sure that will work anywhere?

Anyways, I think back in the day (slash new idea in my head?)similar to how we havea parameter for lampskill, we can have one for rundirection (I know for sure old scripts had that) which can be set by either the scritper or the user.

Olly
03-04-2013, 04:12 PM
^How does that work? What's the bitmap of? Are you sure that will work anywhere?

Anyways, I think back in the day (slash new idea in my head?)similar to how we havea parameter for lampskill, we can have one for rundirection (I know for sure old scripts had that) which can be set by either the scritper or the user.

the bitmap is the minimap, the minimap in 2007 is so weird you cant just use a circle. :p

YoHoJo
03-04-2013, 04:16 PM
What I meant to ask is, how are you detecting what is and int walk-able.

Olly
03-04-2013, 04:23 PM
What I meant to ask is, how are you detecting what is and int walk-able.

I'm looking for water colour + black space on the minimap


// black background col, tolerance, water color, tolerance.
data := [TIntegerArray([getBlackBackground, 0]), TIntegerArray([12227199, 40])];

Hobbit
03-04-2013, 05:14 PM
Maybe detect the color or house floors also as non-walkable areas because if the door is open it go in there and be cornered. (If the door is shut RS will auto-shift the flag outside, so either way houses should be non walkable for safety)

Le Jingle
03-04-2013, 06:54 PM
Maybe detect the color or house floors also as non-walkable areas because if the door is open it go in there and be cornered. (If the door is shut RS will auto-shift the flag outside, so either way houses should be non walkable for safety)

Ah, I was thinking the same thing.

Is there any instance where an arrow will be stuck inside a house, or in a place you cannot walk to, making the flag in the MM useless?
Ex. What I take from what Hobbit said, this will just make the flag shift outside, but could there be a case where the flag gets stuck in the house/other MiniMap Object, where it cannot walk to? (curious atm, explanation later if this is even a pertinent question :p )

Olly
03-04-2013, 07:06 PM
if that was to happen fflag would timeout after like 15 seconds(or whatever the timeout is :p)

Hobbit
03-04-2013, 07:24 PM
Ah, I was thinking the same thing.

Is there any instance where an arrow will be stuck inside a house, or in a place you cannot walk to, making the flag in the MM useless?
Ex. What I take from what Hobbit said, this will just make the flag shift outside, but could there be a case where the flag gets stuck in the house/other MiniMap Object, where it cannot walk to? (curious atm, explanation later if this is even a pertinent question :p )

I've never encountered a case where the flag stays a play you cant walk to, RS has always moved it.
That being said, we should still avoid clicking places that cant be walked so we can keep better track of where we are to make it easier to get back after the random.

Olly
03-04-2013, 08:28 PM
I've never encountered a case where the flag stays a play you cant walk to, RS has always moved it.
That being said, we should still avoid clicking places that cant be walked so we can keep better track of where we are to make it easier to get back after the random.

That's not as easy as it sounds, there are so many variables that could happen.

Hobbit
03-04-2013, 08:34 PM
Yes, thats why we should filter out places like the house, one less variable to go wrong. I never said it would be easy, but eliminating houses and other non-walk areas would help keep track better.

Ashaman88
03-04-2013, 08:36 PM
That's not as easy as it sounds, there are so many variables that could happen.

I believe in you Olly!!

Hobbit
03-04-2013, 08:40 PM
For tracking the return route here is best I can think of. Im not sure how much SPS has changed since its original release so this may not even work.

During the find normal randoms check, update current tile from SPS
If in fight run away (random direction) to walkable area
Check if still under attack (Repeat above step)
When no longer attack, walk back to previous location via SPS

Ashaman88
03-04-2013, 08:47 PM
For tracking the return route here is best I can think of. Im not sure how much SPS has changed since its original release so this may not even work.

During the find normal randoms check, update current tile from SPS
If in fight run away (random direction) to walkable area
Check if still under attack (Repeat above step)
When no longer attack, walk back to previous location via SPS

That would require everyone to load their sps areas for every script, and thus we would have to build a world map for osr which would take a ton of time. We could do something with DDTM's maybe? Or just a move away randomrange x and y pixels, then move the same amount of pixels +/- a few pixels in the opposite direction? So you would end up in roughly the same spot

Olly
03-04-2013, 08:49 PM
Hobbit

SPS is a big no no, i don't really want to go though every reason lol :p

DannyRS
03-04-2013, 08:56 PM
Hobbit

SPS is a big no no, i don't really want to go though every reason lol :p

^^^

Ashaman88
03-04-2013, 10:54 PM
Danny got me thinking, maybe we should make a topic requesting screenshots and/or accounts with randoms to speed up development? Or maybe hold off until we get a better grasp on how we want to tackle them?

Le Jingle
03-04-2013, 11:37 PM
Danny got me thinking, maybe we should make a topic requesting screenshots and/or accounts with randoms to speed up development? Or maybe hold off until we get a better grasp on how we want to tackle them?

I remember a couple people still having Dev's need Random Accounts, etc. in their signatures (assuming for the sole purpose of what you just said).

Screenshots only go so far, and I indeed like the idea of lending random dev's accounts, however I'm not blind to the issue of account 'lending'/etc. To be fair for the issue, I think it would be heavily enforced/stated to have account lenders for dev's remove all items worth value from the account, etc. I would like to utilize the idea, but again, there's some liability if the lending isn't taken carefully.

(sorry for stating what might have been the blatantly obvious, but the last thing I'd want for anyone here or myself is any trouble of any type)

-Lj

DannyRS
03-04-2013, 11:52 PM
I remember a couple people still having Dev's need Random Accounts, etc. in their signatures (assuming for the sole purpose of what you just said).

Screenshots only go so far, and I indeed like the idea of lending random dev's accounts, however I'm not blind to the issue of account 'lending'/etc. To be fair for the issue, I think it would be heavily enforced/stated to have account lenders for dev's remove all items worth value from the account, etc. I would like to utilize the idea, but again, there's some liability if the lending isn't taken carefully.

(sorry for stating what might have been the blatantly obvious, but the last thing I'd want for anyone here or myself is any trouble of any type)

-Lj

Yea, but we could state the risk I suppose, theres also the number 1. Reason I avoid acc lending, even if people want you to make scripts with their acc, you could be a different country (I have VPN access but you can never be sure what Jagex look at, they could notice public IPs or something) and the account lock / email reset could trigger a mod review, or even get the account watched for botting, which is not going to be good for just as obvious reasons lol,

So it would be viable and great on low wealth (eveyone on OSR is anyway) characters that have no maingame main attached, and are not *precious* to the owner,

It would help speed up development of solvers 10 fold for sure, but is it worth the risks :/ whats your opinion Hobbit?

Screenshot thread would be a great Idea though, every little helps ;)

Justin
03-05-2013, 12:03 AM
Danny got me thinking, maybe we should make a topic requesting screenshots and/or accounts with randoms to speed up development? Or maybe hold off until we get a better grasp on how we want to tackle them?

Well starting tonight, I'll be running 5 accounts power-mining Tin ore trying to get random events, I'll make the script take screenshots every-time yellow text has been detected and also when srl_infight (has it been updated?)

Hope this will speed it up.

Justin

Ashaman88
03-05-2013, 12:15 AM
Well starting tonight, I'll be running 5 accounts power-mining Tin ore trying to get random events, I'll make the script take screenshots every-time yellow text has been detected and also when srl_infight (has it been updated?)

Hope this will speed it up.

Justin

If it hasn't been updated, it should be - would be key

Example of run away:

Procedure Test;
Begin
Writeln('Found fight running away!');
SetRun(True);
MMouse(MMCX-50 + RandomRange(-3,3),MMCY + RandomRange(-3,3),0,0);
ClickMouse2(True);
Wait(1000);
While IsMoving Do
Wait(200);
MMouse(MMCX + RandomRange(-3,3),MMCY-50 + RandomRange(-3,3),0,0);
ClickMouse2(True);
Wait(1000);
While IsMoving Do
Wait(200);

Wait(RandomRange(4000,5000));

MMouse(MMCX + RandomRange(-3,3),MMCY+50 + RandomRange(-3,3),0,0);
ClickMouse2(True);
Wait(1000);
While IsMoving Do
Wait(200);

MMouse(MMCX+50 + RandomRange(-3,3),MMCY + RandomRange(-3,3),0,0);
ClickMouse2(True);
Wait(1000);
While IsMoving Do
Wait(200);
End;

basic I know but something like this?


Edit2:

Took a bunch of pics of mystery box, shouldn't be too hard to solve!

Ashaman88
03-05-2013, 03:50 AM
Actually guys that test function worked like a charm! Made a tiny edit to srl_infight and just added this to my loops

If SRL_InFight Then
Test;

Ran away and back like a charm

Edit: But what if you are training combat, how would that work?

Olly
03-05-2013, 04:22 AM
You guys don't notice this has already been done :p and has for combat etc its hard, you cant account for everything.

(*
RunAway
~~~~~~~

.. code-block:: pascal

procedure RunAway(dir: string; RunFar: Boolean; Action, WaitTime: Integer);

- Runs away in minimap related direction, based on north.
- Dir can be 'N', 'E', 'S', 'W' or an angle in degrees (145, 93, 180, etc).
- RunFar will run further than normal.
- Action can be either 1, 2 or 3:

1. RunAway + Wait(WaitTime) + RunBack
2. RunAway + Wait(WaitTime)
3. RunBack

.. note::
WaitTime is in milliseconds!

.. note::

by nielsie95 modified by ZephyrsFury

Example:

.. code-block:: pascal

if (FindFight()) then
begin
WriteLn('We are in a fight!');
RunAway('n', True, 1, 2000);
end;

*)

// TODO: Implement constants!
procedure RunAway(dir: variant; RunFar: Boolean; Action, WaitTime: Integer);
var
Rad, T: Integer;
Deg: extended;
begin
if (not LoggedIn) then exit;

if RunFar then
Rad := 63
else
Rad := 30;
Deg := variantToDirection(dir);

if (Action < 3) then
begin
SetRun(True);
MFNF(Trunc(Rad * Sin(Radians(FixD(Rs_GetCompassAngleDegrees + Deg))) + MMCX + Random(5)),
Trunc(-Rad * Cos(Radians(FixD(Rs_GetCompassAngleDegrees + Deg))) + MMCY + Random(5)), 1, 1);
FFlag(0);
Wait(500 + Random(1500));
t := GetSystemTime;
while ((GetSystemTime - t) < WaitTime) and (LoggedIn) do
if (Random(5) = 0) then
IdleTime(2000, 500, 1.0)
else
Wait((WaitTime - (GetSystemTime - t)) div 5);
end;

if (Action = 1) or (Action = 3) then
begin
MFNF(Trunc(Rad * Sin(Radians(FixD(Rs_GetCompassAngleDegrees + (Deg + 180)))) + MMCX - Random(5)),
Trunc(-Rad * Cos(Radians(FixD(Rs_GetCompassAngleDegrees + (Deg + 180)))) + MMCY - Random(5)), 1, 1);
FFlag(0);
Wait(500 + Random(1500));
end;

SetRun(False);
end;

Justin
03-05-2013, 06:24 AM
http://puu.sh/2cody
If you need a grid for the Lamp skills :)
I'd do it myself but I am horrible at maths

Ashaman88
03-05-2013, 11:56 AM
Good call Olly haha very nice.


If nobody starts on the lamp solver, I'll do it tonight - thanks Justin

Justin
03-05-2013, 12:16 PM
Seems like Jagex have stopped trial accounts, I'm unable to farm randoms :(

Olly
03-05-2013, 03:04 PM
As for the randoms where we need to runaway apart from having a general function like (runaway) and we need to make use of the SRL_Proc system we have for if the scripter wants to do a custom action, something like this:

procedure weneedtorunaway;
begin
writeln('ah balls, something is attacking us... run!');

if SRL_HasProc(SRL_runAway) then
SRL_Procs[SRL_runAway]()
else
runAway(blah blah blah);

end;

procedure customRunAway;
begin
sps_blindwalk(p);
wait(forhowlong);

writeln('we can now walk back.');
sps_blindwalk(p);
end;

SRL_Procs[SRL_runAway] := @customRunAway;

Ashaman88
03-05-2013, 03:15 PM
As for the randoms where we need to runaway apart from having a general function like (runaway) and we need to make use of the SRL_Proc system we have for if the scripter wants to do a custom action, something like this:

procedure weneedtorunaway;
begin
writeln('ah balls, something is attacking us... run!');

if SRL_HasProc(SRL_runAway) then
SRL_Procs[SRL_runAway]()
else
runAway(blah blah blah);

end;

procedure customRunAway;
begin
sps_blindwalk(p);
wait(forhowlong);

writeln('we can now walk back.');
sps_blindwalk(p);
end;

SRL_Procs[SRL_runAway] := @customRunAway;


Yes that would be ideal. Also not sure if runaway already has this, but we putting an option for the script writer to determine which directions runaway should run in. Like only 'N' etc etc

DannyRS
03-06-2013, 05:49 PM
Got a few screenshot collections of some while woodcutting,

Mordaut does not mess around :/ - let me know if you want those screens now, I'll upload all I got later :p

Working on Sandwich lady because I want to start with a relatively easy one myself ;)

Ashaman88
03-06-2013, 06:57 PM
Got a few screenshot collections of some while woodcutting,

Mordaut does not mess around :/ - let me know if you want those screens now, I'll upload all I got later :p

Working on Sandwich lady because I want to start with a relatively easy one myself ;)

I can send you some sandwich pics if you would like?

DannyRS
03-06-2013, 06:58 PM
I can send you some sandwich pics if you would like?

that would be great :)

J J
03-06-2013, 07:25 PM
http://puu.sh/2cody
If you need a grid for the Lamp skills :)
I'd do it myself but I am horrible at maths

(**
* Author: Coh3n, J J
* Description: Uses the lamp on the skill of choice
*)
function UseLamp: boolean;
var
Skill: Integer;
Slot: TPoint;
Box: TBox;

begin
//Skill := Players[currentPlayer].lampSkill;
Skill := SKILL_MAGIC;

case Skill of
SKILL_ATTACK : slot := Point(0, 0);
SKILL_STRENGTH : slot := Point(1, 0);
SKILL_RANGE : slot := Point(2, 0);
SKILL_MAGIC : slot := Point(3, 0);
SKILL_DEFENCE : slot := Point(4, 0);
SKILL_HITPOINTS, SKILL_HP : slot := Point(0, 1);
SKILL_PRAYER : slot := Point(1, 1);
SKILL_AGILITY : slot := Point(2, 1);
SKILL_HERBLORE : slot := Point(3, 1);
SKILL_THIEVING : slot := Point(4, 1);
SKILL_CRAFTING : slot := Point(5, 1);
SKILL_RUNECRAFTING : slot := Point(0, 2);
SKILL_SLAYER : slot := Point(1, 2);
SKILL_FARMING : slot := Point(2, 2);
SKILL_MINING : slot := Point(3, 2);
SKILL_SMITHING : slot := Point(4, 2);
SKILL_FISHING : slot := Point(5, 2);
SKILL_COOKING : slot := Point(0, 3);
SKILL_FIREMAKING : slot := Point(1, 3);
SKILL_WOODCUTTING : slot := Point(2, 3);
SKILL_FLETCHING : slot := Point(3, 3);
SKILL_CONSTRUCTION : slot := Point(4, 3);
SKILL_HUNTER : slot := Point(5, 3);
end;

{ INFO
8 pixels between each box horizontal
4 pixels between each box vertical

Row 0
189, 144 -> 213, 149
203, 134 -> 204, 158
Box: 24, 24

Row 1, 2, 3
-------------------
174, 182 -> 198, 179
187, 164 -> 189, 188
Box: 24, 24
}

if Slot.y > 0 then
Box := IntToBox(173 + Slot.x * 24 + Slot.x * 8,
164 + (Slot.y-1) * 24 + (Slot.y-1) * 4,
173 + Slot.x * 24 + Slot.x * 8 + 24,
164 + (Slot.y-1) * 24 + (Slot.y-1) * 4 + 24)
else
Box := IntToBox(189 + Slot.x * 24 + Slot.x * 8,
134 + Slot.y * 24 + Slot.y * 4,
189 + Slot.x * 24 + Slot.x * 8 + 24,
134 + Slot.y * 24 + Slot.y * 4 + 24);

writeln('Lamp box: ' + ToStr(Box));
end;

Le Jingle
03-06-2013, 09:25 PM
J J; nice work! I tried using grid box the other day and failed miserably. :'[

On that note, has anyone fixed up core/antirandoms/rewards.simba?
If not, I'd love to update it (granted J J's code helps carry the bulk of the rewards.simba file) :]

Ashaman88
03-06-2013, 09:28 PM
J J; nice work! I tried using grid box the other day and failed miserably. :'[

On that note, has anyone fixed up core/antirandoms/rewards.simba?
If not, I'd love to update it (granted J J's code helps carry the bulk of the rewards.simba file) :]

I haven't touched it. Check out the history on it @ git and if no changes - go for it

Ashaman88
03-07-2013, 02:39 AM
that would be great :)

See attached

Hobbit
03-07-2013, 03:11 AM
Here is a thought for detecting the maze random (Already shared this with Justin)

http://puu.sh/2dnaJ.png

So the maze random is probably the only place in runescape where there are a series of perfectly collinear orthogonal angles. Basically that is saying all of the corners line up in a straight line. I'd say shooting to find 3 collinear corners would be enough to prove it is maze. Also wouldn't matter of the camera rotation or which line of corners you go for. As you rotate the camera the corners to morph slightly however, all of the corners in the same series morph in the same way, so they will still be detected as the same shape/angle.

Thoughts?

Ashaman88
03-07-2013, 03:17 AM
Here is a thought for detecting the maze random (Already shared this with Justin)

http://puu.sh/2dnaJ.png

So the maze random is probably the only place in runescape where there are a series of perfectly collinear orthogonal angles. Basically that is saying all of the corners line up in a straight line. I'd say shooting to find 3 collinear corners would be enough to prove it is maze. Also wouldn't matter of the camera rotation or which line of corners you go for. As you rotate the camera the corners to morph slightly however, all of the corners in the same series morph in the same way, so they will still be detected as the same shape/angle.

Thoughts?

Sounds good to me, but how would you find that?

Hobbit
03-07-2013, 04:08 AM
Well, you could start from the centre of the minimap and choose the first corner you come across as the start point, call it A. From A, extend out along a side of the same square to A' (doesn't have to be the corner, could be anywhere along that line). Then extend from A to B (The next corner out). From B extend along the side of that square the same direction as A' to B'. From B extend to C and extend from C along the side in the same direction as A' and B' to C'. We now have 3 lines AA' BB' and CC' which all intersect the green line (For now, dont assume it is a straight line, assume it has two segments AB and BC). So by Euclid's 9th property, the traversal of a straight line is 180°. Thus looking at the intersection of BB' and the green line, the purple angle and the blue angle must add up to 180°, if they do, the green line is straight, thus the points A,B,C are collinear, if it is not 180°, then it is not a straight line and points A,B,C are not collinear. Further way to double check this is by the theorem of parallel lines which says that parallel lines intersecting the same line will intersect it in the same angle. This is saying that the blue angles must be equal and the purple angles must be equal.

http://puu.sh/2dpb1.png

J J
03-07-2013, 11:54 PM
Interesting post, but wouldn't a simple TPA for the red colors and gray colors work out just as wel?

Ashaman88
03-08-2013, 02:51 AM
Interesting post, but wouldn't a simple TPA for the red colors and gray colors work out just as wel?

Do you lose tabs when you go into the maze? If so then yeah it would probably be easier to check for missing tabs then check for red and gray colors

Justin
03-08-2013, 08:52 AM
http://puu.sh/2e2iT/b61dad51f4
http://puu.sh/2e2j1/79469bd5de
http://puu.sh/2e2ja/6667c3bbdb
http://puu.sh/2e2jo/5332298782

I guess for those 2 randoms, just detect if gametabs missing, map is black, check for song name?

Ashaman88
03-08-2013, 12:18 PM
Actually molly is missing one more tab. So count the number of missing tabs, if MM is black then etc

Hobbit
03-08-2013, 06:55 PM
Any updates? Anything where the detection still works?

Olly
03-08-2013, 07:02 PM
Im pretty sure srl4 detected every random perfectly, why dont we release that first and work on improving at a later date if needed.

Hobbit
03-08-2013, 07:12 PM
Can someone start testing the SRL 4 detection at least and verify please.

Hobbit
03-08-2013, 07:34 PM
Justin's idea to bring this back. I created a new thread for SRL-OSR. Please put this in your sigs :)


http://villavu.com/forum/images/ranks/developer.gifhttp://villavu.com/forum/images/ranks/randomdeveloper.pngDEVS NEED RANDOM ACCOUNTS! (http://villavu.com/forum/showthread.php?t=98207)http://villavu.com/forum/images/ranks/randomdeveloper.pnghttp://villavu.com/forum/images/ranks/developer.gif

Ashaman88
03-08-2013, 07:36 PM
I've only had a few randoms :/ and have taken pics of them all. Also I updated in the infight detection. This reminds me of an idea I had. So if the script is for combat, having it run away anytime it detects you are under attack wouldn't be smart. So what if we had FindNonCombatRandoms which only looked for randoms that don't attack you? Then just findnormalrandoms which searches for both? B/c with w/c I just had it run away anytime it detected we were in combat, but that would be dumb if you are training combat in the first place. Am I thinking straight?

Hobbit
03-08-2013, 07:39 PM
Might be more strainght forward to have one function with a param like "FindNormalRandoms('Combat');" and "FindNormalRandoms('Skill');" or a boolean or something.

Ashaman88
03-08-2013, 07:45 PM
Might be more strainght forward to have one function with a param like "FindNormalRandoms('Combat');" and "FindNormalRandoms('Skill');" or a boolean or something.

Oh yeah a boolean would be good, like the script writer would need to set findcombatrandoms to false during script setup (like usefindmod etc)

Justin
03-09-2013, 03:31 AM
Screenshot of: IP Log 1 Minutes and 16 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 37
[IN RANDOM] FROG_GREEN: 345
[IN RANDOM] FROG_RED: 73
[IN RANDOM] FROG_YELLOW: 14
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 2 Minutes and 1 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 35
[IN RANDOM] FROG_GREEN: 412
[IN RANDOM] FROG_RED: 71
[IN RANDOM] FROG_YELLOW: 17
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 2 Minutes and 45 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 42
[IN RANDOM] FROG_GREEN: 648
[IN RANDOM] FROG_RED: 73
[IN RANDOM] FROG_YELLOW: 10
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 3 Minutes and 29 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 39
[IN RANDOM] FROG_GREEN: 527
[IN RANDOM] FROG_RED: 229
[IN RANDOM] FROG_YELLOW: 62
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 4 Minutes and 14 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 37
[IN RANDOM] FROG_GREEN: 291
[IN RANDOM] FROG_RED: 96
[IN RANDOM] FROG_YELLOW: 20
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 4 Minutes and 59 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 42
[IN RANDOM] FROG_GREEN: 413
[IN RANDOM] FROG_RED: 132
[IN RANDOM] FROG_YELLOW: 9
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 5 Minutes and 16 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 37
[IN RANDOM] FROG_GREEN: 452
[IN RANDOM] FROG_RED: 143
[IN RANDOM] FROG_YELLOW: 25
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 6 Minutes and 0 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 38
[IN RANDOM] FROG_GREEN: 370
[IN RANDOM] FROG_RED: 135
[IN RANDOM] FROG_YELLOW: 26
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 6 Minutes and 44 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 39
[IN RANDOM] FROG_GREEN: 319
[IN RANDOM] FROG_RED: 176
[IN RANDOM] FROG_YELLOW: 41
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 7 Minutes and 30 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 38
[IN RANDOM] FROG_GREEN: 744
[IN RANDOM] FROG_RED: 182
[IN RANDOM] FROG_YELLOW: 47
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 8 Minutes and 15 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 37
[IN RANDOM] FROG_GREEN: 337
[IN RANDOM] FROG_RED: 142
[IN RANDOM] FROG_YELLOW: 33
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 9 Minutes and 0 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 44
[IN RANDOM] FROG_GREEN: 335
[IN RANDOM] FROG_RED: 80
[IN RANDOM] FROG_YELLOW: 22
World selected is full, sorry.
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 9 Minutes and 15 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 37
[IN RANDOM] FROG_GREEN: 348
[IN RANDOM] FROG_RED: 169
[IN RANDOM] FROG_YELLOW: 20
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 9 Minutes and 59 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 36
[IN RANDOM] FROG_GREEN: 439
[IN RANDOM] FROG_RED: 135
[IN RANDOM] FROG_YELLOW: 40
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 10 Minutes and 44 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 40
[IN RANDOM] FROG_GREEN: 458
[IN RANDOM] FROG_RED: 225
[IN RANDOM] FROG_YELLOW: 11
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 11 Minutes and 29 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 35
[IN RANDOM] FROG_GREEN: 269
[IN RANDOM] FROG_RED: 89
[IN RANDOM] FROG_YELLOW: 23
Welcome to Runescape.
[retracted]@Hotmail.Com
Screenshot of: IP Log 12 Minutes and 13 Seconds
[RANDOM_DETECTION] Frog detection: True
[IN RANDOM] PercentBlackMM: 39
[IN RANDOM] FROG_GREEN: 373
[IN RANDOM] FROG_RED: 262
[IN RANDOM] FROG_YELLOW: 30


Sending pull request. Failed frog detection: Detected and working.

slushpuppy
03-09-2013, 12:34 PM
http://i.imgur.com/t6DqeWX.png

Justin
03-09-2013, 01:44 PM
(**
* Author: Coh3n, J J
* Description: Uses the lamp on the skill of choice
*)
function UseLamp: boolean;
var
Skill: Integer;
Slot: TPoint;
Box: TBox;

begin
//Skill := Players[currentPlayer].lampSkill;
Skill := SKILL_MAGIC;

case Skill of
SKILL_ATTACK : slot := Point(0, 0);
SKILL_STRENGTH : slot := Point(1, 0);
SKILL_RANGE : slot := Point(2, 0);
SKILL_MAGIC : slot := Point(3, 0);
SKILL_DEFENCE : slot := Point(4, 0);
SKILL_HITPOINTS, SKILL_HP : slot := Point(0, 1);
SKILL_PRAYER : slot := Point(1, 1);
SKILL_AGILITY : slot := Point(2, 1);
SKILL_HERBLORE : slot := Point(3, 1);
SKILL_THIEVING : slot := Point(4, 1);
SKILL_CRAFTING : slot := Point(5, 1);
SKILL_RUNECRAFTING : slot := Point(0, 2);
SKILL_SLAYER : slot := Point(1, 2);
SKILL_FARMING : slot := Point(2, 2);
SKILL_MINING : slot := Point(3, 2);
SKILL_SMITHING : slot := Point(4, 2);
SKILL_FISHING : slot := Point(5, 2);
SKILL_COOKING : slot := Point(0, 3);
SKILL_FIREMAKING : slot := Point(1, 3);
SKILL_WOODCUTTING : slot := Point(2, 3);
SKILL_FLETCHING : slot := Point(3, 3);
SKILL_CONSTRUCTION : slot := Point(4, 3);
SKILL_HUNTER : slot := Point(5, 3);
end;

{ INFO
8 pixels between each box horizontal
4 pixels between each box vertical

Row 0
189, 144 -> 213, 149
203, 134 -> 204, 158
Box: 24, 24

Row 1, 2, 3
-------------------
174, 182 -> 198, 179
187, 164 -> 189, 188
Box: 24, 24
}

if Slot.y > 0 then
Box := IntToBox(173 + Slot.x * 24 + Slot.x * 8,
164 + (Slot.y-1) * 24 + (Slot.y-1) * 4,
173 + Slot.x * 24 + Slot.x * 8 + 24,
164 + (Slot.y-1) * 24 + (Slot.y-1) * 4 + 24)
else
Box := IntToBox(189 + Slot.x * 24 + Slot.x * 8,
134 + Slot.y * 24 + Slot.y * 4,
189 + Slot.x * 24 + Slot.x * 8 + 24,
134 + Slot.y * 24 + Slot.y * 4 + 24);

writeln('Lamp box: ' + ToStr(Box));
end;

Missed this post. Have made a pull request.

J J
03-09-2013, 02:10 PM
Missed this post. Have made a pull request.
Okay but it doesn't actually click submit yet as I couldn't test it on RS yet. But the boxes should be fine!

Can you give me the code of your sig? :)

Justin
03-09-2013, 02:17 PM
Okay but it doesn't actually click submit yet as I couldn't test it on RS yet. But the boxes should be fine!

Can you give me the code of your sig? :)

All good; Added that in :)




http://villavu.com/forum/images/ranks/developer.gifhttp://villavu.com/forum/images/ranks/randomdeveloper.pngDEVS NEED RANDOM ACCOUNTS! (http://villavu.com/forum/showthread.php?t=98207)http://villavu.com/forum/images/ranks/randomdeveloper.pnghttp://villavu.com/forum/images/ranks/developer.gif

Ashaman88
03-09-2013, 02:44 PM
Does anyone know if the findtalk (not sure of exact function name) that detects a players nickname being spoken on the MS still exists or if the one from SRL4 works? This is to handle all talking randoms. If not I will whip one up

Edit:

Found it. I'll take on solving and detecting all chat only randoms. I'm just gonna port the stuff over from srl4

Ashaman88
03-09-2013, 04:25 PM
I've got the findtalk working and can identify all the talking randoms. I still need to test out on all the ones that talk to you, but then we can start on solvers (the solver is just commented out right now)

VAR
NICKNAMEBMP: integer;

{************************************************* ******************************
procedure SetScreenName(ScreenName: String);
by: WT-Fakawi edited by Ashaman88
Description: Sets screenname for use with FindTalk and one Player.
************************************************** *****************************}

procedure SetScreenName(ScreenName: string);
begin
NickNameBMP := BitmapFromText(ScreenName, upchars07);
end;

{************************************************* ******************************
function SolveTalkingRandom(RawMenuText: String): Boolean;
By: Ashaman88
Description: Talking Random Handler. Called by FindTalkingRandom. (FindTalk)
************************************************** *****************************}

function SolveTalkingRandom(RawMenuText: string): Boolean;
var
IC, FI: Byte;
// A: Boolean;
begin
TakeScreen('Solving Talking Random - '+RawMenuText);
// Security Guard Handler
if (Pos('uard', RawMenuText) <> 0) or (Pos('ecur', RawMenuText) <> 0) then
begin
writeln('Found GUARD random');
for IC := 1 to 2 do
begin
Wait(1000 + Random(500));
ClickToContinue;
Wait(50 + Random(50));
end;
Result := True;
Exit;
end;

// Freaky Forrester Handler.

if (Pos('reak', RawMenuText) <> 0) or (Pos('orest', RawMenuText) <> 0) then
begin
writeln('Found FORRESTER random');
CloseWindow;
Logout;
Result := False;
Exit;
end;

// Sandwich Lady Handler.

if (Pos('ady', RawMenuText) <> 0) or (Pos('ich', RawMenuText) <> 0) then
begin
writeln('Found SANDWICH random');
//if (not (UseSandwichSolver)) then
begin
CloseWindow;
Logout;
Result := False;
Exit;
end;

ClickToContinue;
Wait(500 + Random(500));
// SetupSandWich;
// if SolveSandWich then
begin
Result := True;
CloseWindow;
Exit;
end
// else
begin
CloseWindow;
Result := False;
Logout;
Exit;
end;
end;

// Genie Handler.

if (Pos('Geni', RawMenuText) <> 0) or (Pos('enie', RawMenuText) <> 0) then
begin
writeln('Found geni random');
Wait(1000 + Random(500));
//if SolveGenie(LampSkill) then
begin
Exit;
end
//else
begin
Exit;
end;
end;

// Certer Handler

if (Pos('ile', RawMenuText) <> 0) or (Pos('iles', RawMenuText) <> 0) then
begin
writeln('Found certer random');
Wait(1000 + Random(500));
// ClickToContinue;

// if UseCerterSolver then
// A := SolveCerter
// else
// A := FindCerter;

// if A then
begin
Exit;
end
//else
begin
Logout;
Exit;
end;
end;

// Frog Handler

if (Pos('rog', RawMenuText) <> 0) or (Pos('Fro', RawMenuText) <> 0) then
begin
writeln('Found Frog random');
// if SolveFrog then
begin
Exit;
end
//else
begin
for FI := 0 to 3 do
ClickToContinue;
Wait(10000);
// if DetectFrogCave then if SolveFrogSwamp then
begin
// Frogs := Frogs + 1;
Exit;
end
// else
begin
// NOFrogs := NOFrogs + 1;
// WriteLn('Frogs Missed Twice');
Logout;
// SRLRandomsReport;
Exit;
end;
end
end;

// Rick Handler

if (Pos('ick', RawMenuText) <> 0) or (Pos('urpen', RawMenuText) <> 0) then
begin
writeln('Found RICK random');
Wait(1000 + Random(500));
ClickToContinue;
// Ricks := Ricks + 1;
//SRLRandomsReport;
Exit;
end;

// Dwarf Handler. (Might add: DwarfItem)

if (Pos('runk', RawMenuText) <> 0) or (Pos('warf', RawMenuText) <> 0) then
begin
writeln('Found DWARF random');
Wait(1000 + Random(500));
ClickToContinue;
//Dwarfs := Dwarfs + 1;
//SRLRandomsReport;
Exit;
end;

// Cap 'n Hand (ler).

if (Pos('Cap ', RawMenuText) <> 0) or (Pos('Hand', RawMenuText) <> 0) then
begin
writeln('Found CAP random');
Wait(1000 + Random(500));
ClickToContinue;
// Caps := Caps + 1;
//SRLRandomsReport;
Exit;
end;

// Mysterious Old Man Handler.

if (Pos('yste', RawMenuText) <> 0) or (Pos('rious', RawMenuText) <> 0) then
begin
writeln('Found OLD MAN random');
Wait(1000 + Random(500));
ClickToContinue;
// Oldmen := Oldmen + 1;
//SRLRandomsReport;
Exit;
end;

//Dr Jekyll Handler

if (Pos('eky', RawMenuText) <> 0) or (Pos('kyll', RawMenuText) <> 0) then
begin
writeln('Found JEKYLL random');
for IC := 1 to 4 do
begin
Wait(1000 + Random(500));
ClickToContinue;
end;
//Jekylls := Jekylls + 1;
end;
end;

{************************************************* ******************************
function ChooseOptionGetMenuText(RawMenuText: String; Texts: TStringArray; Action: fnct_ActionOptions): Boolean;
By: Ashaman88.
Description: Gets the option of which random we have
************************************************** *****************************}


function ChooseOptionGetMenuText(var RawMenuText: string; Texts: TStringArray; Action: fnct_ActionOptions): Boolean;
var
B: TBox;
i, H, x, R: Integer;
T: TPoint;
Options: array of TOptions;
begin
Result := False;
Options := GetChooseOptions();
if (Length(Options) < 1) then
Exit;
H := High(Options);
for i := 0 To H do
begin
if ArrInStr(Texts, Options[i].Str) then
begin
Result := True;
RawMenuText:= Options[i].Str;
B := Options[i].Bounds;
GetMousePos(T.x, T.y);
R:= Min(((B.X2 - B.X1) shr 1), 5); //Prevents x2 passed to MouseBoxEx being smaller than x1
case Action of
ClickLeft:
if PointInBox(T, B) then
ClickMouse2(true)
else
MouseBoxEx(B.x1 + R, B.Y1, B.x2 - R, B.Y1 + 5, R, mouse_Left);
Move:
if not PointInBox(T, B) then
MouseBoxEx(B.x1 + R, B.Y1, B.x2 - R, B.Y1 + 5, R, mouse_move);

Nothing:
begin
end;

else
srl_warn('ChooseOptionMultiEx', 'ClickRight not a valid click for RS menus!', warn_AllVersions);
end;
Exit;
end;
end;
B := Options[0].BigBox;//to mmouse away
if Action <> Nothing then
begin
x := Max(B.X1 - 52, 0);
if x = 0 then
x := B.X2+10;
MMouse(x, Max(B.Y1 - 50, 0), 40, B.Y2-B.Y1);
Wait(200 + Random(100));
end;
end;

{************************************************* ******************************
function FindTalk: Boolean;
by: Ashaman88
Description: Searches screen for NickName and handles ALL Talking Randoms
************************************************** *****************************}


const gTalkOldComputer = False;
const gTalkSaveBitmap = False;

var
gtalksBox, YelSkipBoxs: array of TBox;
gTalksCount: Integer;

function FindTalk: Boolean;
var
ax, ay, yCount, zCount, Count2, x1, y1, x2, y2, Count1, bmpScreen: Integer;
RawMenuText: string;
begin
Result := False;
if (GetArrayLength(Players) < 1) then Exit;

if FindColor(ax, ay, 65535, MSX1, MSY1, MSX2, MSY2) then
begin

SetArrayLength(gtalksBox, 0);
SetArrayLength(YelSkipBoxs, 0);

//while FindColor(ax, ay, 65535, MSX1, MSY1, MSX2, MSY2) do
begin

y1 := ay;
if ( ( ay + 5 ) > 334 ) then y2 := 334 else y2 := ay + 5;

x1 := ax; x2 := x1;
zCount := 0;

repeat
if FindColor(ax, ay, 65535, x2, y1 + 2, x2 + 3, y2 + 3) then
zCount := 0
else
zCount := zCount + 1;

if ( zCount = 4 ) then Break;
x2 := x2 + 3;
until ( x2 + 3 > 515 );

if ( x2 + 3 <= 515 ) then x2 := x2 - 12;

if (x2 - x1 >= length(Players[CurrentPlayer].Nick) * 4) then
begin

x1 := x1 - 8;
y1 := y1 - 8;
x2 := x2 + 8;
y2 := y2 + 8;

if ( x1 < 0 ) then x1 := 0;
if ( y1 < 0 ) then y1 := 0;
if ( x2 > 515 ) then x2 := 515;
if ( y2 > 334 ) then y2 := 334;

Count2 := Count2 + 1;
Count1 := Count1 + 1;
SetArrayLength(gtalksBox, Count2);
gtalksBox[Count2 - 1].x1 := x1;
gtalksBox[Count2 - 1].y1 := y1;
gtalksBox[Count2 - 1].x2 := x2;
gtalksBox[Count2 - 1].y2 := y2 + 6;

SetArrayLength(YelSkipBoxs, Count1);
YelSkipBoxs[Count1 - 1].x1 := x1;
YelSkipBoxs[Count1 - 1].y1 := y1;
YelSkipBoxs[Count1 - 1].x2 := x2;
YelSkipBoxs[Count1 - 1].y2 := y2;

end else
begin
y1 := y1 - 2;
y2 := y2 + 8;
x1 := x1 - 5;
x2 := x2 + 5;
if ( x1 < 0 ) then x1 := 0;
if ( y1 < 0 ) then y1 := 0;
if ( x2 > 515 ) then x2 := 515;
if ( y2 > 334 ) then y2 := 334;

Count1 := Count1 + 1;
SetArrayLength(YelSkipBoxs, Count1);
YelSkipBoxs[Count1 - 1].x1 := x1;
YelSkipBoxs[Count1 - 1].y1 := y1;
YelSkipBoxs[Count1 - 1].x2 := x2;
YelSkipBoxs[Count1 - 1].y2 := y2;
end;
end;

if ( GetArrayLength(gtalksBox) <> 0 ) then
begin
for yCount := 0 to GetArrayLength(gtalksBox) - 1 do
begin
if FindBitmapMaskTolerance(NickNameBMP, ax, ay, gtalksBox[yCount].x1, gtalksBox[yCount].y1, gtalksBox[yCount].x2, gtalksBox[yCount].y2, 0, 40) then
begin
WriteLn('Found NickName');
ax := (gtalksBox[yCount].x2 + gtalksBox[yCount].x1) shr 1;
ay := gtalksBox[yCount].y2 - 2;

if gTalkSaveBitmap then
begin
bmpScreen := BitmapFromString(515, 334, '');
CopyClientToBitmap(bmpScreen, 1, 1, 515, 334);

if ( gtalksBox[yCount].x1 = 0 ) then x1 := 1 else x1 := gtalksBox[yCount].x1;
if ( gtalksBox[yCount].y1 = 0 ) then y1 := 1 else y1 := gtalksBox[yCount].y1;

gTalksCount := gTalksCount + 1;
for Count1 := -1 to 1 do
for Count2 := -1 to 1 do
FastSetPixel(bmpScreen, Count1 + x1, Count2 + y1, 255);

if ( gtalksBox[yCount].x2 = 515 ) then x1 := 515 else x1 := gtalksBox[yCount].x2;
if ( gtalksBox[yCount].y2 = 334 ) then y1 := 334 else y1 := gtalksBox[yCount].y2;

for Count1 := -1 to 1 do
for Count2 := -1 to 1 do
FastSetPixel(bmpScreen, Count1 + x1, Count2 + y1, 255);

for Count1 := -1 to 1 do
for Count2 := -1 to 1 do
FastSetPixel(bmpScreen, Count1 + ax, Count2 + ay, 255);
SaveBitmap(bmpScreen, ScriptPath + 'FTalk' + IntToStr(gTalksCount) + '.bmp');
FreeBitmap(bmpScreen);
end;

MMouse(ax, ay, 0, 0);
Wait(100 + Random(50));
if WaitUpTextMulti(['Talk', 'lk-to', 'uard', 'ard'],RandomRange(300,400)) then
begin
Mouse(ax, ay, 0, 0, False);
Wait(300 + Random(100));


if (ChooseOptiongetMenuText(RawMenuText, ['Talk'], ClickLeft)) then
begin
WriteLn('******** FOUND TALKING RANDOM TEXT********: ' + RawMenuText);
Flag;
Wait(1000 + Random(500))
SolveTalkingRandom(RawMenuText);
Result := True;
Exit;
end;
end;
end;
end;
end;
end;
end;


You just need to put something in the declareplayers for the nick - for me i just put man88. Just call findtalk


Edit: I'll be updating these functions as I go

DannyRS
03-09-2013, 07:26 PM
Done sandwich lady solver, can someone check my logic and standards :p? and how are random solvers going to be called etc? so we can make them compatible with detection call


program SandwichTestScript;

{$I SRL-OSR/SRL.simba}

var
SandwichTimeOutTimer: integer;

function StopSandwichSearch: boolean;
begin
Result := False;
if (CountColor(39423, 490, 10, 513, 32) < 5) then
Result := True;
if (TimeFromMark(SandwichTimeOutTimer) > 35000) then
Result := True;
end;

procedure SandwichMessage(Message: string);
begin
WriteLn('[Sandwich Random] ' + Message);
end;

procedure SelectSandwich(SandwichNumber: integer);
var
SPoint: tpoint;
begin
SPoint := Point(-1,-1);
case SandwichNumber of
0: SPoint := Point(155, 120);
1: SPoint := Point(260, 122);
2: SPoint := Point(365, 132);
3: SPoint := Point(110, 210);
4: SPoint := Point(205, 219);
5: SPoint := Point(315, 213);
6: SPoint := Point(395, 217);
end;
if (SPoint.X < 0) then
begin
SandwichMessage('[ERROR] Invalid sandwich number');
Exit;
end;
if (StopSandwichSearch) then Exit;
MMouse(RandomRange(SPoint.X-4,SPoint.X+4),
RandomRange(SPoint.Y-4,SPoint.Y+4), 0, 0);
ClickMouse2(mouse_left);
end;

function GetSandwichName: string;
var
FoundString, SWName: string;
begin
Result := ''; SWName := '';
FoundString := Trim(GetTextAtExWrap(80, 270, 400, 303,
0, 3, 1, 2070783, 0, 'UpChars07'));
SWName := Trim(Between('Have a', 'for free', FoundString));
if (not (SWName='')) then
Result := SWName;
end;

function SandwichSearchBox(BoxNumber: integer): tbox;
begin
case BoxNumber of
0: Result := IntToBox(100,80,205,155);
1: Result := IntToBox(215,80,305,160);
2: Result := IntToBox(320,80,410,163);
3: Result := IntToBox(71,170,160,255);
4: Result := IntToBox(165,175,255,260);
5: Result := IntToBox(260,175,355,265);
6: Result := IntToBox(360,175,435,270);
end;
end;

function FindSandwichBoxNumber: integer;
var
tmpCTS, i, SColor, STol, MinSSize: integer;
SHM, SSM: extended;
SName: string;
SB: tbox;
SWTPA: tpointarray;
begin
Result := -1;
SName := GetSandwichName;
tmpCTS := GetColorToleranceSpeed;
if (SName='') then
begin
SandwichMessage('[ERROR] Unable to get sandwich name');
Exit;
end;
SandwichMessage('Sandwich Name: ' + SName);
case Lowercase(SName) of
'baguette' : begin
SColor:=2910074;
STol:=10;
SHM:=0.03;
SSM:=0.08;
MinSSize:=35;
end;
'chocolate bar' : begin
SColor:=2375783;
STol:=7;
SHM:=0.03;
SSM:=0.24;
MinSSize:=110;
end;
'kebab' : begin
SColor:=1276942;
STol:=3;
SHM:=0.08;
SSM:=0.59;
MinSSize:=25;
end;
'meat pie' : begin
SColor:=5395289;
STol:=24;
SHM:=0.10;
SSM:=0.08;
MinSSize:=150;
end;
'bread roll' : begin
SColor:=1280167;
STol:=9;
SHM:=0.01;
SSM:=0.24;
MinSSize:=110;
end;
'triangle sandwich': begin
SColor:=2276602;
STol:=2;
SHM:=0.05;
SSM:=0.81;
MinSSize:=25;
end;
'square sandwich' : begin
SColor:=5143435;
STol:=6;
SHM:=0.01;
SSM:=0.05;
MinSSize:=110;
end;
else
begin SandwichMessage('[ERROR] Invalid sandwich name found'); Exit; end;
end;
SandwichMessage('Scanning for sandwich');
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(SHM, SSM);
repeat
for i:=0 to 6 do
begin
SB := SandwichSearchBox(i);
FindColorsTolerance(SWTPA, SColor, SB.X1, SB.Y1, SB.X2, SB.Y2, STol);
if (Length(SWTPA) < MinSSize) then Continue;
Result := i;
Break;
end;
until (Result > -1) or (StopSandwichSearch);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
end;

procedure SolveSandwichLadyRandom;
begin
Wait(RandomRange(2500,3500));
MarkTime(SandwichTimeOutTimer);
if (StopSandwichSearch) then
begin
SandwichMessage('[ERROR] SandwichLady select screen not up');
Exit;
end;
SelectSandwich(FindSandwichBoxNumber);
end;

begin
SetupSRL;
SolveSandwichLadyRandom;
end.

Ashaman88
03-09-2013, 07:36 PM
Check the solvechatrandoms function as sandwich lady is a chat detection one I think

Hobbit
03-09-2013, 07:59 PM
Is anyone working on the Quiz Master? A user PM'd me account details with one stuck in quiz master. Ill forward you the info if you're working on it.

Ashaman88
03-09-2013, 08:58 PM
Updated the randoms list. Not sure if I should pull those functions into the git yet. And Danny, sandwich lady is handled with chat for detection. Check that function above for solvechatrandoms to see how it's handled

DannyRS
03-09-2013, 09:11 PM
Updated the randoms list. Not sure if I should pull those functions into the git yet. And Danny, sandwich lady is handled with chat for detection. Check that function above for solvechatrandoms to see how it's handled

Yea ty looked at it, modified to work with it and sent a pull, but she no longer Teleports you to her lair(lol), so she should be a FindTalk handled random? is FindTalk going to call solvechatrandoms?

Ashaman88
03-09-2013, 09:12 PM
Yea ty looked at it, sent a pull, but she no longer Teleports you to her lair, so she should be a FindTalk handled random? is FindTalk going to call solvechatrandoms?

findtalk as i have it up there already calls solvechatrandoms :)

check out the functions they are pretty cool

DannyRS
03-09-2013, 09:21 PM
findtalk as i have it up there already calls solvechatrandoms :)

check out the functions they are pretty cool

Ah yea amazing, GJ ;)

This should work with what I did, at least it should providing you clicked talk-to on the options already?:


if (Pos('ady', RawMenuText) <> 0) or (Pos('ich', RawMenuText) <> 0) then
begin
writeln('Found SANDWICH random');
if (not (SL_Solve)) then
begin
CloseWindow;
Logout;
Result := False;
Exit;
end;
end;

Hobbit
03-09-2013, 09:29 PM
Ashaman88; Do you need an account for quiz master random for testing or do we not need it anymore?

Ashaman88
03-09-2013, 09:30 PM
Ah yea amazing, GJ ;)

This should work with what I did, at least it should providing you clicked talk-to on the options already?:


if (Pos('ady', RawMenuText) <> 0) or (Pos('ich', RawMenuText) <> 0) then
begin
writeln('Found SANDWICH random');
if (not (SL_Solve)) then
begin
CloseWindow;
Logout;
Result := False;
Exit;
end;
end;


Yep that's exactly how it would work :) simple no?


Also just finished mordaut detection - pulled that request

Ashaman88
03-09-2013, 09:31 PM
Ashaman88; Do you need an account for quiz master random for testing or do we not need it anymore?

I have time right now to take a crack at it, shoot it my way :)

Hobbit
03-09-2013, 09:35 PM
I have time right now to take a crack at it, shoot it my way :)

Forwarded

DannyRS
03-09-2013, 09:50 PM
Hobbit, or anyone else with a spare 5min,

If you ever get 5min spare time, double check this for me :p, no real way by myself I can test it in-game without a private server,

Grab:
https://github.com/SRL/SRL-OSR/pull/61

Open:
http://i.imgur.com/J0T3SPh.png
http://i.imgur.com/lbteJl7.png

Green target an image (my search area's should have enough range to account for slight client differences)

Then run this test see if it clicks correct sandwiches:


program SandwichTestScript;

{$I SRL-OSR/SRL.simba}

begin
SetupSRL;
SL_Solve;
end.


Any Feedback on random solving tactics appreciated!

I originally looked at WT-F's method in SRL4, but CTS2 allows unique colors per sandwich, so why not right?

Ashaman88
03-10-2013, 02:01 AM
Hobbit, or anyone else with a spare 5min,

If you ever get 5min spare time, double check this for me :p, no real way by myself I can test it in-game without a private server,

Grab:
https://github.com/SRL/SRL-OSR/pull/61

Open:
http://i.imgur.com/J0T3SPh.png
http://i.imgur.com/lbteJl7.png

Green target an image (my search area's should have enough range to account for slight client differences)

Then run this test see if it clicks correct sandwiches:


program SandwichTestScript;

{$I SRL-OSR/SRL.simba}

begin
SetupSRL;
SL_Solve;
end.


Any Feedback on random solving tactics appreciated!

I originally looked at WT-F's method in SRL4, but CTS2 allows unique colors per sandwich, so why not right?

Very nice :) I'll test when I get the chance.



So I've just finished the quiz master random, it gets the question right about 80% of the time and will eventually complete it. Those spiny things of the same color can be a pain for sure. See pull request. Also Hobbit , need to update the public randoms thread table

DannyRS
03-10-2013, 02:22 AM
Very nice :) I'll test when I get the chance.



So I've just finished the quiz master random, it gets the question right about 80% of the time and will eventually complete it. Those spiny things of the same color can be a pain for sure. See pull request. Also Hobbit , need to update the public randoms thread table

Thanks :) scripting's much harder when you can't actually test what your doing, challenge is more fun too tho!

Amazing Job on quiz master, I'll have to look how on earth you did it ;)

Is Mordaut an achieveable solver? What was his success rate previously? Did he ever get solved with 100% color method?

Ashaman88
03-10-2013, 05:01 AM
Thanks :) scripting's much harder when you can't actually test what your doing, challenge is more fun too tho!

Amazing Job on quiz master, I'll have to look how on earth you did it ;)

Is Mordaut an achieveable solver? What was his success rate previously? Did he ever get solved with 100% color method?

A lot of what I did was based off the old solver.

As for mordaut, I believe demise had it working to a high degree - for a little while at least. Good idea to start with her stuff as a basis probably

J J
03-10-2013, 10:16 AM
Anyone inside Molly random? Would really like to solve it and I haven't been getting much randoms on my account at all.

Figured I would repost these ACA files aswell:

DannyRS
03-10-2013, 01:29 PM
Anyone inside Molly random? Would really like to solve it and I haven't been getting much randoms on my account at all.

Figured I would repost these ACA files aswell:

I'll PM you my acc details if I get Molly :p

I've not had a random since yesterday tho haha, and I was botting for like 10 hours since then

Ashaman88
03-10-2013, 01:32 PM
I'll work on implementing the findtext stuff into the randoms.simba file today

euphemism
03-10-2013, 07:23 PM
Anyone inside Molly random? Would really like to solve it and I haven't been getting much randoms on my account at all.

Figured I would repost these ACA files aswell:

Ollybest has been working on Molly, you might get in touch with him to compare notes and whatnot.

Olly
03-10-2013, 08:07 PM
skype me

Hobbit
03-11-2013, 01:01 AM
Here's a bunch of grave digger (leo) pics

http://arkeo.chrishobbs.ca/files/grave_digger.zip

Ashaman88
03-11-2013, 01:58 AM
Here's a bunch of grave digger (leo) pics

http://arkeo.chrishobbs.ca/files/grave_digger.zip

Very nice!

I'll try and get the talking randoms detection put into the git tonight, been a busy day

slushpuppy
03-11-2013, 01:33 PM
does those OCR random solvers work?

irokiplugin.dll


Pete_AnalyzeAnimal
Pete_FindAnimal
Mordaut_GetBigSlotNr
Mordaut_GetSlotNr

Hobbit
03-11-2013, 01:52 PM
irokiplugin.dll need to be ported to simba. Someone (wizzup ?) said it shouldnt be too hard.

Ashaman88
03-11-2013, 01:56 PM
irokiplugin.dll need to be ported to simba. Someone (wizzup ?) said it shouldnt be too hard.

I know someone (cynic?) ported a few of the plugins, not sure if this one was included

slushpuppy
03-11-2013, 02:00 PM
do they work however ;x

Ashaman88
03-11-2013, 04:01 PM
do they work however ;x

I have not tested them yet

Ashaman88
03-12-2013, 01:20 AM
I've finished integrating the findtalk stuff for the chat randoms, so those that are just talking randoms will be done. Also danny's sandwich solver is called in it. I'll submit a pull in a little bit for it. Also is anyone else getting compiling errors with the evilbob addtosrllog stuff? Is it b/c I don't have the 993 build on this computer?

Justin
03-12-2013, 02:57 AM
I've finished integrating the findtalk stuff for the chat randoms, so those that are just talking randoms will be done. Also danny's sandwich solver is called in it. I'll submit a pull in a little bit for it. Also is anyone else getting compiling errors with the evilbob addtosrllog stuff? Is it b/c I don't have the 993 build on this computer?

I didn't have any issues compiling, what are the error messages?

E: Fixed in latest pull request :o

Ashaman88
03-12-2013, 03:00 AM
I didn't have any issues compiling, what are the error messages?

[Error] C:\Simba\Includes\SRL-OSR/SRL/core/antirandoms\evilbob.simba(114:43): Syntax error at line 113

It was several of the addtosrllog lines that had big spaces like " don ' ' t " or some such, I just removed the extra '' stuff and it worked. Strange indeedy

Justin
03-12-2013, 03:07 AM
[Error] C:\Simba\Includes\SRL-OSR/SRL/core/antirandoms\evilbob.simba(114:43): Syntax error at line 113

It was several of the addtosrllog lines that had big spaces like " don ' ' t " or some such, I just removed the extra '' stuff and it worked. Strange indeedy



E: Fixed in latest pull request :o

^^^

Ashaman88
03-12-2013, 03:51 AM
^^^

Sweet :)


So I just send in a bunch of pull requests, not sure if I messed it up haha. Pretty much did the following:

-Added findtalk to findnormalrandoms, it will search for the users nickname on the MS, if it detects it, it will move the mouse below it and if it finds the talk to or guard option, will right click and get the options
-Depending on the options, solvetalkingrandoms will determine which random it is and the proper course of action (ex: sandwich lady, call SL_Solve)
-You set the nickname like so:
SetScreenName(Players[0].Nick);

-Added a global boolean, SRL_CombatRandoms. User must set this to false after setupsrl to not detect combat randoms.
-Added a detection for infight, if infight and using combatrandoms, it will run away in a random direction which can be set by the scripter.
-Added a global array, SRL_FindRandomRunDirection, if it has not been set by the user, it will make you run in a random direction based on the 4 cardinal directions. But it can be set like so:
SRL_FindRandomRunDirection := ['W', 'N']; (whatever directions you want)

We can take or leave whatever, check out the changes on my pull requests

Justin
03-12-2013, 03:57 AM
Sweet :)


So I just send in a bunch of pull requests, not sure if I messed it up haha. Pretty much did the following:

-Added findtalk to findnormalrandoms, it will search for the users nickname on the MS, if it detects it, it will move the mouse below it and if it finds the talk to or guard option, will right click and get the options
-Depending on the options, solvetalkingrandoms will determine which random it is and the proper course of action (ex: sandwich lady, call SL_Solve)
-You set the nickname like so:
SetScreenName(Players[0].Nick);

-Added a global boolean, SRL_CombatRandoms. User must set this to false after setupsrl to not detect combat randoms.
-Added a detection for infight, if infight and using combatrandoms, it will run away in a random direction which can be set by the scripter.
-Added a global array, SRL_FindRandomRunDirection, if it has not been set by the user, it will make you run in a random direction based on the 4 cardinal directions. But it can be set like so:
SRL_FindRandomRunDirection := ['W', 'N']; (whatever directions you want)

We can take or leave whatever, check out the changes on my pull requests

SetScreenName(Players[0].Nick);

Should that go into SetupSRL;

With a failsafe (I think CheckNickname?) to check if the nick is set?

Ashaman88
03-12-2013, 04:33 AM
SetScreenName(Players[0].Nick);

Should that go into SetupSRL;

With a failsafe (I think CheckNickname?) to check if the nick is set?

Yeah it probably should, Also prob should add something to turn public chat off for false positives


Edit:

If you guys could start testing out findnormalrandoms, that would be great (especially for the talking randoms detection)

Justin
03-12-2013, 06:04 AM
Yeah it probably should, Also prob should add something to turn public chat off for false positives


Edit:

If you guys could start testing out findnormalrandoms, that would be great (especially for the talking randoms detection)

I'll be testing this, don't you worry!

Ashaman88
03-12-2013, 06:35 AM
I'll be testing this, don't you worry!

Sweet!

Just got the frog random, it detected it fine, but the princess was hoping all over and the text appeared over one of her friends - so looks like for that one, after we identify it's the frog we'll need to do some ACA to find the princess from there

Justin
03-12-2013, 06:37 AM
Sweet!

Just got the frog random, it detected it fine, but the princess was hoping all over and the text appeared over one of her friends - so looks like for that one, after we identify it's the frog we'll need to do some ACA to find the princess from there

Yeah I'd like to redo the detection system for that random

FYI:


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Cap,n Hand
Screenshot of: Solving Talking Random - Talk-to Cap,n Hand 7 Minutes and 11 Seconds
Found CAP random


http://puu.sh/2gjOe/5b79ef7244

Will keep an eye out for more!

Ashaman88
03-12-2013, 07:20 AM
Yeah I'd like to redo the detection system for that random

FYI:


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Cap,n Hand
Screenshot of: Solving Talking Random - Talk-to Cap,n Hand 7 Minutes and 11 Seconds
Found CAP random


http://puu.sh/2gjOe/5b79ef7244

Will keep an eye out for more!

Nice, findtalk is working well

Justin
03-12-2013, 07:49 AM
Nice, findtalk is working well




Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Drunken Dwarf
Screenshot of: Solving Talking Random - Talk-to Drunken Dwarf 10 Minutes and 10 Seconds
Found DWARF random




Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Cap,n Hand
Screenshot of: Solving Talking Random - Talk-to Cap,n Hand 10 Minutes and 51 Seconds
Found CAP random




Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Genie
Screenshot of: Solving Talking Random - Talk-to Genie 11 Minutes and 30 Seconds
Found geni random
***** Found Random: Rewards *****
RD_SolveLamp: Found experience lamp
RD_SolveXP: Clicked XP reward
RD_SolveXP: Solved experience reward
***** Solved Random: Rewards *****


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to RickTurpentine
Screenshot of: Solving Talking Random - Talk-to RickTurpentine 9 Minutes and 59 Seconds
Found RICK random


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to RickTurpentine
Screenshot of: Solving Talking Random - Talk-to RickTurpentine 9 Minutes and 26 Seconds
Found RICK random


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Dr Jekyll
Screenshot of: Solving Talking Random - Talk-to Dr Jekyll 9 Minutes and 37 Seconds
Found JEKYLL/HYDE random


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Drunken Dwarf
Screenshot of: Solving Talking Random - Talk-to Drunken Dwarf 11 Minutes and 34 Seconds
Found DWARF random


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Genie
Screenshot of: Solving Talking Random - Talk-to Genie 13 Minutes and 4 Seconds
Found geni random
***** Found Random: Rewards *****
RD_SolveLamp: Found experience lamp
RD_SolveXP: Clicked XP reward
RD_SolveXP: Solved experience reward
***** Solved Random: Rewards *****


Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Mysterious Old Man
Screenshot of: Solving Talking Random - Talk-to Mysterious Old Man 27 Minutes and 1 Seconds
Found OLD MAN random



Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Mysterious Old Man
Screenshot of: Solving Talking Random - Talk-to Mysterious Old Man 14 Minutes and 57 Seconds
Found OLD MAN random


Getting a random event ~10 minutes :O

Noticed with the Genie random, the solver NEEDS to finish talking to the genie in order for it to de-spawn

This is making my day :D

--Done testing randoms for the night

Ashaman88
03-12-2013, 12:00 PM
Great to see!! I think there are a few click to continues in there, is that function updated?

Justin
03-12-2013, 12:37 PM
Great to see!! I think there are a few click to continues in there, is that function updated?

Yeah ClickContinue works good :)

Ashaman88
03-12-2013, 01:23 PM
Yeah ClickContinue works good :)

Then I guess it just needs to be called more often for the solvetalkingrandoms :)

Good to see it all coming together though!

DannyRS
03-13-2013, 10:40 AM
Then I guess it just needs to be called more often for the solvetalkingrandoms :)

Good to see it all coming together though!

I think my sandwich solver probably needs another clickcontinue after solving the random screen to get rid of her saying "hope that fills you up" or whatever she says, although she will despawn if you click anywhere to lose the message, so it shouldn't matter that much,

Great Job guys! I've been really busy past few days so haven't been able to do much, but glad to see we're making such quick progress ;) nearly ready to get the long progress reports going for scripts!

Ashaman88
03-13-2013, 11:24 AM
I think my sandwich solver probably needs another clickcontinue after solving the random screen to get rid of her saying "hope that fills you up" or whatever she says, although she will despawn if you click anywhere to lose the message, so it shouldn't matter that much,

Great Job guys! I've been really busy past few days so haven't been able to do much, but glad to see we're making such quick progress ;) nearly ready to get the long progress reports going for scripts!

Yeah I think all those talking randoms should put the continue clicking in them

Justin
03-13-2013, 11:40 AM
DannyRS
Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Sandwich lady
Screenshot of: Solving Talking Random - Talk-to Sandwich lady 24 Minutes and 19 Seconds
Found SANDWICH random
[Sandwich Random] Sandwich Name: pie
[Sandwich Random] [ERROR] Invalid sandwich name found
[Sandwich Random] [ERROR] Invalid sandwich number

Looked in the include, seem to be missing the pie

Ashaman88
03-13-2013, 01:52 PM
DannyRS
Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Sandwich lady
Screenshot of: Solving Talking Random - Talk-to Sandwich lady 24 Minutes and 19 Seconds
Found SANDWICH random
[Sandwich Random] Sandwich Name: pie
[Sandwich Random] [ERROR] Invalid sandwich name found
[Sandwich Random] [ERROR] Invalid sandwich number

Looked in the include, seem to be missing the pie

How could DannyRS forget the pie?? Pies are the best!!

Also, going to be doing some more tweaking to the quiz master random tonight as Justin was the bomb and lent me another account to use (it eventually works, but I got some ideas for improving it)

Hobbit
03-13-2013, 01:54 PM
http://www.youtube.com/watch?v=diDeUv0v8dU

DannyRS
03-14-2013, 12:44 AM
DannyRS
Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to Sandwich lady
Screenshot of: Solving Talking Random - Talk-to Sandwich lady 24 Minutes and 19 Seconds
Found SANDWICH random
[Sandwich Random] Sandwich Name: pie
[Sandwich Random] [ERROR] Invalid sandwich name found
[Sandwich Random] [ERROR] Invalid sandwich number

Looked in the include, seem to be missing the pie


How could DannyRS forget the pie?? Pies are the best!!


Oh Jagex ! Is it named "Meat Pie" or just "Pie"? All the old 07 screenshots and info I could find had it listed as meat pie, I guess on screen it's just pie ^^ the colors are there, just need to change the case string from "meat pie" to "pie"

Ashaman88, Pie was the first one I ACA'd because it was easiest! :p

Justin, Typical the first actual real-world test and it didn't know what to look for ! but if it made it to that stage ok, then I'd say it will handle the rest just fine :p, good spot. And thanks so much for all the random testing! Idk how you are pulling the 1 random every 10min, I bot static tree clicking for hours trying to bait them and not so much as a dwarf >.< just my luck

Hobbit, Hahahah, the George Bush bit !

Edit - https://github.com/SRL/SRL-OSR/pull/84

DannyRS
03-15-2013, 06:58 PM
double post :( :/ above is crowded

Pillory.simba

https://github.com/SRL/SRL-OSR/pull/88


***** Found Random: Pillory (Cage) *****
[Pillory Random] [PL_ClickCage] Opened Lock Screen
[Pillory Random] [PL_GetLock] Lock Found: square [844]
[Pillory Random] [PL_GetKeys] Keys Found: circle square triangle
[Pillory Random] [PL_Solve] Clicking key : square
[Pillory Random] [PL_GetLock] Lock Found: circle [1058]
[Pillory Random] [PL_GetKeys] Keys Found: circle square triangle
[Pillory Random] [PL_Solve] Clicking key : circle
[Pillory Random] [PL_GetLock] Lock Found: square [897]
[Pillory Random] [PL_GetKeys] Keys Found: triangle circle square
[Pillory Random] [PL_Solve] Clicking key : square
[Pillory Random] [PL_GetLock] Lock Found: diamond [463]
[Pillory Random] [PL_GetKeys] Keys Found: square diamond triangle
[Pillory Random] [PL_Solve] Clicking key : diamond
***** Solved Random: Pillory (Cage) *****
Successfully executed.


SL works fine too


******** FOUND TALKING RANDOM TEXT********: Talk-to Sandwich lady
Screenshot of: Solving Talking Random - Talk-to Sandwich lady 28 Seconds
Found SANDWICH random
[Sandwich Random] Sandwich Name: pie
[Sandwich Random] Scanning for sandwich

Ashaman88
03-15-2013, 08:21 PM
double post :( :/ above is crowded

Pillory.simba

https://github.com/SRL/SRL-OSR/pull/88


***** Found Random: Pillory (Cage) *****
[Pillory Random] [PL_ClickCage] Opened Lock Screen
[Pillory Random] [PL_GetLock] Lock Found: square [844]
[Pillory Random] [PL_GetKeys] Keys Found: circle square triangle
[Pillory Random] [PL_Solve] Clicking key : square
[Pillory Random] [PL_GetLock] Lock Found: circle [1058]
[Pillory Random] [PL_GetKeys] Keys Found: circle square triangle
[Pillory Random] [PL_Solve] Clicking key : circle
[Pillory Random] [PL_GetLock] Lock Found: square [897]
[Pillory Random] [PL_GetKeys] Keys Found: triangle circle square
[Pillory Random] [PL_Solve] Clicking key : square
[Pillory Random] [PL_GetLock] Lock Found: diamond [463]
[Pillory Random] [PL_GetKeys] Keys Found: square diamond triangle
[Pillory Random] [PL_Solve] Clicking key : diamond
***** Solved Random: Pillory (Cage) *****
Successfully executed.


Awesome job danny!! Also I like to maze random and already started working on it - I have one of the routes pretty much down, but need all the accounts I can get (or at least the starting mm positions for starters facing north). That would be super

DannyRS
03-15-2013, 09:46 PM
Awesome job danny!! Also I like to maze random and already started working on it - I have one of the routes pretty much down, but need all the accounts I can get (or at least the starting mm positions for starters facing north). That would be super

I'll grab you maze screens if I get it :)

Findtalk bugged with security guard, no idea why wasn't watching, maybe because Talk-to is below the attack option?

debug just had many: FoundNickname

Ashaman88
03-15-2013, 09:47 PM
I'll grab you maze screens if I get it :)

Findtalk bugged with security guard, no idea why wasn't watching, maybe because Talk-to is below the attack option?

debug just had many: FoundNickname

Did it hover over the guard but never clicked? I think the uptext is the culprit.

DannyRS
03-15-2013, 11:53 PM
Did it hover over the guard but never clicked? I think the uptext is the culprit.

Ah might be, wasn't watching SMART, was improving my thiever script and noticed debug after a few min so I tabbed in to see him attacking me :p

I'm still using my text as I'm too lazy to update manually to Simba 993, thats probably it :p works fine on the others and the thieving was working fine and I used the same thing,

Could be a 1 off, but something to maybe keep an eye on ;)

Ashaman88
03-15-2013, 11:57 PM
Ah might be, wasn't watching SMART, was improving my thiever script and noticed debug after a few min so I tabbed in to see him attacking me :p

I'm still using my text as I'm too lazy to update manually to Simba 993, thats probably it :p works fine on the others and the thieving was working fine and I used the same thing,

Could be a 1 off, but spmething to maybe keep an eye on ;)

Well the uptext is different from the other talking randoms - that's why there is the part about the guard in there. I noticed it didn't detect it with just one portion of uptext so I added some more in the array, but it still might not be detecting it. Would probably need it to print out the uptext to see what it is seeing

Ashaman88
03-16-2013, 01:48 PM
Also are there any thoughts on better combat random detection? Right now it just searches for the fight bar right around your char and if it finds it, it runs away and back. The only bad thing is that if another player gets attacked on the square next to you/on top of you, it will think you are in combat and run away, which could become a pain. I was thinking maybe have an hp checker when it detects the attack bar. The checker would work by if you aren't at full health on the stats tab, then run away?

DannyRS
03-16-2013, 03:12 PM
Also are there any thoughts on better combat random detection? Right now it just searches for the fight bar right around your char and if it finds it, it runs away and back. The only bad thing is that if another player gets attacked on the square next to you/on top of you, it will think you are in combat and run away, which could become a pain. I was thinking maybe have an hp checker when it detects the attack bar. The checker would work by if you aren't at full health on the stats tab, then run away?


if you aren't at full health on the stats tab, then run away?

Sounds good :)

current hp = GetSkillInfo('hitpoints', True);
max hp = GetSkillInfo('hitpoints', False);

if current hp < max hp then run;

should work

but if your max lvl (99 def) can you always get hit 0 ?

DannyRS
03-16-2013, 11:40 PM
Ashaman88

Having one issue with this, I can't find any way to reliably move back to the center of the white box MM because of the stupid MM shift rotation,

I've tried RotatedDTM, Coh3n's TPA box thing, can't think of anything that will work every time :/ any ideas? I'm guna give up for today and go watch some TV,

Bitmaps on the signs has a 90% + success rate if I can just get to the starting center again haha :p

http://i.imgur.com/mh4xIg0.png


(*
Drill Demon
===========

Stores all the routines to solve the Drill Demon random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses BMPs and DTMs to locate the signs
to solve the Drill Demon (Sergeant Damien) random.

Original Author : DannyRS
Edits Made By :

*)

procedure DD_Message(Message: string);
begin
addToSRLLog('[DemonDrill Random] ' + Message);
end;

function DD_Detect(): boolean;
begin
if (not TabExists(TAB_OPTIONS)) and (not TabExists(TAB_EMOTES)) then
Result := (GetMusic = 'CorPoral Punisbment');
end;

(**
* Author: Coh3n
* Description: Returns a TBox of the exercise area on the minimap. It finds the
* distance from the player to each side of the exercise area. Saves the
* distance and points in arrays. It then uses those arrays to calculate the
* top left and bottom right corners of the exercise area.
*)
function DD_GetExerciseArea(var exerciseArea: TBox): boolean;
var
i, c, t, w, h, distFound: integer;
dist: array[0..3] of integer;
area: array[0..3] of TBox;
tpa: array[0..3] of TPoint;
begin
if (not loggedIn()) then
exit;

t := (getSystemTime + 15000);

repeat
inc(c);

// search areas for each direction (only one pixel at a time)
area[0] := intToBox(MMCX, MMCY - 1 - c, MMCX, MMCY - 1 - c); // north
area[1] := intToBox(MMCX + 1 + c, MMCY, MMCX + 1 + c, MMCY); // east
area[2] := intToBox(MMCX, MMCY + 1 + c, MMCX, MMCY + 1 + c); // south
area[3] := intToBox(MMCX - 1 - c, MMCY, MMCX - 1 - c, MMCY); // west

//Above is buggy as hell atm :/ - Danny
if ((MMCY - 1 - c) > MMY1) or ((MMCX - 1 - c) > MMX1) or
((MMCY + 1 + c) > MMY2) or ((MMCX + 1 + c) > MMX2) then
Exit;

// loop through each area (i.e. direction) to get the distance from the player to the fence on the MM
for i := 0 to high(area) do
if (dist[i] = 0) then
// the white color of the fence
if (findColorTolerance(tpa[i].x, tpa[i].y, 15068652, area[i].x1, area[i].y1, area[i].x2, area[i].y2, 25)) then
begin
dist[i] := distance(tpa[i].x, tpa[i].y, MMCX, MMCY);
inc(distFound);
end;

// if all 4 distances are found
if (distFound = 4) then
begin
// calculate the top left and bottom right of the exercise box
exerciseArea.x1 := tpa[3].x;
exerciseArea.y1 := tpa[3].y - dist[0];
exerciseArea.x2 := tpa[1].x;
exerciseArea.y2 := tpa[1].y + dist[2];

//SMART_DrawBox(exerciseArea);

w := (exerciseArea.x2 - exerciseArea.x1);
h := (exerciseArea.y2 - exerciseArea.y1);
//writeln('w: '+toStr(w)+', h: '+toStr(h));

// sometimes the Drill Demon is standing right inline with the player, causing the next white line to be found on the edge of the MM
result := (inRange(35, w - 7, w + 7) and inRange(20, h - 5, h + 5));
end;

until(result or (getSystemTime > t));
end;

function DD_ResetPosition: boolean;
var
exerciseArea: TBox;
p: TPoint;
begin
if (not loggedIn()) then
exit;

if (DD_GetExerciseArea(exerciseArea)) then
begin
p := middleBox(exerciseArea);
mouse(p.x, p.y + 5, 2, 2, mouse_Left);
Result := True;
end;
end;

function DD_TalkingToDemon: Boolean;
begin
Result := (Trim(GetNPCChatName) = 'SergeantDamien');
end;

function DD_TalkDemon: Boolean;
var
DemonTPA: TPointArray;
DemonATPA: T2DPointArray;
x, y, i: Integer;
begin
Result := False;

if (DD_TalkingToDemon) then
begin
Result := True;
Exit;
end;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.15, 1.61);
FindColorsTolerance(DemonTPA, 994406, MSX1, MSY1, MSX2, MSY2, 16);
SplitTPAExWrap(DemonTPA, 50, 100, DemonATPA);
SortATPASize(DemonATPA, True);

if (Length(DemonATPA) < 1) then Exit;

for i := 0 to High(DemonATPA) do
begin
if (Length(DemonATPA[i]) < 50) then Continue;
MiddleTPAEx(DemonATPA[i], x, y);
MMouse(RandomRange(x - 5, x + 5), RandomRange(y - 5, y + 5), 0, 0);
ClickMouse2(mouse_right);
if (ChooseOptionMulti(['Talk','alk-to'])) then
begin
if (WaitFunc(@DD_TalkingToDemon, 50, 25000)) then
begin
DD_Message('[DD_TalkDemon] Talked to demon');
Result := True;
Exit;
end else
DD_Message('[DD_TalkDemon] Failed to Talked to demon');
end;
end;
end;

function DD_GetSigns: TBoxArray;
var
ESignsTPA: TPointArray;
ESignsATPA: T2DPointArray;
SignsSorted: Boolean;
i: Integer;
begin
SetColorToleranceSpeed(1);
FindColors(ESignsTPA, 4553552, MSX1, MSY1, MSX2, MSY2);
SplitTPAExWrap(ESignsTPA, 20, 30, ESignsATPA);

repeat
SignsSorted := True;
for i := 0 to High(ESignsATPA) do
begin
if (Length(ESignsATPA[i]) < 5) then
begin
DeleteValueInATPA(ESignsATPA,i);
SignsSorted := False;
Break;
end;
end;
until (SignsSorted);

SetLength(Result, Length(ESignsATPA));

for i := 0 to high(ESignsATPA) do
begin
Result[i] := GetTPABounds(ESignsATPA[i]);
end;
end;

function DD_FindSign(WhichSign: String): TPoint;
var
SB: TBoxArray;
x, y, i, SBMP: Integer;
Saccuracy: Extended;
begin
Result := Point(-1, -1);

SB := DD_GetSigns;

SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);

case LowerCase(WhichSign) of
'jog': SBMP := BitmapFromString(29, 10, 'meJxzrQ5wJRrF9ZUSr3gwGItsMh' +
'qXbJQ5qxGI4EZRxViImRBjIaZRbizcTGR3UmgsmpnUCltcxlI rVKl' +
'rLNxk4tUDAIc3Qs8=');
'starjumps': SBMP := BitmapFromString(37, 16, 'meJxzrQ5wJR3F9ZXCERnacaHs+S' +
'34raOiXXAbIYjqJhNjKfGIPjbSx5t0C1U6RyI97Ro21tEtNdL HOuR' +
'iCtN8qtuIXDBiNZlGHgQiXMbSIgbh1uGJUyKrJAA7N7QN');
'situps': SBMP := BitmapFromString(37, 16, 'meJxzrQ5wHRwoe34LENHTLgqtI1' +
'473DqybSReL7Jd5FlHkl4060i1kSSNmHaRZB2pepGVkWojmnq CGtE' +
'MpyRYiLcOf8ASg4hJMJiyZFsX11cKRMhcuJkQKbgswWRDpF3I 1mHa' +
'BZElJpUSaRcEkZSDyLCRVPOHEwIAf3vRcQ==');
'pushups': SBMP := BitmapFromString(43, 16, 'meJxzrQ5wBaO4vlI4coUJ0hMhO2' +
'Cg3ICJsue3ANHA2o6MBtZ2OjuGoANo6hhMk+npBjxm0scNBE2 jaWg' +
'QbwiNkgcZuqiSVuEFICUBOLAZh57phFqOoacb0OJ6AK3GtB0A juAl' +
'9Q==');
end;

for i := 0 to High(SB) do
begin
if FindDeformedBitmapToleranceIn(SBMP, x, y, SB[i].X1-5, SB[i].Y1-5,
SB[i].X2+5, SB[i].Y2+5, 2, 4, False, Saccuracy) then
begin
if (SB[i].X1 > SB[i].X2) or (SB[i].Y1 > SB[i].Y2) then Break;
Result := Point(x + 20, y + 7);
Break;
end;
end;

FreeBitmap(SBMP);
end;

function DD_Solve(): boolean;
var
p: TPoint;
t, tmpCTS, MMoves: Integer;
tmpHM, tmpSM: Extended;
MatName: String;
ClickedMat: Boolean;
begin
Result := False;

if (not LoggedIn) then Exit;

t := GetSystemTime;

tmpCTS := GetColorToleranceSpeed;
GetToleranceSpeed2Modifiers(tmpHM, tmpSM);

SetAngle(SRL_ANGLE_LOW);
MakeCompass('N');

repeat

Result := TabExists(TAB_MAGIC);

if (Result) then Exit;

if (not DD_TalkDemon) then
begin
DD_ResetPosition;
Continue;
end;

Wait(RandomRange(1200, 1600));

case CountColor(0, MCX1, MCY1, MCX2, MCY2) of
687,988 : MatName := 'jog';
707 : MatName := 'starjumps';
569 : MatName := 'situps';
637,938 : MatName := 'pushups';
else
begin
ClickToContinue;
Continue;
end;
end;

DD_Message('[DD_Solve] Walking to center');

if (not DD_ResetPosition) then
begin
DD_Message('[ERROR] Failed to walk to center');
Continue;
end;

DD_Message('[DD_Solve] Searching for sign : ' + MatName);

p := DD_FindSign(MatName);

if (p.x < 0) or (p.y < 0) then
begin
DD_Message('[ERROR] Failed to find sign : ' + MatName);
Continue;
end;

ClickedMat:= False;
MMoves := 0;

DD_Message('[DD_Solve] Searching for matt : ' + MatName);

repeat
MMouse(p.x, p.y + 64, 40, 20);
MMoves := MMoves + 1;
Wait(RandomRange(90, 340));
if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
begin
ClickMouse2(mouse_right);
if (ChooseOptionMulti(['Use'])) then
begin
Wait(RandomRange(1200, 1500));
if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
begin
DD_Message('[DD_Solve] Used Matt');
ClickedMat := True;
Break;
end else
begin
DD_Message('[DD_Solve] Failed to Use Matt');
Continue;
end;
end;
end;
until (ClickedMat) or (MMoves > 10);

Result := TabExists(TAB_MAGIC);

until (Result) or (GetSystemTime - t > 240000);

if (not Result) then
begin
if (GetSystemTime - t > 240000) then
DD_Message('[ERROR] DrillDemon solver timed out');
end else
Wait(RandomRange(1200, 1600));
end;

Le Jingle
03-17-2013, 12:19 AM
Ashaman88

Having one issue with this, I can't find any way to reliably move back to the center of the white box MM because of the stupid MM shift rotation,

I've tried RotatedDTM, Coh3n's TPA box thing, can't think of anything that will work every time :/ any ideas? I'm guna give up for today and go watch some TV,

Bitmaps on the signs has a 90% + success rate if I can just get to the starting center again haha :p

http://i.imgur.com/mh4xIg0.png


(*
Drill Demon
===========

Stores all the routines to solve the Drill Demon random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses BMPs and DTMs to locate the signs
to solve the Drill Demon (Sergeant Damien) random.

Original Author : DannyRS
Edits Made By :

*)

procedure DD_Message(Message: string);
begin
addToSRLLog('[DemonDrill Random] ' + Message);
end;

function DD_Detect(): boolean;
begin
if (not TabExists(TAB_OPTIONS)) and (not TabExists(TAB_EMOTES)) then
Result := (GetMusic = 'CorPoral Punisbment');
end;

(**
* Author: Coh3n
* Description: Returns a TBox of the exercise area on the minimap. It finds the
* distance from the player to each side of the exercise area. Saves the
* distance and points in arrays. It then uses those arrays to calculate the
* top left and bottom right corners of the exercise area.
*)
function DD_GetExerciseArea(var exerciseArea: TBox): boolean;
var
i, c, t, w, h, distFound: integer;
dist: array[0..3] of integer;
area: array[0..3] of TBox;
tpa: array[0..3] of TPoint;
begin
if (not loggedIn()) then
exit;

t := (getSystemTime + 15000);

repeat
inc(c);

// search areas for each direction (only one pixel at a time)
area[0] := intToBox(MMCX, MMCY - 1 - c, MMCX, MMCY - 1 - c); // north
area[1] := intToBox(MMCX + 1 + c, MMCY, MMCX + 1 + c, MMCY); // east
area[2] := intToBox(MMCX, MMCY + 1 + c, MMCX, MMCY + 1 + c); // south
area[3] := intToBox(MMCX - 1 - c, MMCY, MMCX - 1 - c, MMCY); // west

//Above is buggy as hell atm :/ - Danny
if ((MMCY - 1 - c) > MMY1) or ((MMCX - 1 - c) > MMX1) or
((MMCY + 1 + c) > MMY2) or ((MMCX + 1 + c) > MMX2) then
Exit;

// loop through each area (i.e. direction) to get the distance from the player to the fence on the MM
for i := 0 to high(area) do
if (dist[i] = 0) then
// the white color of the fence
if (findColorTolerance(tpa[i].x, tpa[i].y, 15068652, area[i].x1, area[i].y1, area[i].x2, area[i].y2, 25)) then
begin
dist[i] := distance(tpa[i].x, tpa[i].y, MMCX, MMCY);
inc(distFound);
end;

// if all 4 distances are found
if (distFound = 4) then
begin
// calculate the top left and bottom right of the exercise box
exerciseArea.x1 := tpa[3].x;
exerciseArea.y1 := tpa[3].y - dist[0];
exerciseArea.x2 := tpa[1].x;
exerciseArea.y2 := tpa[1].y + dist[2];

//SMART_DrawBox(exerciseArea);

w := (exerciseArea.x2 - exerciseArea.x1);
h := (exerciseArea.y2 - exerciseArea.y1);
//writeln('w: '+toStr(w)+', h: '+toStr(h));

// sometimes the Drill Demon is standing right inline with the player, causing the next white line to be found on the edge of the MM
result := (inRange(35, w - 7, w + 7) and inRange(20, h - 5, h + 5));
end;

until(result or (getSystemTime > t));
end;

function DD_ResetPosition: boolean;
var
exerciseArea: TBox;
p: TPoint;
begin
if (not loggedIn()) then
exit;

if (DD_GetExerciseArea(exerciseArea)) then
begin
p := middleBox(exerciseArea);
mouse(p.x, p.y + 5, 2, 2, mouse_Left);
Result := True;
end;
end;

function DD_TalkingToDemon: Boolean;
begin
Result := (Trim(GetNPCChatName) = 'SergeantDamien');
end;

function DD_TalkDemon: Boolean;
var
DemonTPA: TPointArray;
DemonATPA: T2DPointArray;
x, y, i: Integer;
begin
Result := False;

if (DD_TalkingToDemon) then
begin
Result := True;
Exit;
end;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.15, 1.61);
FindColorsTolerance(DemonTPA, 994406, MSX1, MSY1, MSX2, MSY2, 16);
SplitTPAExWrap(DemonTPA, 50, 100, DemonATPA);
SortATPASize(DemonATPA, True);

if (Length(DemonATPA) < 1) then Exit;

for i := 0 to High(DemonATPA) do
begin
if (Length(DemonATPA[i]) < 50) then Continue;
MiddleTPAEx(DemonATPA[i], x, y);
MMouse(RandomRange(x - 5, x + 5), RandomRange(y - 5, y + 5), 0, 0);
ClickMouse2(mouse_right);
if (ChooseOptionMulti(['Talk','alk-to'])) then
begin
if (WaitFunc(@DD_TalkingToDemon, 50, 25000)) then
begin
DD_Message('[DD_TalkDemon] Talked to demon');
Result := True;
Exit;
end else
DD_Message('[DD_TalkDemon] Failed to Talked to demon');
end;
end;
end;

function DD_GetSigns: TBoxArray;
var
ESignsTPA: TPointArray;
ESignsATPA: T2DPointArray;
SignsSorted: Boolean;
i: Integer;
begin
SetColorToleranceSpeed(1);
FindColors(ESignsTPA, 4553552, MSX1, MSY1, MSX2, MSY2);
SplitTPAExWrap(ESignsTPA, 20, 30, ESignsATPA);

repeat
SignsSorted := True;
for i := 0 to High(ESignsATPA) do
begin
if (Length(ESignsATPA[i]) < 5) then
begin
DeleteValueInATPA(ESignsATPA,i);
SignsSorted := False;
Break;
end;
end;
until (SignsSorted);

SetLength(Result, Length(ESignsATPA));

for i := 0 to high(ESignsATPA) do
begin
Result[i] := GetTPABounds(ESignsATPA[i]);
end;
end;

function DD_FindSign(WhichSign: String): TPoint;
var
SB: TBoxArray;
x, y, i, SBMP: Integer;
Saccuracy: Extended;
begin
Result := Point(-1, -1);

SB := DD_GetSigns;

SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);

case LowerCase(WhichSign) of
'jog': SBMP := BitmapFromString(29, 10, 'meJxzrQ5wJRrF9ZUSr3gwGItsMh' +
'qXbJQ5qxGI4EZRxViImRBjIaZRbizcTGR3UmgsmpnUCltcxlI rVKl' +
'rLNxk4tUDAIc3Qs8=');
'starjumps': SBMP := BitmapFromString(37, 16, 'meJxzrQ5wJR3F9ZXCERnacaHs+S' +
'34raOiXXAbIYjqJhNjKfGIPjbSx5t0C1U6RyI97Ro21tEtNdL HOuR' +
'iCtN8qtuIXDBiNZlGHgQiXMbSIgbh1uGJUyKrJAA7N7QN');
'situps': SBMP := BitmapFromString(37, 16, 'meJxzrQ5wHRwoe34LENHTLgqtI1' +
'473DqybSReL7Jd5FlHkl4060i1kSSNmHaRZB2pepGVkWojmnq CGtE' +
'MpyRYiLcOf8ASg4hJMJiyZFsX11cKRMhcuJkQKbgswWRDpF3I 1mHa' +
'BZElJpUSaRcEkZSDyLCRVPOHEwIAf3vRcQ==');
'pushups': SBMP := BitmapFromString(43, 16, 'meJxzrQ5wBaO4vlI4coUJ0hMhO2' +
'Cg3ICJsue3ANHA2o6MBtZ2OjuGoANo6hhMk+npBjxm0scNBE2 jaWg' +
'QbwiNkgcZuqiSVuEFICUBOLAZh57phFqOoacb0OJ6AK3GtB0A juAl' +
'9Q==');
end;

for i := 0 to High(SB) do
begin
if FindDeformedBitmapToleranceIn(SBMP, x, y, SB[i].X1-5, SB[i].Y1-5,
SB[i].X2+5, SB[i].Y2+5, 2, 4, False, Saccuracy) then
begin
if (SB[i].X1 > SB[i].X2) or (SB[i].Y1 > SB[i].Y2) then Break;
Result := Point(x + 20, y + 7);
Break;
end;
end;

FreeBitmap(SBMP);
end;

function DD_Solve(): boolean;
var
p: TPoint;
t, tmpCTS, MMoves: Integer;
tmpHM, tmpSM: Extended;
MatName: String;
ClickedMat: Boolean;
begin
Result := False;

if (not LoggedIn) then Exit;

t := GetSystemTime;

tmpCTS := GetColorToleranceSpeed;
GetToleranceSpeed2Modifiers(tmpHM, tmpSM);

SetAngle(SRL_ANGLE_LOW);
MakeCompass('N');

repeat

Result := TabExists(TAB_MAGIC);

if (Result) then Exit;

if (not DD_TalkDemon) then
begin
DD_ResetPosition;
Continue;
end;

Wait(RandomRange(1200, 1600));

case CountColor(0, MCX1, MCY1, MCX2, MCY2) of
687,988 : MatName := 'jog';
707 : MatName := 'starjumps';
569 : MatName := 'situps';
637,938 : MatName := 'pushups';
else
begin
ClickToContinue;
Continue;
end;
end;

DD_Message('[DD_Solve] Walking to center');

if (not DD_ResetPosition) then
begin
DD_Message('[ERROR] Failed to walk to center');
Continue;
end;

DD_Message('[DD_Solve] Searching for sign : ' + MatName);

p := DD_FindSign(MatName);

if (p.x < 0) or (p.y < 0) then
begin
DD_Message('[ERROR] Failed to find sign : ' + MatName);
Continue;
end;

ClickedMat:= False;
MMoves := 0;

DD_Message('[DD_Solve] Searching for matt : ' + MatName);

repeat
MMouse(p.x, p.y + 64, 40, 20);
MMoves := MMoves + 1;
Wait(RandomRange(90, 340));
if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
begin
ClickMouse2(mouse_right);
if (ChooseOptionMulti(['Use'])) then
begin
Wait(RandomRange(1200, 1500));
if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
begin
DD_Message('[DD_Solve] Used Matt');
ClickedMat := True;
Break;
end else
begin
DD_Message('[DD_Solve] Failed to Use Matt');
Continue;
end;
end;
end;
until (ClickedMat) or (MMoves > 10);

Result := TabExists(TAB_MAGIC);

until (Result) or (GetSystemTime - t > 240000);

if (not Result) then
begin
if (GetSystemTime - t > 240000) then
DD_Message('[ERROR] DrillDemon solver timed out');
end else
Wait(RandomRange(1200, 1600));
end;


Not sure if this is what you're looking for, but I think it does something useful.
Based off of the 2 mm photo's, it takes the MM and returns the Middle of the Drill Demon Box.

Would need to test, in terms of a player that isn't already in the middle of the box.

Also, just example below, feel free to modify accordingly.



function DD_GetMiddleBox(var TP: TPoint; WhiteCol, Tol: Integer): Boolean;
var
x, y: Integer;
b: TBox;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result := False;
FindColorsTolerance(TPA, WhiteCol, MMX1, MMY1, MMX2, MMY2, Tol);
SplitTPAExWrap(TPA, 5, 5, ATPA); // gets around white player dots
SortATPAFromSize(ATPA, 100, True); // approx size = 100 of the middle box, at any angle
b := GetTPABounds(ATPA[0]); // should be sorted to the top, could use fail safes here
x := (B.X2 + B.X1) / 2;
y := (B.Y2 + B.Y1) / 2;
TP := Point(x, y);
result := (TP.x <> 0) and (TP.y <> 0);
end;


Cheers,
Lj

DannyRS
03-17-2013, 01:11 AM
Not sure if this is what you're looking for, but I think it does something useful.
Based off of the 2 mm photo's, it takes the MM and returns the Middle of the Drill Demon Box.

Would need to test, in terms of a player that isn't already in the middle of the box.

Also, just example below, feel free to modify accordingly.



function DD_GetMiddleBox(var TP: TPoint; WhiteCol, Tol: Integer): Boolean;
var
x, y: Integer;
b: TBox;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result := False;
FindColorsTolerance(TPA, WhiteCol, MMX1, MMY1, MMX2, MMY2, Tol);
SplitTPAExWrap(TPA, 5, 5, ATPA); // gets around white player dots
SortATPAFromSize(ATPA, 100, True); // approx size = 100 of the middle box, at any angle
b := GetTPABounds(ATPA[0]); // should be sorted to the top, could use fail safes here
x := (B.X2 + B.X1) / 2;
y := (B.Y2 + B.Y1) / 2;
TP := Point(x, y);
result := (TP.x <> 0) and (TP.y <> 0);
end;


Cheers,
Lj

Going to try something like this again tomorrow, been trying to do sometime exactly like it all day, just can't get it to work perfect around the entire thing at any compass angle, but I'm really tired so maybe tomorrow I can get it going :p

Thanks for the example ;) <3

Le Jingle
03-17-2013, 01:20 AM
Going to try something like this again tomorrow, been trying to do sometime exactly like it all day, just can't get it to work perfect around the entire thing at any compass angle, but I'm really tired so maybe tomorrow I can get it going :p

Thanks for the example ;) <3

Np, just thought of this; add a loop that searches for the yellow drill demon dot color within the tpa, would probably be very effective in making sure you have the right tpa to find the middle of :)

Sorry to everyone, haven't had much time past couple weeks for developing; will have some ample once things die down later next week.

cheers,
Lj!! :]

DannyRS
03-17-2013, 01:33 AM
Np, just thought of this; add a loop that searches for the yellow drill demon dot color within the tpa, would probably be very effective in making sure you have the right tpa to find the middle of :)

Sorry to everyone, haven't had much time past couple weeks for developing; will have some ample once things die down later next week.

cheers,
Lj!! :]

Main issue is, if you rotate the minimap so the top right hand corner of the box is above the other white above it, that sometimes get's caught in the Bounds, maybe with some more tweaking I'll find a good loop method :p

Yeh I've been busy too, bank holiday and easter break coming up tho so I should have some more random developing time :)

Ashaman88
03-17-2013, 03:06 AM
Good thinking guys. Sorry I am out of town this weekend, but ill take a look when I get back if y'all haven't figured it out by then. Danny are you still in the random?

Le Jingle
03-17-2013, 03:39 AM
Figured I'd try to put into code, what I mean earlier:

program test;
{$include_once srl/srl.simba}

function DD_GetCenterPoint(WhiteMMDotCol, YellowMMDotCol, Tol: Integer): TPoint;
var
i, w, y: Integer;
b: TBox;
TPA, TempTPA: TPointArray;
ATPA, TempATPA: T2DPointArray;
begin
w := WhiteMMDotCol;
y := YellowMMDotCol;
FindColorsTolerance(TPA, w, MMX1, MMY1, MMX2, MMY2, Tol);

// gets around white player dots
SplitTPAExWrap(TPA, 5, 5, ATPA);
SetArrayLength(TPA, 0);

// approx size = 100 of the middle box, at any angle
SortATPAFromSize(ATPA, 100, True);

TempTPA := GetMMDotsOnMS('npc');
if (Length(TempTPA) < 1) then
Exit;

for i := 0 to high(ATPA) do
begin
TempATPA := FloodFillTPA(ATPA[i]);
MergeATPAWrap(TempATPA, TPA);
SetArrayLength(TempATPA, 0);

if FindTPAInTPA(TempTPA, TPA, TempTPA) then
begin
writeln('found the drill demon box on MM');
Result := MiddleTPA(ATPA[i]);
break;
end;
end;
end;

var
p : TPoint;

const
WHITE_HERE = 0;
YELLOW_HERE = 0;

begin
SetupSRL;
p := DD_GetCenterPoint(WHITE_HERE, YELLOW_HERE, 15);
end.


Granted you would need to toy around with the white and yellow MM colors for precision (and they're not filled out in the example).
Could get the white MM dots, subtract then from a generic all white MM finder and go from there too.
Like Asha said, don't know if you're in the random still..
..but the example above would probably be easier to test whilst inside the random at different angles (because MakeNorth can only do so much with osr not giving more precise angles on the MM given the compass angle) rather than me recreating it with the paint snippets from the postings above.

Any who, let me know how it goes. :]
-Lj

slushpuppy
03-17-2013, 09:13 AM
Strange box still needs detection fixing:

http://i.imgur.com/Wp2ruQl.png

DannyRS
03-17-2013, 02:07 PM
Figured I'd try to put into code, what I mean earlier:

program test;
{$include_once srl/srl.simba}

function DD_GetCenterPoint(WhiteMMDotCol, YellowMMDotCol, Tol: Integer): TPoint;
var
i, w, y: Integer;
b: TBox;
TPA, TempTPA: TPointArray;
ATPA, TempATPA: T2DPointArray;
begin
w := WhiteMMDotCol;
y := YellowMMDotCol;
FindColorsTolerance(TPA, w, MMX1, MMY1, MMX2, MMY2, Tol);

// gets around white player dots
SplitTPAExWrap(TPA, 5, 5, ATPA);
SetArrayLength(TPA, 0);

// approx size = 100 of the middle box, at any angle
SortATPAFromSize(ATPA, 100, True);

TempTPA := GetMMDotsOnMS('npc');
if (Length(TempTPA) < 1) then
Exit;

for i := 0 to high(ATPA) do
begin
TempATPA := FloodFillTPA(ATPA[i]);
MergeATPAWrap(TempATPA, TPA);
SetArrayLength(TempATPA, 0);

if FindTPAInTPA(TempTPA, TPA, TempTPA) then
begin
writeln('found the drill demon box on MM');
Result := MiddleTPA(ATPA[i]);
break;
end;
end;
end;

var
p : TPoint;

const
WHITE_HERE = 0;
YELLOW_HERE = 0;

begin
SetupSRL;
p := DD_GetCenterPoint(WHITE_HERE, YELLOW_HERE, 15);
end.


Granted you would need to toy around with the white and yellow MM colors for precision (and they're not filled out in the example).
Could get the white MM dots, subtract then from a generic all white MM finder and go from there too.
Like Asha said, don't know if you're in the random still..
..but the example above would probably be easier to test whilst inside the random at different angles (because MakeNorth can only do so much with osr not giving more precise angles on the MM given the compass angle) rather than me recreating it with the paint snippets from the postings above.

Any who, let me know how it goes. :]
-Lj

I'll toy around with it today, ofc I'm still in the random not leaving till I get it working lol, I keep nearly letting it solve it by accident tho haha, because if it can see the next sign from the last matt, it just goes ahed :p



Strange box still needs detection fixing:


Strange box was detecting fine for me testerday, opens it and all, just doesn't solve, I think it's handled by Findtalk tho? Maybe invcheck isn't called in FNR?

DannyRS
03-17-2013, 05:02 PM
Le Jingle, Ashaman88, Got it working ;) thanks guys, Deform BMP tolerances may need tweaking to be 100% accurate every time, but I'll have to wait for next demon to test,

https://github.com/SRL/SRL-OSR/pull/92



***** Found Random: Drill Demon *****
[DemonDrill Random] [DD_TalkDemon] Talked to demon
[DemonDrill Random] [DD_Solve] Walking to center to search for sign
[DemonDrill Random] [DD_Solve] Searching for sign : jog
[DemonDrill Random] [DD_Solve] Searching for matt : jog
[DemonDrill Random] [DD_Solve] Used matt successfully
[DemonDrill Random] [DD_Solve] Walking to center to search for sign
[DemonDrill Random] [DD_Solve] Searching for sign : pushups
[DemonDrill Random] [DD_Solve] Searching for matt : pushups
[DemonDrill Random] [DD_Solve] Used matt successfully
[DemonDrill Random] [DD_Solve] Already standing on the matt : pushups
[DemonDrill Random] [DD_Solve] Using matt : pushups again
[DemonDrill Random] [DD_Solve] Used matt successfully
[DemonDrill Random] [DD_Solve] Walking to center to search for sign
[DemonDrill Random] [DD_Solve] Searching for sign : starjumps
[DemonDrill Random] [DD_Solve] Searching for matt : starjumps
[DemonDrill Random] [DD_Solve] Used matt successfully
[DemonDrill Random] [DD_Solve] Already standing on the matt : starjumps
[DemonDrill Random] [DD_Solve] Using matt : starjumps again
[DemonDrill Random] [DD_Solve] Used matt successfully
***** Solved Random: Drill Demon *****

Also got another Pillory Cage, so I tweaked it to be faster and have a better output log :p


***** Found Random: Pillory (Cage) *****
[Pillory Random] [PL_ClickCage] Opened Lock Screen
[Pillory Random] [PL_GetLock] Lock Found: square [840]
[Pillory Random] [PL_GetKeys] Keys Found: diamond [493] square [729] circle [506]
[Pillory Random] [PL_Solve] Clicking key : square
[Pillory Random] [PL_GetLock] Lock Found: diamond [459]
[Pillory Random] [PL_GetKeys] Keys Found: circle [506] diamond [603] triangle [286]
[Pillory Random] [PL_Solve] Clicking key : diamond
[Pillory Random] [PL_GetLock] Lock Found: triangle [630]
[Pillory Random] [PL_GetKeys] Keys Found: triangle [286] diamond [493] square [729]
[Pillory Random] [PL_Solve] Clicking key : triangle
***** Solved Random: Pillory (Cage) *****

Ashaman88
03-17-2013, 08:30 PM
Nice job Danny! Ill respond to stuff properly tonight

DannyRS
03-17-2013, 09:20 PM
Nice job Danny! Ill respond to stuff properly tonight

No rush ;) however we're badly missing your expertise for the harder randoms <3

Ashaman88
03-18-2013, 01:00 AM
I'll toy around with it today, ofc I'm still in the random not leaving till I get it working lol, I keep nearly letting it solve it by accident tho haha, because if it can see the next sign from the last matt, it just goes ahed :p




Strange box was detecting fine for me testerday, opens it and all, just doesn't solve, I think it's handled by Findtalk tho? Maybe invcheck isn't called in FNR?

The strange box is not called by the findtalk. Well it calls for the mysterious old man, but really the solver only initiates the talking one. He has several versions, one takes you to maze, one he just gives you a gift when you talk to him, and one where he gives you the box. Will probably just have to have an inventory check for the boxes in the loop if it isn't added already


Sounds good :)

current hp = GetSkillInfo('hitpoints', True);
max hp = GetSkillInfo('hitpoints', False);

if current hp < max hp then run;

should work

but if your max lvl (99 def) can you always get hit 0 ?

I believe the randoms combat lvl is always in proportion to your lvl, so they should still be able to hit you. I'll look into adding that feature for the combat randoms

DannyRS
03-18-2013, 01:14 AM
Yea the randoms are based on your combat level, but I seem to remember being able to easily kill them like nothing at level 128 in decent gear, but I can't remember if they can hit you for dmg or not, they most likely can,

Calling findtalk and FNR handles the box just fine up to the point of having to solve it ;)

Ashaman88
03-18-2013, 01:23 AM
Yea the randoms are based on your combat level, but I seem to remember being able to easily kill them like nothing at level 128 in decent gear, but I can't remember if they can hit you for dmg or not, they most likely can,

Calling findtalk and FNR handles the box just fine up to the point of having to solve it ;)

Oh ok great about the box. PS couldn't we just do hppercent <> 100 for the combat ones?

DannyRS
03-18-2013, 01:33 AM
Oh ok great about the box. PS couldn't we just do hppercent <> 100 for the combat ones?

I've never used that operator because I'm noob :p, <> is "not equal to" right? is there an include that returns hp percent? Are we talking on the overhead hp bar or in the stats panel?

Ashaman88
03-18-2013, 02:40 AM
I've never used that operator because I'm noob :p, <> is "not equal to" right? is there an include that returns hp percent? Are we talking on the overhead hp bar or in the stats panel?


(*
HPPercent
~~~~~~~~~

.. code-block:: pascal

function HpPercent: Integer;

Returns Hp left as a percentage from skill panel
returns -1 is unsuccessful.

.. note::

by DannyRS
Last Modified: Feb. 28th, 2013 by DannyRS

Example:

.. code-block:: pascal
*)
function HPPercent(SwapGTabBack: Boolean): Integer;
var
OrigTab,CHP,CMHP: Integer;
begin
Result := -1;
if (SwapGTabBack) then OrigTab := GetCurrentTab;
if (GameTab(tab_Stats)) then
begin
CHP := GetSkillInfo('hp',True);
CMHP := GetSkillInfo('hp',False);
Result := Round((CHP*100/CMHP));
if (SwapGTabBack) then GameTab(OrigTab);
end;
end;


<> just means not equal yeah. You wrote that silly :P. Wouldn't that work though? if hppercent(true)<>100 then runnnn?

DannyRS
03-18-2013, 02:47 AM
<> just means not equal yeah. You wrote that silly :P. Wouldn't that work though? if hppercent(true)<>100 then runnnn?

Ah, hahaha, gametab is like 2000 lines long, I forget what's in it rofl, I just zombie re-wrote the SRL5 functions to work in 07 :p as in, read description what it's meant to do, make it work,

It should work I guess? Can't see why not, Give it a shot, also note that for hp bar detection, MSCX and MSCY are nowhere near the center of your in-game character - Idk if you noticed this yet, and I didn't look if you even used em ;)

Also noticed FindTalk; for evil chicken was overriding FNR; and not running, may just be the way I have it set up in my script, also chicken has no uptext (because its a combat mob higher level than you), maybe a rightclick regardless of uptext is needed?

Ashaman88
03-18-2013, 12:29 PM
Ah, hahaha, gametab is like 2000 lines long, I forget what's in it rofl, I just zombie re-wrote the SRL5 functions to work in 07 :p as in, read description what it's meant to do, make it work,

It should work I guess? Can't see why not, Give it a shot, also note that for hp bar detection, MSCX and MSCY are nowhere near the center of your in-game character - Idk if you noticed this yet, and I didn't look if you even used em ;)

Also noticed FindTalk; for evil chicken was overriding FNR; and not running, may just be the way I have it set up in my script, also chicken has no uptext (because its a combat mob higher level than you), maybe a rightclick regardless of uptext is needed?

Yeah it doesn't use mscx or cy for the detection. As for the chicken, does it only attack you? I think the combat randoms are called before the findtalk ones in findnormalrandoms, am I right? So it might hover over it when it sees your name but after a few hits it should detect the combat and run right?

DannyRS
03-18-2013, 12:46 PM
Yeah it doesn't use mscx or cy for the detection. As for the chicken, does it only attack you? I think the combat randoms are called before the findtalk ones in findnormalrandoms, am I right? So it might hover over it when it sees your name but after a few hits it should detect the combat and run right?

I had to stop it because it was destroying me and I was going to die haha, it appeared to hover the chicken, do nothing for a sec (obviously as no uptext) then I resumed thieving (my procedures) then it tried to hover the chicken again when it said "Bawk Bawk" or whatever (my rsn contains none of those characters) then back to thieving, by this time my hp bar had been up for quite a bit, I'll do more testing today and try and troubleshoot if it's my script or the setup in FNR; ;)

Ashaman88
03-18-2013, 02:41 PM
I had to stop it because it was destroying me and I was going to die haha, it appeared to hover the chicken, do nothing for a sec (obviously as no uptext) then I resumed thieving (my procedures) then it tried to hover the chicken again when it said "Bawk Bawk" or whatever (my rsn contains none of those characters) then back to thieving, by this time my hp bar had been up for quite a bit, I'll do more testing today and try and troubleshoot if it's my script or the setup in FNR; ;)

That is strange that it hovered then...you sure it wasn't confused thinking it was thieving? Also was the angle high or low? I'm not 100% if it works on low, I didn't test it there oops ;)

DannyRS
03-18-2013, 02:54 PM
That is strange that it hovered then...you sure it wasn't confused thinking it was thieving? Also was the angle high or low? I'm not 100% if it works on low, I didn't test it there oops ;)

Was on high, Compass North, 100% sure it wasn't thieving as my loop simply hovers stall till uptext, and mouse moved away from chicken, thieving again now, we'll see

Ashaman88
03-18-2013, 03:14 PM
Was on high, Compass North, 100% sure it wasn't thieving as my loop simply hovers stall till uptext, and mouse moved away from chicken, thieving again now, we'll see

And you are just calling findnormalrandoms?

DannyRS
03-18-2013, 03:24 PM
And you are just calling findnormalrandoms?

my FTWait(); and FindNormalRandoms;

today so far:


Found NickName
Found NickName
Found NickName
Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to RickTurpentine
Screenshot of: Solving Talking Random - Talk-to RickTurpentine 7 Minutes and 1 Seconds
Found RICK random
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
***** Found Random: Pillory (Cage) *****
[Pillory Random] [PL_ClickCage] Opened Lock Screen
[Pillory Random] [PL_GetLock] Lock Found: triangle [599]
[Pillory Random] [PL_GetKeys] Keys Found: triangle [334] diamond [493] square [891]
[Pillory Random] [PL_Solve] Clicking key : triangle
[Pillory Random] [PL_GetLock] Lock Found: triangle [624]
[Pillory Random] [PL_GetKeys] Keys Found: triangle [286] diamond [493] square [1297]
[Pillory Random] [PL_Solve] Clicking key : triangle
[Pillory Random] [PL_GetLock] Lock Found: circle [1489]
[Pillory Random] [PL_GetKeys] Keys Found: diamond [493] circle [506] triangle [407]
[Pillory Random] [PL_Solve] Clicking key : circle
***** Solved Random: Pillory (Cage) *****
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.




Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.


- is when a half onscreen npc talks, guard "get off there"

Ashaman88
03-18-2013, 03:49 PM
my FTWait(); and FindNormalRandoms;

today so far:


Found NickName
Found NickName
Found NickName
Found NickName
******** FOUND TALKING RANDOM TEXT********: Talk-to RickTurpentine
Screenshot of: Solving Talking Random - Talk-to RickTurpentine 7 Minutes and 1 Seconds
Found RICK random
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (339,337). Swapping the values for now.
***** Found Random: Pillory (Cage) *****
[Pillory Random] [PL_ClickCage] Opened Lock Screen
[Pillory Random] [PL_GetLock] Lock Found: triangle [599]
[Pillory Random] [PL_GetKeys] Keys Found: triangle [334] diamond [493] square [891]
[Pillory Random] [PL_Solve] Clicking key : triangle
[Pillory Random] [PL_GetLock] Lock Found: triangle [624]
[Pillory Random] [PL_GetKeys] Keys Found: triangle [286] diamond [493] square [1297]
[Pillory Random] [PL_Solve] Clicking key : triangle
[Pillory Random] [PL_GetLock] Lock Found: circle [1489]
[Pillory Random] [PL_GetKeys] Keys Found: diamond [493] circle [506] triangle [407]
[Pillory Random] [PL_Solve] Clicking key : circle
***** Solved Random: Pillory (Cage) *****
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.
Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.




Warning! You passed wrong values to a finder function: ys > ye (338,337). Swapping the values for now.


- is when a half onscreen npc talks, guard "get off there"

Aw then I think I know how to fix that. PS Just using findnormalrandoms often has worked find detecting the talking ones fine for me, you may want to try just using that a bunch? I'm not sure how the fwait would affect it, but still need to take a look at it

DannyRS
03-18-2013, 07:28 PM
I got Coh3ns / DemiseScythes mordaut solver detecting some of the items at least :O shall keep playing with it ;)

EDIT - ok so the items change size on every re-log - big problem lol

EDIT2 - seems mordaut needs re-done mostly :/

Ashaman88
03-18-2013, 08:58 PM
I got Coh3ns / DemiseScythes mordaut solver detecting some of the items at least :O shall keep playing with it ;)

EDIT - ok so the items change size on every re-log - big problem lol

EDIT2 - seems mordaut needs re-done mostly :/

If you wanna let me take a crack just let me know! (and your account is still in there?)

Ashaman88
03-18-2013, 08:58 PM
I got Coh3ns / DemiseScythes mordaut solver detecting some of the items at least :O shall keep playing with it ;)

EDIT - ok so the items change size on every re-log - big problem lol

EDIT2 - seems mordaut needs re-done mostly :/

If you wanna let me take a crack just let me know! (and your account is still in there?)

DannyRS
03-18-2013, 11:02 PM
If you wanna let me take a crack just let me know! (and your account is still in there?)

I exited coz I deemed the current scanner impossible :(

Will stay in if I get him again

I tried some stuff myself, but with the pretty much any item in game thing going on, only bitmaps worked, and they would be absolutely massive and slow to detect as hell :/

Ashaman88
03-19-2013, 02:03 AM
I exited coz I deemed the current scanner impossible :(

Will stay in if I get him again

I tried some stuff myself, but with the pretty much any item in game thing going on, only bitmaps worked, and they would be absolutely massive and slow to detect as hell :/

I have a couple ideas that might work :) I'll let you know details if they work at all

DannyRS
03-19-2013, 02:28 AM
I have a couple ideas that might work :) I'll let you know details if they work at all

I tried scanning them with TPA's to get all pixels related to the objects, but they match far too closely to each other with just that,

What we really need is a "TPAMatchesShape" function with tolerances or something, I've though about ways to make one myself, but I can't put my finger on a fullproof solution / method,

Any idea's how to overcome the objects changing size every time you re-open the interface? Some stay fairly close, but the tinderbox for example changed from like 600 max pixels to 1200, making it almost double :/

Same issues with the Miles Random, I'm trying to theorycraft a few approaches ;)

Ashaman88
03-20-2013, 01:18 PM
I tried scanning them with TPA's to get all pixels related to the objects, but they match far too closely to each other with just that,

What we really need is a "TPAMatchesShape" function with tolerances or something, I've though about ways to make one myself, but I can't put my finger on a fullproof solution / method,

Any idea's how to overcome the objects changing size every time you re-open the interface? Some stay fairly close, but the tinderbox for example changed from like 600 max pixels to 1200, making it almost double :/

Same issues with the Miles Random, I'm trying to theorycraft a few approaches ;)

I'm not sure how the solver works right now, but I guess it depends on how many sizes it has. Like if it is just 2 sizes, have a big object analyzer and a small object analyzer?

DannyRS
03-20-2013, 01:26 PM
I'm not sure how the solver works right now, but I guess it depends on how many sizes it has. Like if it is just 2 sizes, have a big object analyzer and a small object analyzer?

Based off max width, max height, max tpa size, max cover % of the box,

over a scan period of like 3sec, problem is some items change size on re-log :/

Ashaman88
03-20-2013, 01:44 PM
Based off max width, max height, max tpa size, max cover % of the box,

over a scan period of like 3sec, problem is some items change size on re-log :/

I getcha, but are they always the same 2 sizes? Big and small? Or is it really varied? Like 10 sizes of the same shield or w/e

DannyRS
03-20-2013, 02:00 PM
I getcha, but are they always the same 2 sizes? Big and small? Or is it really varied? Like 10 sizes of the same shield or w/e

The chalkboard screen (small puzzle in coh3ns solver) the sizes seem to stay the same, the 15 card one (big puzzle in coh3ns solver) half the items change size every relog :/

I'm trying Prison Pete, Any idea's for detecting the floor animals? I've tried just about every color sorting option we have available, and can only get remotely close on the sheep / goat :/

Ashaman88
03-20-2013, 02:14 PM
The chalkboard screen (small puzzle in coh3ns solver) the sizes seem to stay the same, the 15 card one (big puzzle in coh3ns solver) half the items change size every relog :/

I'm trying Prison Pete, Any idea's for detecting the floor animals? I've tried just about every color sorting option we have available, and can only get remotely close on the sheep / goat :/

But do they change to the same sizes? Like always either 10x10 or 5x5? Or are there more variations?

DannyRS
03-20-2013, 02:26 PM
But do they change to the same sizes? Like always either 10x10 or 5x5? Or are there more variations?

I didn't check, but I Think its just two, like,


either 10x10 or 5x5

maybe two object id's for all would work

Ashaman88
03-20-2013, 02:28 PM
I didn't check, but I Think its just two, like,



maybe two object id's for all would work

Yeah, will just be time consuming to get :/

DannyRS
03-20-2013, 02:34 PM
Yeah, will just be time consuming to get :/

These damn balloon animals !! so close yet so far !

Ashaman88
03-20-2013, 07:25 PM
Oh yeah this needs to be added to setupsrl

SetScreenName(Players[0].Nick);

The only thing is that it will need to be changed for multiplayer - and called somewhere whenever it switches to the next player

DannyRS
03-20-2013, 07:41 PM
Oh yeah this needs to be added to setupsrl

SetScreenName(Players[0].Nick);

The only thing is that it will need to be changed for multiplayer - and called somewhere whenever it switches to the next player

it was added without multiplayer already :p

PrisonPete is truly impossible :/ I tried (and I mean Really tried), but I can barely even tell the cat from the dog myself :/

Ashaman88
03-20-2013, 07:56 PM
it was added without multiplayer already :p

PrisonPete is truly impossible :/ I tried (and I mean Really tried), but I can barely even tell the cat from the dog myself :/

Ok great, then I guess just multiplayer functionality will be needed - Is it called in setupsrl right now?

As for pete - yeah I'm not sure how that one would work. Might want to go through some old srl revisions and see if they had a solver

DannyRS
03-20-2013, 08:02 PM
Ok great, then I guess just multiplayer functionality will be needed - Is it called in setupsrl right now?

As for pete - yeah I'm not sure how that one would work. Might want to go through some old srl revisions and see if they had a solver

Yea it's in setupsrl now,

I checked the old revisions,

Coh3n, Demise, Olly and Kyle could never quite solve it from what I saw :/

I can get ~95% correct detection on what animal needs popped from lever,
~85% correct detection on the Goat (big horns one)
~75% correct detection on the Sheep (same as goat no horns)
Cat and dog both return on literally every function Simba has, at any angle, at any spot, using any math :/

and you need like, at least 70% on all four, to even attempt to solve it :/

I spent like 10 hours trying TPA's to try and math the difference between the dog and cat, but I'd say it's next to impossible with no control over the camera zoom

Ashaman88
03-21-2013, 12:54 AM
Yea it's in setupsrl now,

I checked the old revisions,

Coh3n, Demise, Olly and Kyle could never quite solve it from what I saw :/

I can get ~95% correct detection on what animal needs popped from lever,
~85% correct detection on the Goat (big horns one)
~75% correct detection on the Sheep (same as goat no horns)
Cat and dog both return on literally every function Simba has, at any angle, at any spot, using any math :/

and you need like, at least 70% on all four, to even attempt to solve it :/

I spent like 10 hours trying TPA's to try and math the difference between the dog and cat, but I'd say it's next to impossible with no control over the camera zoom

Yeah that might be tricky then :/ If you post what you got, maybe we can play around with the detection for the cat and dog.



Also I was thinking maybe we need to make a topic in the public section describing the different random event features (like srl_combatrandoms and direction to run) - since more and more people are using the official version.

Also is there a section on the forums for people to report OSR include bugs? That might be useful too.

DannyRS
03-21-2013, 01:00 AM
Yeah that might be tricky then :/ If you post what you got, maybe we can play around with the detection for the cat and dog.



Also I was thinking maybe we need to make a topic in the public section describing the different random event features (like srl_combatrandoms and direction to run) - since more and more people are using the official version.

Also is there a section on the forums for people to report OSR include bugs? That might be useful too.

http://villavu.com/forum/project.php?projectid=2

yeh we shud write a random event guide ;)

Ashaman88
03-21-2013, 01:04 AM
http://villavu.com/forum/project.php?projectid=2

yeh we shud write a random event guide ;)

http://villavu.com/forum/project.php?projectid=9

Oh you mean dat :P Will def direct people there

DannyRS
03-21-2013, 01:21 AM
http://villavu.com/forum/project.php?projectid=9

Oh you mean dat :P Will def direct people there

Yeh that :p Idk how I got srl5 on my clipboard :/

going to maybe try and actually make a real script tomorrow to use OSR haha, maybe a flax picker to see if the beehive randoms in OSR or not

Ashaman88
03-21-2013, 02:12 AM
Yeh that :p Idk how I got srl5 on my clipboard :/

going to maybe try and actually make a real script tomorrow to use OSR haha, maybe a flax picker to see if the beehive randoms in OSR or not

Wish there was an official list of the 2007 randoms somewhere. Ps is declare players normally called after setupsrl? If so the setchatname won't work in setupsrl?

DannyRS
03-21-2013, 02:40 AM
Wish there was an official list of the 2007 randoms somewhere. Ps is declare players normally called after setupsrl? If so the setchatname won't work in setupsrl?

I always called it before, does it make a difference? Always works fine before for me

Ashaman88
03-21-2013, 01:16 PM
I always called it before, does it make a difference? Always works fine before for me

haha well I guess not, we will just have to make sure it is included in the randoms instructions - that's why people have been getting runtime errors with it

DannyRS
03-21-2013, 04:03 PM
haha well I guess not, we will just have to make sure it is included in the randoms instructions - that's why people have been getting runtime errors with it

Yea Random's are kinda advanced Simba stuff for most user's, because of the way we have to set it up, and you need to call it in scripts in a certain way like that, I'll write a guide later today if noone else wants to by then ;)

Ashaman88
03-21-2013, 07:30 PM
Yea Random's are kinda advanced Simba stuff for most user's, because of the way we have to set it up, and you need to call it in scripts in a certain way like that, I'll write a guide later today if noone else wants to by then ;)

Go for it :) Make sure to cover all the stuff like setting the run directions and everything !

Olly
03-21-2013, 09:55 PM
I had the animal ballons detected well in the new rs, but the animals are twice (if not more) bigger than the ones in old rs (because people were complaining about the difference lol). So yeah its alot harder in the old version because all animals are near enough a blob of purple.

DannyRS
03-22-2013, 12:25 AM
I had the animal ballons detected well in the new rs, but the animals are twice (if not more) bigger than the ones in old rs (because people were complaining about the difference lol). So yeah its alot harder in the old version because all animals are near enough a blob of purple.

I got sheep and goat 90% accurate, but thats useless, and dog-cat is near impossible, at runtime, I'd say impossible

Ashaman88
03-22-2013, 08:29 PM
Also I have an idea for the skill related randoms (like steaming rock and w/e).

Something like so:

Have a boolean for each skill that produces a specific random (SRL_MININGRANDOMS)
Have it set to false by default
If the script is a mining script, have script writer set miningrandoms to true
Then in findnormal randoms run the scan for the smoke or w/e
Solver would just be to click under character and wait 10 seconds or so.


That way we wouldn't have to worry about a ton of false positives for mining (fill in each skill here) randoms when the script has nothing to do with mining.


Apply that to all the skill specific randoms.


Maybe?

DannyRS
03-22-2013, 08:47 PM
Also I have an idea for the skill related randoms (like steaming rock and w/e).

Something like so:

Have a boolean for each skill that produces a specific random (SRL_MININGRANDOMS)
Have it set to false by default
If the script is a mining script, have script writer set miningrandoms to true
Then in findnormal randoms run the scan for the smoke or w/e
Solver would just be to click under character and wait 10 seconds or so.


That way we wouldn't have to worry about a ton of false positives for mining (fill in each skill here) randoms when the script has nothing to do with mining.


Apply that to all the skill specific randoms.


Maybe?

Sounds better, go ahed ;), got a strange box finally, guna try some functions on it :p

Hobbit
03-23-2013, 12:16 AM
Added Lost and Found (Abyss) to the list.

J J
03-28-2013, 10:50 AM
I'm going to work on a few randoms the next few days, my weekend start in around 2 hours :)
I/we have finished a big university group project that needs to be done next week already so I have some hours of spare time.

I assume this is still updated?
I believe I have ACA files for the strange plant which should be easy to solve because of the dark purple.

Other than that I have been really unlucky with random events, nearly all have been NPC's. I have never been on ScapeRune Island or does that one not exist? I've had the Molly random event once but I saw the TRiBot random solver solving it so I just watched it as it was nearly done anyways..

I hope to get a few good randoms that are not solved yet to finally contribute properly except from contributing to the genie xp lamp and a few .aca files

Ashaman88
03-28-2013, 11:09 AM
Awesome JJ! I believe the list is updated. As for strange plant, only thing I would say is to put multiple verifications (idk, see purple and making sure that green is near it?) also semi good thing is if it does attack the runaway stuff will be called

Hobbit
04-16-2013, 08:14 PM
Any updates on this? We are currently at 71.7% detection.

Sorry for being away lately, its finals time ad I've been buried. Git is all pulled now.

Flight
04-17-2013, 02:07 AM
I'm going to work on a few randoms the next few days, my weekend start in around 2 hours :)
I/we have finished a big university group project that needs to be done next week already so I have some hours of spare time.

I assume this is still updated?
I believe I have ACA files for the strange plant which should be easy to solve because of the dark purple.

Other than that I have been really unlucky with random events, nearly all have been NPC's. I have never been on ScapeRune Island or does that one not exist? I've had the Molly random event once but I saw the TRiBot random solver solving it so I just watched it as it was nearly done anyways..

I hope to get a few good randoms that are not solved yet to finally contribute properly except from contributing to the genie xp lamp and a few .aca files

Sounds wonderful. Yes I was thinking along the same lines for the Strange Plant: detect it via the fruit, attempt to pick the fruit and wait for what the next game message will be; "You pick the fruit" should give the green light that the anti-random was successful, if we got the message "..unable to pick the fruit" then we could set some sort of timer that, while enabled, will ignore searching for the Strange Plant so we don't repeatedly try to interact with the same plant. I imagine this timer should be approx. the same amount of time it takes for the plant to grow into the attacking NPC.

Yes ScapeRune (both the island & prison exist). Although I've not yet encountered the pirate on the island nor the beekeeper yet.

Some good advice for everyone wanting to trigger random events, I encourage you to spin flax in the Lumbridge Castle; this area is extremely prone to light-weight random events (mostly interacting NPCs from what I've observed), while if a random event is triggered via teleporting it's likely to be a much more complex random, as in ScapeRune/Prison/Island/Maze.

Ashaman88
04-17-2013, 02:47 AM
Any updates on this? We are currently at 71.7% detection.

Sorry for being away lately, its finals time ad I've been buried. Git is all pulled now.

Well we are not sure if the skill specific ones will be handled by the solver or by the specific skill scripts and the script writers (like for the ent...the solver would not only have to detect an ent tree... yellow uptext or something... but it would also have to figure out which way your character is facing and if your character is even cutting that specific tree...this would be hard to implement across all situations

Hobbit
04-17-2013, 03:29 AM
Im pretty sure in the past we had (Using ents as an example) a FindEnt function and people would build their own antirandom procedure which had findnormalrandoms and the skill specific ones for the skill they are doing. I may be completely wrong but that is what I remember.

Justin
04-17-2013, 03:32 AM
Flight; I've seen several flax picking bots get the Bee Keeper random as I think you can only get it while picking flax. I think we might need to suicide some accounts in order to get the random event

Ashaman88
04-17-2013, 08:41 PM
Im pretty sure in the past we had (Using ents as an example) a FindEnt function and people would build their own antirandom procedure which had findnormalrandoms and the skill specific ones for the skill they are doing. I may be completely wrong but that is what I remember.

I'll dig through some of the old stuff and see what I can find

Flight
05-10-2013, 03:44 AM
I forgot to post this yesterday but while running Naturez I watched the random solver work wonderfully for the Drill Demon. Great job Dev. team! :thumbsup:

Flight
05-14-2013, 02:19 PM
A few minutes ago the random solver for the sandwich lady failed to identify the correct sandwich. The target was a square sandwich but the solver chose the wrong one and I got clubbed out of the fishing colony. :(

Sorry I wasn't there to see which item it selected instead, I'm afraid this is all the info I can provide. I hope it helps.

Flight
05-21-2013, 02:34 AM
Ok everyone, who can give me some information about failing the frog random event? Is it like before when if you ignore the royal frog or choose the wrong option you're teleported to a cave? I've never failed it in OSR so I need a bit of info before I make a solver for it. Please and thank you.

Ashaman88
05-21-2013, 01:00 PM
Ok everyone, who can give me some information about failing the frog random event? Is it like before when if you ignore the royal frog or choose the wrong option you're teleported to a cave? I've never failed it in OSR so I need a bit of info before I make a solver for it. Please and thank you.

Yeah that is what happens. I believe Justin wrote a solver to get out of the cave. PS I thought I saw in the other thread that strange box solver wasn't working. Why is that? That is the one with the shapes and numbers right? I wrote a solver for that awhile back and it was working 80% each question and 100% eventually

DannyRS
05-21-2013, 03:01 PM
A few minutes ago the random solver for the sandwich lady failed to identify the correct sandwich. The target was a square sandwich but the solver chose the wrong one and I got clubbed out of the fishing colony. :(

Sorry I wasn't there to see which item it selected instead, I'm afraid this is all the info I can provide. I hope it helps.

I'm going to re-write the sandwhich solver with shape detection after my final assignment is handed in in a week or two ;) seems color alone is dodgey still :/

DannyRS
05-21-2013, 11:26 PM
Flight, Had a quick rework of it ^.^

https://github.com/SRL/SRL-OSR/pull/127

Flight
05-22-2013, 12:47 AM
Nicely done DannyRS.


Yeah that is what happens. I believe Justin wrote a solver to get out of the cave. PS I thought I saw in the other thread that strange box solver wasn't working. Why is that? That is the one with the shapes and numbers right? I wrote a solver for that awhile back and it was working 80% each question and 100% eventually

That would be nice, I really don't want to have my script keep logging out the player after a strangebox is given.

Olly
05-22-2013, 12:53 AM
Flight, Had a quick rework of it ^.^

https://github.com/SRL/SRL-OSR/pull/127

Why didnt you stick to DTM's? they used to work perfect back when current RS had them.

Cage
10-07-2013, 06:27 AM
The pinball random needs a little tweaking. I was watching it when it was being solved and when a pinball appears on the furthest end of the room away from the player, sometimes by the time the player gets to it (if hes walking) it goes for another click in the midst of the animation from the first click thus resetting the score back to zero. Also when it got to the exit procedure it had to initiate the backup as the first method didn't get me to the exit. It kept clicking towards the east of the room. (Compass angle was also east at that point if that makes any difference when the random team are trying to debug.

Hoodz
10-07-2013, 09:25 AM
Ashaman88 can you take a look at my random solver for the whirlpool random? it can be found at my barbfisher and i think it works correctly :)

Flight
10-07-2013, 09:52 AM
Ashaman88 can you take a look at my random solver for the whirlpool random? it can be found at my barbfisher and i think it works correctly :)

For reference here's yours:

function CheckPool: boolean;
var
TPAA: T2DPointArray;
TPA: TPointArray;
CTS, I: Integer;
mp: tpoint;
box: tbox;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
setcolorspeed2modifiers(1.26, 0.29);
FindColorsSpiralTolerance(mscx, mscy, TPA, 12301240, 70, 38, 500, 327, 16);
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 15, 15);
SortATPASize(TPAA, True);
for I := 0 to High(TPAA) do
if GetArraylength(TPAA[i]) > 20 then
begin
smart_drawboxex(false, false, box, clred);
MiddleTPAEx(TPAA[i], x, y);
Mp := MiddleTPA(TPAA[i]);
box := inttobox(mp.x - 9, mp.y - 9, mp.x + 9, mp.y + 9);
if pixelshift(box, 500) > 280 then
begin
result := true
end;
end;
end;


Your search bounds are [70, 38, 500, 327], that's most of the full area of the MS... So basically if any visible fishing spot becomes a whirlpool, even if it's not yours, your script will detect it and run away. And you should definitely remove the SMART drawing as not everyone would want boxes drawn on their screen every time a whirlpool is detected.

You should take a look at this thread (http://villavu.com/forum/showthread.php?t=102926) for some ideas.

Hoodz
10-07-2013, 12:52 PM
For reference here's yours:

function CheckPool: boolean;
var
TPAA: T2DPointArray;
TPA: TPointArray;
CTS, I: Integer;
mp: tpoint;
box: tbox;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
setcolorspeed2modifiers(1.26, 0.29);
FindColorsSpiralTolerance(mscx, mscy, TPA, 12301240, 70, 38, 500, 327, 16);
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 15, 15);
SortATPASize(TPAA, True);
for I := 0 to High(TPAA) do
if GetArraylength(TPAA[i]) > 20 then
begin
smart_drawboxex(false, false, box, clred);
MiddleTPAEx(TPAA[i], x, y);
Mp := MiddleTPA(TPAA[i]);
box := inttobox(mp.x - 9, mp.y - 9, mp.x + 9, mp.y + 9);
if pixelshift(box, 500) > 280 then
begin
result := true
end;
end;
end;


Your search bounds are [70, 38, 500, 327], that's most of the full area of the MS... So basically if any visible fishing spot becomes a whirlpool, even if it's not yours, your script will detect it and run away. And you should definitely remove the SMART drawing as not everyone would want boxes drawn on their screen every time a whirlpool is detected.

You should take a look at this thread (http://villavu.com/forum/showthread.php?t=102926) for some ideas.I know but i said he should take a look at it. You can remove the Smart functions. But yes you are right, the location is not right. But atleast it will detect the whirlpools.

rj
10-07-2013, 07:18 PM
I know but i said he should take a look at it. You can remove the Smart functions. But yes you are right, the location is not right. But atleast it will detect the whirlpools.

Whirlpool detecting is more for script side, just make it look for all the fishing spots, sort from closest to player, from the closest to the farthest BEFORE hovering over each spot check the pixel shift, if > a number then it's a whirlpool and move on to the next OR set the length of the ATPA to 2-3 (2-3 fishing spots)

Millenium
12-08-2013, 03:39 PM
Mordaut random solving, failed for the 2nd time in a row now, debug just cycles through all possible solutions and returns failed to find each time.
(reset script and didn't code debug in time, sorry)

Coh3n
12-09-2013, 04:35 AM
Just out of curiosity, what happened to all the solvers Demise and I wrote a year or so ago? I rewrote them to be easily updated, and most of them should have been extremely easy to make work with OSR.

Itankbots
12-09-2013, 04:38 AM
Just out of curiosity, what happened to all the solvers Demise and I wrote a year or so ago? I rewrote them to be easily updated, and most of them should have been extremely easy to make work with OSR.

No idea, but they would be extremely helpful. Like you said it would probably only take me a day or two to fix them... Just starting to get into OSRS with Millenium

Coh3n
12-09-2013, 04:40 AM
No idea, but they would be extremely helpful. Like you said it would probably only take me a day or two to fix them... Just starting to get into OSRS with MilleniumIt was a great system, and if SRL-OSR was based off the latest SRL-5 then it might still use it (the system). It would be a shame if everything was rewritten from scratch.

Flight
12-09-2013, 05:20 AM
Just out of curiosity, what happened to all the solvers Demise and I wrote a year or so ago? I rewrote them to be easily updated, and most of them should have been extremely easy to make work with OSR.

Did she make solvers for the 3D object random events? Like the Strange Box, Certers, Grave Digger and so on... Personally I'd like to just have the old plugins compiled and used again in anti-randoms. Cynicrus has already converted them to work with Simba, apparently, but there's no compiled version.

Coh3n
12-09-2013, 04:56 PM
Did she make solvers for the 3D object random events? Like the Strange Box, Certers, Grave Digger and so on... Personally I'd like to just have the old plugins compiled and used again in anti-randoms. Cynicrus has already converted them to work with Simba, apparently, but there's no compiled version.Grave digger was one of maybe two that we didn't solve. Certers worked perfectly as far as I know, and I don't know if the strange box was in RS at the time. I don't remember writing a solver for it. But Mordaut worked really well (probably upwards of 95% of the time), maze was perfect, sandwich lady. Honestly I think the grave digger and prison pete were the only ones that weren't solved.

I don't really remember what the old plugins were used for, they were written before my time.

E: These were the only randoms at the time: https://github.com/SRL/SRL-5/tree/master/SRL/core/antirandoms

E2: Looking SRL-OSR I see you kept the same system (i.e. antirandoms.simba), which it's great! :) I'm pretty proud of that system and I'm glad you guys stuck with it.

Hoodz
12-09-2013, 05:10 PM
Grave digger was one of maybe two that we didn't solve. Certers worked perfectly as far as I know, and I don't know if the strange box was in RS at the time. I don't remember writing a solver for it. But Mordaut worked really well (probably upwards of 95% of the time), maze was perfect, sandwich lady. Honestly I think the grave digger and prison pete were the only ones that weren't solved.

I don't really remember what the old plugins were used for, they were written before my time.

E: These were the only randoms at the time: https://github.com/SRL/SRL-5/tree/master/SRL/core/antirandoms

E2: Looking SRL-OSR I see you kept the same system (i.e. antirandoms.simba), which it's great! :) I'm pretty proud of that system and I'm glad you guys stuck with it.
To bad most of the random solvers doesnt work for osr.

Coh3n
12-09-2013, 05:15 PM
To bad most of the random solvers doesnt work for osr.Well obviously. They were written for RS as of last year. Of course they'd need to be updated to work with RS07. My point is a lot of the randoms are really similar and would require only minimal updates to the solvers.

Krazy_Meerkat
12-11-2013, 03:14 PM
It would be nice if there were a sub-forum for OSR random development..
Most randoms which aren't straight-up talking are failing for me, I wanted to see where some of the randoms usually fail..

Certers not detecting odd item out 100% of the time. Client freezes up when scanning.
Drill sergeant detects 3-4 signs but then doesn't select one, spams talk-to-sergeant then walk-to-centre a few times before logging out. Edit: Srl just solved a drill demon, first time it's worked in over 10 separate attempts. Sadly wasn't watching because I was writing this :p
Frog random fails by not finishing the speech options while talking to princess at the end of the cave.
Sandwich lady fails at finding correct food 90% of the time.
Pillory cage won't click on the cage if the compass angle is not north, having problems with lock-detection when facing north, the keys were mostly right although the circle was recognised as a diamond.
Strangebox dtm is not recognised, when I set the dtm, solved only 50-60% of the time. The shape recognition was about 80% accurate while the numberscan was disturbingly 40-50% accurate (often changing to wrong numbers, only for the correct shape). The two wrong answers seem to be shown front-on a lot more than the actual answer.
Genie completes but can screw up banking scripts when lampskill is not set because the lamp can't be banked. (Set a random default lampskill?)


I made edits to the pinball random because it wouldn't exit the cave when the compass angle was not north. Simply detected current angle, set to north for the exit routine and set back to previous angle after a successful cave exit. Tested and working fine for me using the Pascal version of OSR:

(*
Pinball
=======

Stores all the routines to solve the Pinball random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses findGapsTPA to determine which post to click.

*)

//{$DEFINE PB_DEBUG}

const
PB_SCORE_10 = 180; // the tpa length of when the score is 10

(**
* Author: Coh3n
* Description: Detects if a player is in the Pinball random.
*)
function PB_Detect(): boolean;
begin
// makes sure friends tab exists and magic doesn't
if ((not tabExists(TAB_MAGIC)) and (tabExists(TAB_FRIENDS))) then
result := (Trim(GetTextAtExWrap(374, 238, 411, 253, 0, 5, 1,
65535, 5, 'UpChars07')) = 'Score');
end;

(**
* Author: Coh3n
* Description: Returns the length of a tpa found of the yellow color of the
* score at the top of the main screen.
*)
function PB_GetScore(): integer;
var
tpa: TPointArray;
begin
// yellow color of the score
if (findColorsTolerance(tpa, 65535, 373, 239, 434, 258, 30)) then
result := length(tpa);
end;

(**
* Author: SKy Scripter, NCDS, & Coh3n
* Description: Returns true if a flashing pillar is found. Sets coordinates
* to x, y.
*)
const
_PB_FILL_COLOR = 10;
_PB_MIN_LENGTH = 20;

function PB_ScanPost(var x, y: integer): boolean;
var
tpa: TPointArray;
pillarCols: array of integer;
ATPA, pillarGaps: T2DPointArray;
oldTarget, tmpCTS, bmp, i, j, c: integer;
hue, sat, lum: extended;
tmpBox: TBox;
begin
result := false;
bmp := -1;

try
tmpCTS := getColorToleranceSpeed;
setColorToleranceSpeed(3);

// the green of the spinning pillars
findColorsTolerance(tpa, 6011467, MSX1, MMY1, MSX2, MSY2, 38);

setColorToleranceSpeed(tmpCTS);

// if colors aren't found, exit
if (length(tpa) < _PB_MIN_LENGTH) then
exit;

bmp := createBitmap(MSX2 + 5, MSY2 + 5); // creats a bitmap of the MS
fastDrawClear(bmp, _PB_FILL_COLOR); // fill it with a distinct color

c := 0;
pillarCols := getColors(tpa);

// draws a rectangle on the bitmap of the colors that are light enough
for i := 0 to high(tpa) do
begin
colorToHSL(pillarCols[i], hue, sat, lum);

if (lum > 50.0) then
begin
tmpBox := intToBox(max(0, tpa[i].x - 1), max(0, tpa[i].y - 1), tpa[i].x + 1, tpa[i].y + 1);
rectangleBitmap(bmp, tmpBox, clRed);
inc(c);
end;
end;

if (c > _PB_MIN_LENGTH) then
begin
floodFillBitmap(bmp, point(5, 5), _PB_FILL_COLOR, clBlack);

oldTarget := getImageTarget();
setTargetBitmap(bmp);

findColors(tpa, _PB_FILL_COLOR, 0, 0, MSX2 - 5, MSY2 - 5);

setImageTarget(oldTarget); // reset target to RS client

if (length(tpa) > 10) then
begin
ATPA := TPAtoATPA(tpa, 60);
sortATPASize(ATPA, true);

for i := 0 to high(ATPA) do
begin
pillarGaps := findGapsTPA(ATPA[i], 10);

for j := 0 to high(pillarGaps) do
if (length(pillarGaps[j]) > 2) then
begin
middleTPAEx(ATPA[i], x, y);
result := true;
break;
end;

if (result) then
break;
end;
end;
end;

{$IFDEF PB_DEBUG}
displayDebugImgWindow(MSX2, MSY2);
drawBitmapDebugImg(bmp);
{$ENDIF}

finally
if (bmp <> -1) then
freeBitmap(bmp);
end;

if (result) then
addToSRLLog('PB_ScanPost: Found post');
end;

(**
* Author: Coh3n
* Description: Returns true if player clicks a post and the score changes.
*)
function PB_TagPost(): boolean;
var
t, x, y, oldScore: integer;
begin
if (not loggedIn()) then
exit;

oldScore := PB_GetScore();

if (PB_ScanPost(x, y)) then
begin
Mouse(x, y, 5, 5, mouse_right);

if (WaitOptionMulti(['ag', 'g P'], 618)) then
begin
t := (getSystemTime + 6000);
while (getSystemTime < t) do
begin
if (PB_GetScore() <> oldScore) then
begin
addToSRLLog('PB_TagPost: Tagged post');
result := true;
break;
end;

wait(300 + random(200));
end;
end else
MMouse(x, y - 25, 8, 8);
end;
end;

(**
* Author: DemiseScythe & Coh3n
* Description: Uses mainscreen walking to exit the random.
* Updated: Fixed for 07scape. - DannyRS - 23/03/2013
*)
function PB_Exit(): boolean;
var
x, y, t, i: integer;
tpa, tpa_Exit: TPointArray;
ATPA: T2DPointArray;
Deg: Extended;
begin

if (not loggedIn()) then
exit;
addToSRLLog('PB_Exit: Exiting cave');
SetAngle(SRL_ANGLE_HIGH);
Deg := RS_GetCompassAngleDegrees;
Wait(100 + random(50));
MakeCompass('N');
t := (getSystemTime + 25000);
repeat
// the green path color
if (findColorsTolerance(tpa, 4544055, MSX1, MMCY+10, MSX2, MSY2, 35)) then
begin
if (length(tpa) > 0) then
begin
MiddleTPAEx(tpa, x, y);
MMouse(x, y, 5, 5);
Wait(RandomRange(90,150));
if (waitUptextMulti(['Exit', 'xit', 'Cave', 'ave'], 200)) then
begin
ClickMouse2(mouse_left);
if (waitTabExists(TAB_MAGIC, 8000)) then
begin
result := true;
break;
end;
end;
end;
end;
if (findColorsTolerance(tpa, 5734757, MSX1, MMCY, MSX2, MSY2, 35)) then
if (length(tpa) > 0) then
begin
sortTPAFrom(tpa, point(MSCX, MSY2)); // center of the bottom of the MS
x := tpa[0].x;
y := tpa[0].y - 20; // so it's actually on the MS

MMouse(x, y, 5, 5);

// check for the proper uptexts
if (waitUptextMulti(['Walk', 'alk', 'here', 'ere'], 200)) then
begin
ClickMouse2(mouse_left);
end
else if (waitUptextMulti(['Exit', 'xit', 'Cave', 'ave'], 200)) then
begin
ClickMouse2(mouse_left);
if (waitTabExists(TAB_MAGIC, 8000)) then
begin
result := true;
break;
end;
end;
end;
result := tabExists(TAB_MAGIC); // just in case
wait(2000 + random(300));
until ((getSystemTime > t) or (result));
if (result) then
begin
Wait(100 + random(500));
MakeCompass(Deg);
addToSRLLog('PB_Exit: Clicked exit cave')
end else
begin
addToSRLLog('PB_Exit: Took to long to find exit... Looking for backup');
t := (getSystemTime + 20000);
MakeCompass('S');
repeat
if (FindColorsTolerance(tpa_Exit, 4677175, MSX1, MSY1, MSX2, MSY2, 23)) then
ATPA := TPAToATPAEx(tpa_Exit, 70, 5);
if (length(ATPA) > 0) then
begin
SortATPASize(ATPA, True);
for i := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 5, 5);
Wait(RandomRange(90,150));
if (waitUptextMulti(['Exit', 'xit', 'Cave', 'ave'], 200)) then
begin
ClickMouse2(mouse_left);
if (waitTabExists(TAB_MAGIC, 8000)) then
begin
result := true;
break;
end;
end;
end;
end;
result := tabExists(TAB_MAGIC);
wait(2000 + random(300));
until ((getSystemTime > t) or (result));
if (result) then
addToSRLLog('PB_Exit: Clicked exit cave with backup')
else
addToSRLLog('PB_Exit: Failed to exit')
end;
end;

(**
* Author: Coh3n & DemiseScythe
* Description: Solves the Pinball random.
*)
function PB_Solve(): boolean;
var
t: integer;
begin
if (not loggedIn()) then
exit;

t := (getSystemTime + (15 * 60000)); // maximum 15 minutes
doConversation('', false);

repeat
if (PB_GetScore = PB_SCORE_10) then // length of "Score: 10"
begin
if (PB_Exit()) then
begin
result := true;
break;
end;
end else
PB_TagPost();

wait(500 + random(200));
until(result or (getSystemTime > t));
end;

Ashaman88
12-11-2013, 03:36 PM
Grave digger was one of maybe two that we didn't solve. Certers worked perfectly as far as I know, and I don't know if the strange box was in RS at the time. I don't remember writing a solver for it. But Mordaut worked really well (probably upwards of 95% of the time), maze was perfect, sandwich lady. Honestly I think the grave digger and prison pete were the only ones that weren't solved.

I don't really remember what the old plugins were used for, they were written before my time.

E: These were the only randoms at the time: https://github.com/SRL/SRL-5/tree/master/SRL/core/antirandoms

E2: Looking SRL-OSR I see you kept the same system (i.e. antirandoms.simba), which it's great! :) I'm pretty proud of that system and I'm glad you guys stuck with it.

From what I remember, we had based it off of both the most recent antirandoms yall came up with and tried combining with the solvers from 2007 SRL. The majority of the randoms that weren't solved were due to a lack of accounts to test with as well as a lack of interest in OSR.


It would be nice if there were a sub-forum for OSR random development..
Most randoms which aren't straight-up talking are failing for me, I wanted to see where some of the randoms usually fail..

Certers not detecting odd item out 100% of the time. Client freezes up when scanning.
Drill sergeant detects 3-4 signs but then doesn't select one, spams talk-to-sergeant then walk-to-centre a few times before logging out.
Freaky forester detects event but does nothing.
Frog random fails by not finishing the speech options while talking to princess at the end of the cave.
Sandwich lady fails at finding correct food 90% of the time.
Pillory cage won't click on the cage if the compass angle is not north, having problems with lock-detection when facing north, the keys were mostly right although the circle was recognised as a diamond.
Strangebox dtm is not recognised, when I set the dtm, solved only 50-60% of the time. The shape recognition was about 80% accurate while the numberscan was disturbingly 40-50% accurate (often changing to wrong numbers, only for the correct shape). The two wrong answers seem to be shown front-on a lot more than the actual answer.
Genie completes but can screw up banking scripts when lampskill is not set because the lamp can't be banked. (Set a random default lampskill?)


I made edits to the pinball random because it wouldn't exit the cave when the compass angle was not north. Simply detected current angle, set to north for the exit routine and set back to previous angle after a successful cave exit. Tested and working fine for me:

(*
Pinball
=======

Stores all the routines to solve the Pinball random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses findGapsTPA to determine which post to click.

*)

//{$DEFINE PB_DEBUG}

const
PB_SCORE_10 = 180; // the tpa length of when the score is 10

(**
* Author: Coh3n
* Description: Detects if a player is in the Pinball random.
*)
function PB_Detect(): boolean;
begin
// makes sure friends tab exists and magic doesn't
if ((not tabExists(TAB_MAGIC)) and (tabExists(TAB_FRIENDS))) then
result := (Trim(GetTextAtExWrap(374, 238, 411, 253, 0, 5, 1,
65535, 5, 'UpChars07')) = 'Score');
end;

(**
* Author: Coh3n
* Description: Returns the length of a tpa found of the yellow color of the
* score at the top of the main screen.
*)
function PB_GetScore(): integer;
var
tpa: TPointArray;
begin
// yellow color of the score
if (findColorsTolerance(tpa, 65535, 373, 239, 434, 258, 30)) then
result := length(tpa);
end;

(**
* Author: SKy Scripter, NCDS, & Coh3n
* Description: Returns true if a flashing pillar is found. Sets coordinates
* to x, y.
*)
const
_PB_FILL_COLOR = 10;
_PB_MIN_LENGTH = 20;

function PB_ScanPost(var x, y: integer): boolean;
var
tpa: TPointArray;
pillarCols: array of integer;
ATPA, pillarGaps: T2DPointArray;
oldTarget, tmpCTS, bmp, i, j, c: integer;
hue, sat, lum: extended;
tmpBox: TBox;
begin
result := false;
bmp := -1;

try
tmpCTS := getColorToleranceSpeed;
setColorToleranceSpeed(3);

// the green of the spinning pillars
findColorsTolerance(tpa, 6011467, MSX1, MMY1, MSX2, MSY2, 38);

setColorToleranceSpeed(tmpCTS);

// if colors aren't found, exit
if (length(tpa) < _PB_MIN_LENGTH) then
exit;

bmp := createBitmap(MSX2 + 5, MSY2 + 5); // creats a bitmap of the MS
fastDrawClear(bmp, _PB_FILL_COLOR); // fill it with a distinct color

c := 0;
pillarCols := getColors(tpa);

// draws a rectangle on the bitmap of the colors that are light enough
for i := 0 to high(tpa) do
begin
colorToHSL(pillarCols[i], hue, sat, lum);

if (lum > 50.0) then
begin
tmpBox := intToBox(max(0, tpa[i].x - 1), max(0, tpa[i].y - 1), tpa[i].x + 1, tpa[i].y + 1);
rectangleBitmap(bmp, tmpBox, clRed);
inc(c);
end;
end;

if (c > _PB_MIN_LENGTH) then
begin
floodFillBitmap(bmp, point(5, 5), _PB_FILL_COLOR, clBlack);

oldTarget := getImageTarget();
setTargetBitmap(bmp);

findColors(tpa, _PB_FILL_COLOR, 0, 0, MSX2 - 5, MSY2 - 5);

setImageTarget(oldTarget); // reset target to RS client

if (length(tpa) > 10) then
begin
ATPA := TPAtoATPA(tpa, 60);
sortATPASize(ATPA, true);

for i := 0 to high(ATPA) do
begin
pillarGaps := findGapsTPA(ATPA[i], 10);

for j := 0 to high(pillarGaps) do
if (length(pillarGaps[j]) > 2) then
begin
middleTPAEx(ATPA[i], x, y);
result := true;
break;
end;

if (result) then
break;
end;
end;
end;

{$IFDEF PB_DEBUG}
displayDebugImgWindow(MSX2, MSY2);
drawBitmapDebugImg(bmp);
{$ENDIF}

finally
if (bmp <> -1) then
freeBitmap(bmp);
end;

if (result) then
addToSRLLog('PB_ScanPost: Found post');
end;

(**
* Author: Coh3n
* Description: Returns true if player clicks a post and the score changes.
*)
function PB_TagPost(): boolean;
var
t, x, y, oldScore: integer;
begin
if (not loggedIn()) then
exit;

oldScore := PB_GetScore();

if (PB_ScanPost(x, y)) then
begin
Mouse(x, y, 5, 5, mouse_right);

if (WaitOptionMulti(['ag', 'g P'], 618)) then
begin
t := (getSystemTime + 6000);
while (getSystemTime < t) do
begin
if (PB_GetScore() <> oldScore) then
begin
addToSRLLog('PB_TagPost: Tagged post');
result := true;
break;
end;

wait(300 + random(200));
end;
end else
MMouse(x, y - 25, 8, 8);
end;
end;

(**
* Author: DemiseScythe & Coh3n
* Description: Uses mainscreen walking to exit the random.
* Updated: Fixed for 07scape. - DannyRS - 23/03/2013
*)
function PB_Exit(): boolean;
var
x, y, t, i: integer;
tpa, tpa_Exit: TPointArray;
ATPA: T2DPointArray;
Deg: Extended;
begin

if (not loggedIn()) then
exit;
addToSRLLog('PB_Exit: Exiting cave');
SetAngle(SRL_ANGLE_HIGH);
Deg := RS_GetCompassAngleDegrees;
Wait(100 + random(50));
MakeCompass('N');
t := (getSystemTime + 25000);
repeat
// the green path color
if (findColorsTolerance(tpa, 4544055, MSX1, MMCY+10, MSX2, MSY2, 35)) then
begin
if (length(tpa) > 0) then
begin
MiddleTPAEx(tpa, x, y);
MMouse(x, y, 5, 5);
Wait(RandomRange(90,150));
if (waitUptextMulti(['Exit', 'xit', 'Cave', 'ave'], 200)) then
begin
ClickMouse2(mouse_left);
if (waitTabExists(TAB_MAGIC, 8000)) then
begin
result := true;
break;
end;
end;
end;
end;
if (findColorsTolerance(tpa, 5734757, MSX1, MMCY, MSX2, MSY2, 35)) then
if (length(tpa) > 0) then
begin
sortTPAFrom(tpa, point(MSCX, MSY2)); // center of the bottom of the MS
x := tpa[0].x;
y := tpa[0].y - 20; // so it's actually on the MS

MMouse(x, y, 5, 5);

// check for the proper uptexts
if (waitUptextMulti(['Walk', 'alk', 'here', 'ere'], 200)) then
begin
ClickMouse2(mouse_left);
end
else if (waitUptextMulti(['Exit', 'xit', 'Cave', 'ave'], 200)) then
begin
ClickMouse2(mouse_left);
if (waitTabExists(TAB_MAGIC, 8000)) then
begin
result := true;
break;
end;
end;
end;
result := tabExists(TAB_MAGIC); // just in case
wait(2000 + random(300));
until ((getSystemTime > t) or (result));
if (result) then
begin
Wait(100 + random(500));
MakeCompass(Deg);
addToSRLLog('PB_Exit: Clicked exit cave')
end else
begin
addToSRLLog('PB_Exit: Took to long to find exit... Looking for backup');
t := (getSystemTime + 20000);
MakeCompass('S');
repeat
if (FindColorsTolerance(tpa_Exit, 4677175, MSX1, MSY1, MSX2, MSY2, 23)) then
ATPA := TPAToATPAEx(tpa_Exit, 70, 5);
if (length(ATPA) > 0) then
begin
SortATPASize(ATPA, True);
for i := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 5, 5);
Wait(RandomRange(90,150));
if (waitUptextMulti(['Exit', 'xit', 'Cave', 'ave'], 200)) then
begin
ClickMouse2(mouse_left);
if (waitTabExists(TAB_MAGIC, 8000)) then
begin
result := true;
break;
end;
end;
end;
end;
result := tabExists(TAB_MAGIC);
wait(2000 + random(300));
until ((getSystemTime > t) or (result));
if (result) then
addToSRLLog('PB_Exit: Clicked exit cave with backup')
else
addToSRLLog('PB_Exit: Failed to exit')
end;
end;

(**
* Author: Coh3n & DemiseScythe
* Description: Solves the Pinball random.
*)
function PB_Solve(): boolean;
var
t: integer;
begin
if (not loggedIn()) then
exit;

t := (getSystemTime + (15 * 60000)); // maximum 15 minutes
doConversation('', false);

repeat
if (PB_GetScore = PB_SCORE_10) then // length of "Score: 10"
begin
if (PB_Exit()) then
begin
result := true;
break;
end;
end else
PB_TagPost();

wait(500 + random(200));
until(result or (getSystemTime > t));
end;

That sounds right - if you come up with fixes you should send pull requests for the include. That goes for everyone! Ideally I suppose they could be posted/tested here (or somewhere on forums) first. I know Flight had also done some work on randoms as well that I don't think was pushed to the official OSR (but it should be).

Krazy_Meerkat
12-13-2013, 04:13 AM
Edit: I fixed the frog random and a few others..
Also if there were a subforum for anti-rand development and not just this 1 thread, I'd be all over that. It's too jumbled in here to post updates for each random.. Is it too much to have a thread for each random?

Pavement
12-14-2013, 11:52 AM
Frog cave Bitmap screenshot if needed
http://imgur.com/Vs2DHJa

Krazy_Meerkat
12-14-2013, 12:58 PM
I was getting a crazy amount of randoms so I decided to post the ones that I have fixed here..

Fixed the text options for the frog random.. Credits to Flight for the conversation-handling (adapted from Frog_Solve2). I re-worked the Frog_WalkCenter method because dtm-finding no longer works on the minimap. Added compass handling. Ran it through a few times to make sure everything worked.
You can make the edits Flight recommends to FindTalk; (which handle frogs before you enter the cave) and they will not clash with the frog solver. Frog_Solve2 method is included and does not use cave-walking (because you will not be in the cave when it gets called).
frog.simba

(*
Frog
====

Stores all the routines to solve the Frog random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

*)

var
O_MouseSpeed, FROG_ISLAND_DTM, FROG_ISLAND_DTM_BACKUP, FROG_CROWN_BMP, DTM_Royal_Frog: Integer;
Deg : Extended;

const
FROG_YELLOW = 7986172;
FROG_RED = 3097339;
FROG_GREEN = 879885;
FROG_SWAMP = 8031312;
FROG_CROWN = 1095911;
FROG_CROWN_COLOR_BACKUP = 633312;

//function Frog_Speakto: boolean; forward;
function Frog_IsTalkingTo: boolean; forward;
function Frog_FindFrog: boolean; forward;

(*
DoConversationEx
~~~~~~~~~~~~~~

.. code-block:: pascal

function DoConversationEx(resultText: TStringArray; clickresult: boolean): boolean;

Goes through the initial dialog of a random. Will keep clicking to continue
until any of the conversation's 'resultText' is found. Will click to continue when
any 'resultText' is found if 'clickresult' is set to true. Set 'resultText' to ['']
to click continue until conversation is over.

.. note::

Author: Coh3n, Flight
Last Modified: Jun. 15th, 2013 by Flight

Example:

.. code-block:: pascal

if (DoConversationEx(['thank','nk you'], true)) then
writeln('Finished conversation');
*)
function DoConversationEx(resultText: TStringArray): boolean;
var
t,i: integer;
begin
while (t < 25) do // max of 25 "click to continue's"
begin
if (length(resultText) > 0) then
for i:=0 to high(resultText) do
if (findNPCChatText(resultText[i], nothing)) then
begin
result := true;
exit;
end;

// break if there's no more conversation
if (not clickContinue(true)) then
break;

wait(100 + random(200));
inc(t);
end;
end;

(**
* Author: Justin
* Description: Detects if we are in the Frog Random. Small chance it would
* fail to detect due to the frogs being off-screen, checks for Music Track too.
*)
function Frog_Detect(): boolean;
begin
if not (tabExists(TAB_MAGIC)) then
begin
if Length(GetMinimapDots('npc')) >= 4 then
if PercentBlackMM >= 35 then
if (GetMusic = 'Frooland') then
begin
Result := true;
exit;
end;
if (CountColorTolerance(FROG_GREEN, MSX1, MSY1, MSX2, MSY2, 30) >= 100) then
if (CountColorTolerance(FROG_RED, MSX1, MSY1, MSX2, MSY2, 30) >= 20) then
Result := (CountColorTolerance(FROG_YELLOW, MSX1, MSY1, MSX2, MSY2, 30) >= 5);
end;
end;

(**
* Author: Justin
* Description: Gets our player ready to solve the random.
*)
procedure Frog_Setup();
begin
if (not LoggedIn()) then
exit;
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('n');
O_MouseSpeed := MouseSpeed;
MouseSpeed := 26;
end;

(**
* Author: Xtrapsp
* Description: Loads the DTMs that are used within the random.
*)
procedure Frog_Set_DTMS;
begin
FROG_ISLAND_DTM := DTMFromString('mrAAAAHic42BgYDjJxsBwA4qvA/EpID4MxLuAeBMQtwDV9ABxNRAXA3EuEBcBcQkQ1wJxaJAdg3lx Ak4sB1SDDzMSwDAAAMr5E3M=');
FROG_ISLAND_DTM_BACKUP := DTMFromString('maQEAAHicE2RgYLjGxMDwGIjvMEHY54H4NB Sfg+KrQHwTqu4BED8H4idAfAmqfgbQnIlA3AvFE4B4CgNEfB4Q LwLipVA8H8qfDZUHqV8JxIGeNgxmRfFw7ONiARYD4RBvWzAGsf 3dLVHUIWNWoDmUYkYqYAwAAGpfKPw=');
FROG_CROWN_BMP := BitmapFromString(1, 3, 'meJyTOfnD5NxvmaOfARoQBa8=');
DTM_Royal_Frog := DTMFromString('mbQAAAHicY2VgYLgDxLeB+CYQ34OyeRgZGD gZIbQAEPMD8cpOYYbfZ1QZDs4RYziuKcbw+5wxgxxQLTpmxoLB AAB7VQzf');
end;

(**
* Author: Xtrapsp
* Description: Unloads the DTMs that were used within the random.
*)
procedure Frog_Free_DTMS;
begin
FreeDTM(FROG_ISLAND_DTM);
FreeDTM(Frog_ISLAND_DTM_BACKUP);
FreeBitmap(FROG_CROWN_BMP);
FreeDTM(DTM_Royal_Frog);
end;

(**
* Author: Xtrapsp/Justin
* Description: Walks our player to the center of the map where the
* Frog Princess is located. If the DTM fails, will use TPA failsafe.
*)
function Frog_WalkCenter: boolean;
var
TPA: TPointArray;
T, TPAX, TPAY, sx, sy: Integer;
begin
if (not loggedIn()) then
exit;
MakeCompass('N');
MarkTime(T);
repeat
if findcolortolerance(TPAX,TPAY,5861233, MMX1+random(MMX2-MMX1-2), MMY1+random(MMY2-MMY1-2), MMX2, MMY2, 19) then
if (findcolortolerance(sx,sy,FROG_SWAMP, TPAX - 30, TPAY, TPAX - 15, TPAY, 19) and findcolortolerance(sx,sy,FROG_SWAMP, TPAX + 30, TPAY, TPAX + 45, TPAY, 19)) then
begin
Mouse(TPAX, TPAY-4, 4, 2, mouse_Left);
addToSRLLog('Frog_WalkCenter: Moving to center of cave');
wait(600 + Random(120));
FFlag(0);
result := true;
addToSRLLog('Frog_WalkCenter[Main]: result: ' + BoolToStr(result));
break;
end;
wait(100+random(50));
until(timeFromMark(T) > 6000);
if (not(result = true)) then
begin
addToSRLLog('Frog_WalkCenter: Unable to find main DTM, Falling back onto backup');
if (FindColorsTolerance(TPA, FROG_SWAMP, MMX1, MMY1, MMX2, MMY2, 50)) then
begin
MiddleTPAEx(TPA, TPAX, TPAY);
Mouse(TPAX, TPAY, 8, 8, mouse_Left);
wait(600 + Random(120));
FFlag(0);
result := true;
addToSRLLog('Frog_WalkCenter[Backup]: result: ' + BoolToStr(result));
end;
end;
end;

(**
* Author: Xtrapsp/Justin
* Description: Finds the Frog Princess via DTM with a TPA failsafe.
* If the DTM fails, it will rotate the camera just incase the Frog Princess
* is off the screen.
*)
function Frog_FindFrog: boolean;
var
T, Attempt, tmpCTS, i, fx, fy, arL: integer;
arP: TPointArray;
ararP: T2DPointArray;
P: TPoint;
begin
addToSRLLog('Frog_FindFrog: Attempting to find the Frog Princess');
Marktime(T);
tmpCTS := GetColorToleranceSpeed;
repeat
if FindDTM(DTM_Royal_Frog, fx, fy, MSx1, MSy1, MSx2, MSy2) then
begin
MMouse(fx-2, fy-2, 2, 2);
if WaitUpTextMulti(['Frog','to Fr'], 300) then
begin
Writeln('Frog_Solve2: Found royal frog');
ClickMouse2(mouse_right);
Wait(randomRange(100,250));
result := waitOptionMulti(['Talk-to Frog','to Fr','Frog'], 500);
if result then
begin
Writeln('Frog_Solve2: Talking to royal frog...');
break
end else
MouseBox(MCx1, MCy1, MCx2, MCy2, mouse_move);
end;
end;
if not result then
begin
if FindBitmapToleranceIn(FROG_CROWN_BMP, fx, fy, MSX1, MSY1, MSX2, MSY2, 40) then
begin
MMouse(fx, fy, 4, 4);
addToSRLLog('Frog_FindFrog: Checking multi uptext');
wait(150 + random(100));
if (IsUpTextMultiCustom(['Frog', 'Talk', 'rog'])) then
begin
ClickMouse2(mouse_Right);
Result := WaitOptionMulti(['Talk-to', 'alk-t', 'Frog', 'rog'], 800);
addToSRLLog('Frog_FindFrog[Backup]: result: ' + BoolToStr(result));
wait(600 + Random(120));
FFlag(0);
if (result) then
addToSRLLog('Frog_FindFrog: Found Frog Princess');
exit;
end else
addToSRLLog('Frog_FindFrog: Could not find uptext');
end else
begin
addToSRLLog('Frog_FindFrog: Could not find Frog Princess. Falling onto backup');
MakeCompass(rs_GetCompassAngleDegrees + RandomRange(85, 95));
wait(800+Random(400));
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.76);
if (FindColorsTolerance(arP, FROG_CROWN, MSX1, MSY1, MSX2, MSY2, 12)) then
begin
addToSRLLog('Frog_FindFrog: Found TPA color, Moving mouse to TPA');
SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arP, 8, 8);
arL := High(ararP);
for i := 0 to arL do
begin
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
addToSRLLog('Frog_FindFrog: Checking multi uptext');
Wait(100 + Random(100));
if (IsUpTextMultiCustom(['Frog', 'Talk', 'rog'])) then
begin
ClickMouse2(mouse_Right);
Result := WaitOptionMulti(['Talk-to', 'alk-t', 'Frog', 'rog'], 500);
addToSRLLog('Frog_FindFrog[Backup]: result: ' + BoolToStr(result));
wait(600 + Random(120));
FFlag(0);
exit;
end else
addToSRLLog('Frog_FindFrog: Could not find uptext');
end;
end else
addToSRLLog('Frog_FindFrog[Backup]: Unable to find TPA');
end;
end;
Inc(Attempt);
addToSRLLog('Frog_FindFrog: Attempt: ' + inttostr(Attempt));
until ((Attempt > 5) or (Result));
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
exit;

end;

{(**
* Author: Xtrapsp/Justin
* Description: Handles talking to the Frog Princeess.
*)
function Frog_SpeakTo: boolean;
var
T, Attempt: integer;
TPA: TPointArray;
begin
addToSRLLog('Frog_SpeakTo: Attempting to speak to the Frog Princess');
Marktime(T);
repeat
if ClickDTMRotatedIn(FROG_CROWN_DTM, MSX1, MSY1, MSX2, MSY2, - Pi, Pi, Pi / 30, ['rog'], mouse_Left) then
begin
addToSRLLog('Frog_SpeakTo: Found Frog Princess, Clicking Frog Princess');
result := true;
addToSRLLog('Frog_SpeakTo[Main]: result: ' + BoolToStr(result));
Wait(3500 + Random(1000));
exit;
end
else
begin
addToSRLLog('Frog_SpeakTo: Could not find Frog Princess. Falling onto backup');
if (FindColorsSpiralTolerance(MSCX, MSCY, TPA, FROG_CROWN_COLOR_BACKUP, MSX1, MSY1, MSX2, MSY2, 25)) then
begin
Mouse(TPA[0].X, TPA[0].Y, 2, 2, mouse_Move);
if IsUpTextMultiCustom(['Frog', 'Talk', 'rog']) then
ClickMouse2(mouse_Left);
wait(600 + Random(120));
FFlag(0);
Result := true;
addToSRLLog('Frog_SpeakTo[Backup]: result: ' + BoolToStr(result));
end;
end;
Inc(Attempt);
MakeCompass(rs_GetCompassAngleDegrees + RandomRange(85, 95));
until ((Attempt > 20) or (Frog_IsTalkingTo))
if (Attempt > 20) then
Frog_WalkCenter;
exit;
end;}

(**
* Author: Xtrapsp/Justin
* Description: Detects if we are talking to the Frog Princess or just a Frog.
*)
function Frog_IsTalkingTo: boolean;
var
T, ft, i, Attempt: integer;
responses: TStringArray;
begin
addToSRLLog('Frog_IsTalkingTo: Speaking to the Frog Princess');
responses := ['very','orry','hange','lrigh','Okay','kay.','I supp','pose so','yeah','Yeah','Sure','ure'];
MarkTime(ft);
repeat
if areTalking then break;
wait(100+random(50));
until(timeFromMark(ft) > 6000);
MarkTime(ft);
repeat
if DoConversationEx(responses) then
begin
Writeln('Frog_Solve2: Reached response');
for i:=0 to High(responses) do
if findTextTPA(0, 5, MCx1, MCy1, MCx2, MCy2, responses[i], CharsNPC07, ClickLeft) then
begin
Writeln('Frog_Solve2: Chose correct option');
ClickToContinue;
break;
end;
end;
until(timeFromMark(ft) > 15000);

MarkTime(ft);
repeat
if (not(Frog_Detect())) then
begin
Result := True;
Writeln('Frog_Solve2: Successfully solved the Frog random!');
break;
end;
Wait(100 + Random(50));
until(timeFromMark(ft) > 10000);

if not result then
begin
repeat
Result := FindNPCChatText('Hmph. Have you come to apologize for ignoring me?', Nothing);
if (not(result)) then result:= FindNPCChatText('change', Nothing);
if (Result or (Attempt > 6)) then
begin
addToSRLLog('Frog_IsTalkingTo[backup]: Continuing to chat to Frog Princess');
Wait(1000 + Random(500));
DoConversation('', true);
Wait(1100 + Random(500));
Mouse(137, 399, 252, 7, True);
Wait(1100 + Random(500));
Mouse(153, 449, 130, 5, True);
Wait(1100 + Random(500));
Mouse(243, 450, 130, 4, True);
Wait(2100 + Random(1500));
exit;
end
else
addToSRLLog('Frog_IsTalkingTo[backup]: Could not continue chat with Frog Princess');
until ((Attempt > 7) or (TimefromMark(T) > 50000) or Result);
end;
if (Attempt > 7) then
begin
addToSRLLog('Frog_IsTalkingTo: Attempts are greater than 5');
Wait(3000 + Random(1000));
result := false;
end;
end;

(**
* Author: Justin & Flight
* Modified by: Krazy_Meerkat
* Description: Handles solving the random event.
*)
function Frog_Solve2(): boolean;
begin
if (not loggedIn()) then
exit;
Deg := RS_GetCompassAngleDegrees;
Wait(100 + random(50));
Frog_Setup();
if Frog_FindFrog then
result := Frog_IsTalkingTo;
MouseSpeed := O_MouseSpeed;
if (not result) then
addToSRLLog('Frog_Solve2: Frog solver failed or timed out');
MakeCompass(Deg);
end;

(**
* Author: Justin
* Description: Handles solving the random event.
*)
function Frog_Solve(): boolean;
var
t: integer;
begin
if (not loggedIn()) then
exit;
Deg := RS_GetCompassAngleDegrees;
Wait(100 + random(50));
t := (getSystemTime + (10 * 60000));
Frog_Setup();
repeat
if Frog_WalkCenter then
if Frog_FindFrog then
result := Frog_IsTalkingTo;
until (result or (getSystemTime > t));
MouseSpeed := O_MouseSpeed;
if (not result) then
addToSRLLog('Frog_Solve: Frog solver failed or timed out');
MakeCompass(Deg);
end;

Fixed the pillory cage random. Object scanning was freezing up and returning low values for the locks, added wait times and minimum value requirements. Fixed compass angle issues. Edit: Improved cage-finding routine.
pillory.simba

(*
Pillory
=======

Stores all the routines to solve the Pillory random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses color counting to determine the shape
of the lock and which key to use.

*)

procedure PL_Message(Message: string);
begin
addToSRLLog('[Pillory Random] ' + Message);
end;

function PL_LockScreen: Boolean;
begin
Result := (LoggedIn and (GetColor(497, 34) = 65536));
end;

function PL_Detect: boolean;
var
tpa: TPointArray;
begin
if (not TabExists(TAB_OPTIONS)) and (TabExists(TAB_FRIENDS)) then
begin
// red doors of the cages
FindColorsTolerance(tpa, 235, MMCX - 15, MMCY - 15, MMCX + 15, MMCY + 15, 20);
Result := (inRange(length(tpa), 3, 18));
end;
end;

(**
* Author: DannyRS
* Last modified 15/03/2013 By DannyRS
* Description: Opens Cage Interface
*)
function PL_ClickCage: Boolean;
var
t, x, y: Integer;
begin
Result := False;

t := GetSystemTime;

if (not LoggedIn) then Exit;

Result := PL_LockScreen;

if (not Result) then
begin
repeat
x:= MSCX;
y:= MSCY;
if (not(IsUpTextMultiCustom(['Unlock','lock','Cage','age']))) then
if FindColorSpiralTolerance(x, y, 9738912, MSX1, MSY1, MSX2, MSY2, 19) or FindColorSpiralTolerance(x, y, 1118484, MSX1, MSY1, MSX2, MSY2, 19) then
begin
MMouse(x,y,4,4);
end else
MMouse(243,143,80,65);

Wait(RandomRange(90, 270));

if (IsUpTextMultiCustom(['Unlock','lock','Cage','age'])) then
begin
ClickMouse2(mouse_left);
if (waitFunc(@PL_LockScreen, 50, 5000)) then
begin
PL_Message('[PL_ClickCage] Opened Lock Screen');
Wait(RandomRange(190, 270));
Result := True;
end else
PL_Message('[PL_ClickCage] Failed to open Lock Screen');
end else
MMouse(243,143,80,65);
until (Result) or (GetSystemTime - t > 38000);
end;
end;

(**
* Author: DannyRS
* Last modified 15/03/2013 By DannyRS
* Description: Clicks a key 0-2
*)
function PL_ClickKey(Slot: Integer): Boolean;
var
p: TPoint;
begin
Result := False;

if (not PL_LockScreen) then Exit;

p := Point(209 + (Slot*93), 251);

MMouse(RandomRange(p.x - 2, p.x + 2), RandomRange(p.y - 4, p.y + 4), 0, 0);

ClickMouse2(mouse_left);

Result := True;
end;

(**
* Author: DannyRS
* Last modified 9/04/2013 By DannyRS
* Description: Scans for lock type
*)
function PL_GetLock: String;
var
CNum,Count,CountTime,WatchTime: Integer;
begin
Result := '';
WatchTime := RandomRange(9000,10000);
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.21, 2.01);
MarkTime(CountTime);
Count:= 100;
repeat
CNum := CountColorTolerance(1057067, 60, 65, 150, 150, 10);
if (CNum > Count) then
Count := CNum;
wait(50 + random(50));
until (TimeFromMark(CountTime) > WatchTime);
if (Count > 800) and (Count < 1000) then Result := 'square';
if (Count > 570) and (Count < 799) then Result := 'triangle';
if (Count > 400) and (Count < 569) then Result := 'diamond';
if (Count > 1001) and (Count < 1600) then Result := 'circle';
PL_Message('[PL_GetLock] Lock Found: ' + Result + ' [' + ToStr(Count) + ']');
end;

(**
* Author: DannyRS
* Last modified 9/04/2013 By DannyRS
* Description: Scans for key types
*)
function PL_GetKeys: TStringArray;
var
C1,C2,C3,CNum,Count,WatchTime: Integer;
begin
SetLength(Result, 3);

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.43, 2.81);

MarkTime(WatchTime);
Result[0] := '';
Count := 100; CNum := 0;
repeat
CNum := CountColorTolerance(1516846, 180, 170, 235, 260, 7);

case CNum of
286: Result[0] := 'triangle';
493: Result[0] := 'diamond';
506: Result[0] := 'circle';
729: Result[0] := 'square';
end;

if (CNum > Count) then
Count := CNum;
wait(50 + random(50));

until (not (Result[0] = '')) or (TimeFromMark(WatchTime) > 10000);

if (Result[0] = '') then
begin
if InRange(Count, 250, 350) then Result[0] := 'triangle';
if InRange(Count, 400, 500) then Result[0] := 'diamond';
if InRange(Count, 501, 600) then Result[0] := 'circle';
if InRange(Count, 670, 1300) then Result[0] := 'square';
end;

C1 := Count;

MarkTime(WatchTime);
Result[1] := '';
Count := 100; CNum := 0;
repeat
CNum := CountColorTolerance(1516846, 265, 170, 345, 260, 7);

case CNum of
286: Result[1] := 'triangle';
493: Result[1] := 'diamond';
506: Result[1] := 'circle';
729: Result[1] := 'square';
end;

if (CNum > Count) then
Count := CNum;
wait(50 + random(50));

until (not (Result[1] = '')) or (TimeFromMark(WatchTime) > 10000);

if (Result[1] = '') then
begin
if InRange(Count, 250, 350) then Result[1] := 'triangle';
if InRange(Count, 400, 500) then Result[1] := 'diamond';
if InRange(Count, 501, 600) then Result[1] := 'circle';
if InRange(Count, 670, 1300) then Result[1] := 'square';
end;

C2 := Count;

MarkTime(WatchTime);
Result[2] := '';
Count := 100; CNum := 0;
repeat
CNum := CountColorTolerance(1516846, 365, 170, 430, 260, 7);

case CNum of
286: Result[2] := 'triangle';
493: Result[2] := 'diamond';
506: Result[2] := 'circle';
729: Result[2] := 'square';
end;

if (CNum > Count) then
Count := CNum;
wait(50 + random(50));

until (not (Result[2] = '')) or (TimeFromMark(WatchTime) > 10000);

if (Result[2] = '') then
begin
if InRange(Count, 250, 350) then Result[2] := 'triangle';
if InRange(Count, 400, 500) then Result[2] := 'diamond';
if InRange(Count, 501, 600) then Result[2] := 'circle';
if InRange(Count, 670, 1300) then Result[2] := 'square';
end;

C3 := Count;

PL_Message('[PL_GetKeys] Keys Found: '+
Result[0]+' ['+IntToStr(C1)+']'+' '+
Result[1]+' ['+IntToStr(C2)+']'+' '+
Result[2]+' ['+IntToStr(C3)+']');
end;

(**
* Author: DannyRS
* Last modified 15/03/2013 By DannyRS
* Description: Solves the Pillory Random Event
*)
function PL_Solve: Boolean;
var
i, t, keysolves, tmpCTS: Integer;
tmpHM, tmpSM, Deg: Extended;
lock: String;
keys: TStringArray;
begin
Result := False;
keysolves := 0;

tmpCTS := GetColorToleranceSpeed;
GetToleranceSpeed2Modifiers(tmpHM, tmpSM);

if (not LoggedIn) then Exit;

t := GetSystemTime;

Deg := RS_GetCompassAngleDegrees;
Wait(100 + random(50));
MakeCompass('N');
//if (not PL_ClickCage) then Exit;

repeat

Result := (TabExists(TAB_OPTIONS));
if (Result) then Break;

// open the lock screen if it's not already open
if (not PL_LockScreen) then PL_ClickCage;

lock := PL_GetLock;
keys := PL_GetKeys;

for i := 0 to 2 do
if (keys[i] = '') then
begin
PL_Message('[ERROR] [PL_GetKeys] Failed to get all keys');
Break;
end;

if (lock = '') then
begin
PL_Message('[ERROR] [PL_GetLock] Failed to get lock type');
Continue;
end;

for i := 0 to 2 do
if (keys[i] = lock) then
begin
PL_Message('[PL_Solve] Clicking key : ' + keys[i]);
if PL_ClickKey(i) then
begin
keysolves := keysolves + 1;
Wait(RandomRange(1500, 2000));
end;
end;

Result := ((keysolves > 2) and (not PL_LockScreen)) or
(TabExists(TAB_OPTIONS));

until (Result) or (GetSystemTime - t > 120000);

if (Result) then MakeCompass(Deg);

SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(tmpHM, tmpSM);

if (not Result) then
begin
if (GetSystemTime - t > 120000) then
PL_Message('[ERROR] Pillory solver timed out');
end else
Wait(RandomRange(800, 1200));
end;

Fixed the drill demon random. Added 1 new bitmap for each sign, had no problems detecting all 4. Ran it through a few times, changing worlds to test colour difference.
demon.simba

(*
Drill Demon
===========

Stores all the routines to solve the Drill Demon random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses Deformed BMPs to locate the signs
to solve the Drill Demon (Sergeant Damien) random.

*)

procedure DD_Message(Message: String);
begin
addToSRLLog('[DemonDrill Random] ' + Message);
end;

function DD_Detect(): Boolean;
begin
if (not TabExists(TAB_OPTIONS)) and (not TabExists(TAB_EMOTES)) then
Result := (GetMusic = 'CorPoral Punisbment');
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Moves the player back to the center of the random
* Note: Inspired by Le Jingle
*)
function DD_ResetPosition: Boolean;
var
WallTPA: TPointArray;
WallATPA: T2DPointArray;
tb: TBox;
p: TPoint;
//pa: TPointArray;
begin
Result := False;

if (not LoggedIn) then Exit;

SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);
FindColorsTolerance(WallTPA, 15593957, 600, 58, 690, 110, 70);
SplitTPAExWrap(WallTPA, 5, 5, WallATPA);
SortATPASize(WallATPA, True);

if (Length(WallATPA) < 1) then Exit;

//SMART_DrawBoxEx(True, False, WallATPA[0], clGreen);

tb := GetTPABounds(WallATPA[0]);
p := MiddleBox(tb);

//Seems white alone is accurate enough to leave this out - Danny
//pa := GetMiniMapDots('yellow');
//if (Length(pa) < 1) then Exit;
//if (not PointInBox(pa[0], tb)) then Exit;

MMouse(p.x, RandomRange(p.y, p.y + 2), 0, 0);
ClickMouse2(mouse_left);

Wait(RandomRange(300, 400));
Flag;
Wait(RandomRange(800, 1200));

Result := True;
end;

function DD_TalkingToDemon: Boolean;
begin
Result := (Trim(GetNPCChatName) = 'SergeantDamien');
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Talks to Sergeant Damien
*)
function DD_TalkDemon: Boolean;
var
DemonTPA: TPointArray;
DemonATPA: T2DPointArray;
x, y, i, Attemps: Integer;
begin
Result := False;

if (DD_TalkingToDemon) then
begin
Result := True;
Exit;
end;

repeat

if (Attemps > 6) then Break;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.15, 1.61);
FindColorsTolerance(DemonTPA, 994406, MSX1, MSY1, MSX2, MSY2, 16);
SplitTPAExWrap(DemonTPA, 50, 100, DemonATPA);
SortATPASize(DemonATPA, True);

if (Length(DemonATPA) < 1) then
begin
Attemps := Attemps + 1;
Wait(RandomRange(200, 400));
Continue;
end;

for i := 0 to High(DemonATPA) do
begin
if (Length(DemonATPA[i]) < 50) then Continue;
MiddleTPAEx(DemonATPA[i], x, y);
MMouse(RandomRange(x - 5, x + 5), RandomRange(y - 5, y + 5), 0, 0);
ClickMouse2(mouse_right);
Wait(RandomRange(30, 50));
if (ChooseOptionMulti(['Talk','alk-to'])) then
begin
if (WaitFunc(@DD_TalkingToDemon, 50, 25000)) then
begin
DD_Message('[DD_TalkDemon] Talked to demon');
Result := True;
Exit;
end else
DD_Message('[DD_TalkDemon] Failed to Talked to demon');
end;
end;
Attemps := Attemps + 1;

until (Result) or (Attemps > 6);
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Gets the TBoxes of the green signs
*)
function DD_GetSigns: TBoxArray;
var
ESignsTPA: TPointArray;
ESignsATPA: T2DPointArray;
SignsSorted: Boolean;
i: Integer;
begin
SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);
FindColorsTolerance(ESignsTPA, 4553552, MSX1, MSY1, MSX2, MSY2, 30);
SplitTPAExWrap(ESignsTPA, 70, 60, ESignsATPA);

repeat
SignsSorted := True;
for i := 0 to High(ESignsATPA) do
begin
if (Length(ESignsATPA[i]) < 5) then
begin
DeleteValueInATPA(ESignsATPA,i);
SignsSorted := False;
Break;
end;
end;
until (SignsSorted);

SetLength(Result, Length(ESignsATPA));

for i := 0 to high(ESignsATPA) do
begin
Result[i] := GetTPABounds(ESignsATPA[i]);
end;

DD_Message('[DD_GetSigns] Number of signs located : ' +
IntToStr(Length(ESignsATPA)));
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description:
* Compares bitmaps to the signs and tries to
* return it's position, roughly centered
*)
function DD_FindSign(WhichSign: String): TPoint;
var
SB: TBoxArray;
x, y, i, ib, hb: Integer;
Saccuracy: Extended;
SBMP: TIntegerArray;
begin
Result := Point(-1, -1);

SB := DD_GetSigns;
if (Length(SB) < 1) then Exit;

SetLength(SBMP, 3);

hb := High(SBMP);

SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);

case LowerCase(WhichSign) of
'jog': begin
SBMP[0] := BitmapFromString(14, 15, 'meJxzrw1KnFAOQe5IbAgXDRGvEo' +
'6y5zQDEVw7Vlk4wm8UmktooRJNMS4PojkVlxq4p5BDDKsaTBu RVWI' +
'qw2UvVmUE44VaiolMEkAEAE9f+0k=');
SBMP[1] := BitmapFromString(26, 17, 'meJxzqwl0w0AJfWUQhMYmD2E1jR' +
'IDIShrdhMQwa2grmlkGwgxB4IodxVaMFLXNGQDKYwRNM+SHcv IQQf' +
'XS57b0CICOQVSYhSmH8k2jSrxOJhNc0PNVhQiKhYdbuQmKgBk SPbW');
SBMP[2] := BitmapFromString(29, 10, 'meJxzrQ5wJRrF9ZUSr3gwGItsMh' +
'qXbJQ5qxGI4EZRxViImRBjIaZRbizcTGR3UmgsmpnUCltcxlI rVKl' +
'rLNxk4tUDAIc3Qs8=');
end;
'starjumps': begin
SBMP[0] := BitmapFromString(16, 16, 'meJxzrw1yx0CJE8ohCFMKK4Krx9' +
'SSu7AdiEg1H6su/GogXPwIlyHEqMSlnhhH0kg9hS6nonqsyrBqgcQ' +
'7LjOJUY/VXswEhifGkZMfAK38Sfc=');
SBMP[1] := BitmapFromString(33, 17, 'meJxzqwl0Ixol9JUBEfHqSUUQ8+' +
'lmC4Xm5CxohSNaqMeqkSCilo+objhBu6ge0cPAClrHAi4rqGg LHZI' +
'TprHUtQWXsym3Al4Q4XIwsjh5pRa8uMPjWmTzyS4Y4bbgCUZi SngA' +
'a5KX0w==');
SBMP[2] := BitmapFromString(37, 16, 'meJxzrQ5wJR3F9ZXCERnacaHs+S' +
'34raOiXXAbIYjqJhNjKfGIPjbSx5t0C1U6RyI97Ro21tEtNdL HOuR' +
'iCtN8qtuIXDBiNZlGHgQiXMbSIgbh1uGJUyKrJAA7N7QN');
end;
'situps': begin
SBMP[0] := BitmapFromString(32, 12, 'meJxzrwl0R0U5C9uAyB1DnCoIYj' +
'gdzCfPCoK6KDGfoC5kw0m1ghgtmOYTaQWRWpAVEG8+msm4tGA qI9I' +
'KrBoJBiDWsCKIsJqf0F8GRJiuJcN8ZKOQDYeLE4xugobDzYew SUoY' +
'xBiObD7QBABMTOo0');
SBMP[1] := BitmapFromString(36, 14, 'meJxzqwl0GwQoZ0ErENHNIgrtIl' +
'I73C7yrCNeL7JFZNhFkl40u0iyjiSNmBYRbxepepHVUBIaboR SMpr' +
'J+O3C6gus2km1i3gE0ZvQV0aMO4lxOR4EtAWCkEXgZqJJUWIX 3CKs' +
'BqLJEh8pBO1C9g6dEQA0UXaL');
SBMP[2] := BitmapFromString(37, 16, 'meJxzrQ5wHRwoe34LENHTLgqtI1' +
'473DqybSReL7Jd5FlHkl4060i1kSSNmHaRZB2pepGVkWojmnq CGtE' +
'MpyRYiLcOf8ASg4hJMJiyZFsX11cKRMhcuJkQKbgswWRDpF3I 1mHa' +
'BZElJpUSaRcEkZSDyLCRVPOHEwIAf3vRcQ==');
end;
'pushups': begin
SBMP[0] := BitmapFromString(37, 16, 'meJxzrw1KnFAOQe61QXRAdLZuYF' +
'HuwnYIoqddyIjO1tHIakwzaWc1HkNoYSlB7VQMZ+K1ELSUGHM ocSF' +
'J9sKLFMpjgZ6pmnaJihJ7aWcjWmTRoQrAtAsAxiXG8w==');
SBMP[1] := BitmapFromString(39, 16, 'meJxzqwl0qwlM6CuDIDcwlz5oYC' +
'2ls73IKGdBKwTR30ZkNCCW0tQBBG2kugOwmkZre/GbQwt7iTeEin6' +
'nRAsZboCUCZSEFalpD7ksonpqHFRZntb2okUina1DthEAClrm ig==');
SBMP[2] := BitmapFromString(43, 16, 'meJxzrQ5wBaO4vlI4coUJ0hMhO2' +
'Cg3ICJsue3ANHA2o6MBtZ2OjuGoANo6hhMk+npBjxm0scNBE2 jaWg' +
'QbwiNkgcZuqiSVuEFICUBOLAZh57phFqOoacb0OJ6AK3GtB0A juAl' +
'9Q==');
end;
end;

for i := 0 to High(SB) do
begin
for ib := 0 to hb do
begin
if (Result.X > 0) or (Result.Y > 0) then Break;
if (SB[i].X1 > SB[i].X2) or (SB[i].Y1 > SB[i].Y2) then Continue;

if FindDeformedBitmapToleranceIn(SBMP[ib], x, y, SB[i].X1-2, SB[i].Y1-2,
SB[i].X2+2, SB[i].Y2+2, 2, 4, False, Saccuracy) then
begin
Result := Point(x + 20, y + 7);
DD_Message('[DD_FindSign] Matching sign found at : ' + ToStr(Result));
Break;
end;
end;
end;

for ib := 0 to hb do
FreeBitmap(SBMP[ib]);
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Attemps to solve the Drill Demon random
*)
function DD_Solve(): boolean;
var
p: TPoint;
t, tmpCompass, tmpCTS, MMoves, debugColorCount: Integer;
tmpHM, tmpSM: Extended;
MatName, LastMatt: String;
begin
Result := False;

if (not LoggedIn) then Exit;

t := GetSystemTime;

tmpCTS := GetColorToleranceSpeed;
GetToleranceSpeed2Modifiers(tmpHM, tmpSM);
tmpCompass := Round(rs_GetCompassAngleDegrees);

SetAngle(SRL_ANGLE_LOW);
MakeCompass('N');

repeat

Result := TabExists(TAB_MAGIC);

if (Result) then Break;

if (not DD_TalkDemon) then
begin
DD_ResetPosition;
Continue;
end;

Wait(RandomRange(1200, 1600));

debugColorCount := CountColor(0, MCX1, MCY1, MCX2, MCY2);
case debugColorCount of
687,988,691 : MatName := 'jog';
707,711 : MatName := 'starjumps';
569,573 : MatName := 'situps';
637,938,641 : MatName := 'pushups';
else
begin
ClickToContinue;
Wait(RandomRange(1200, 1500));
Continue;
end;
end;
DD_Message('[DD_Solve] Last color count: ' + inttostr(debugColorCount));
LastMatt := '';
if (LastMatt = MatName) then
begin
MMoves := 0;

DD_Message('[DD_Solve] Already standing on the matt : ' + MatName);
DD_Message('[DD_Solve] Using matt : ' + MatName + ' again');

repeat
MMouse(246, 184, 40, 30);
MMoves := MMoves + 1;
Wait(RandomRange(90, 340));
if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
begin
ClickMouse2(mouse_right);
Wait(RandomRange(40, 90));
if (ChooseOptionMulti(['Use'])) then
begin
Wait(RandomRange(1200, 1500));
if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
begin
DD_Message('[DD_Solve] Used matt successfully');
LastMatt := MatName;
Break;
end else
begin
DD_Message('[ERROR] Failed to use matt');
Break;
end;
end;
end;
until (MMoves > 10);

Continue;
end;

DD_Message('[DD_Solve] Walking to center to search for sign');

if (not DD_ResetPosition) then
begin
DD_Message('[ERROR] Failed to walk to center');
Continue;
end;

DD_Message('[DD_Solve] Searching for sign : ' + MatName);

p := DD_FindSign(MatName);

if (p.x < 0) or (p.y < 0) then
begin
DD_Message('[ERROR] Failed to find sign : ' + MatName);
Continue;
end;

MMoves := 0;

DD_Message('[DD_Solve] Searching for matt : ' + MatName);

repeat

MMouse(p.x - 10, p.y + 64, 50, 30);

//SMART_DrawBoxEx(True,False,IntToBox(p.x-10,p.y+64,p.x+40,p.y+94),clGreen);

MMoves := MMoves + 1;
Wait(RandomRange(90, 340));
if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
begin
ClickMouse2(mouse_right);
Wait(RandomRange(40, 90));
if (ChooseOptionMulti(['Use'])) then
begin
Wait(RandomRange(1200, 1500));
if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
begin
DD_Message('[DD_Solve] Used matt successfully');
LastMatt := MatName;
Break;
end else
begin
DD_Message('[ERROR] Failed to use matt');
Break;
end;
end;
end;
until (MMoves > 10);

Result := TabExists(TAB_MAGIC);

until (Result) or (GetSystemTime - t > 240000);

if (not Result) then
begin
if (GetSystemTime - t > 240000) then
DD_Message('[ERROR] DrillDemon solver timed out');
end else
Wait(RandomRange(1200, 1600));

SetAngle(SRL_ANGLE_HIGH);
MakeCompass(tmpCompass);

SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(tmpHM, tmpSM);
end;

Fixed the strange box random. Changed dtm-finding to bmptol-finding for the box item, fast and accurate. Added wait times to the item and number scanning, getting a much higher solve rate, roughly 85% and significantly less extra boxes from in-game time-outs. Call it with SolveBox; because it's not included in the normal random-finding routines.
box.simba

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ? Box Routines --//
//-----------------------------------------------------------------//
// * function GambleBox: Boolean; // * by WT-Fakawi
// * function GetBoxSide: Integer; // * by pups/Ashaman88
// * function GetQuestion(var num: Integer; var shape: string): Integer; // * by pups
// * function GetNumber: Integer; // * by Ashaman88
// * function GetShape: String; // * by Ashaman88
// * function OpenBox: Boolean; // * by Ashaman88
// * function SolveBox: Boolean; // * by Ashaman88

//{$I SRL-OSR/SRL/misc/Debug.Simba}
//{$I SRL-OSR/SRL/misc/SmartGraphics.Simba}
var
NumberBounds: TBox;

const
DebugBox=False;

{************************************************* ******************************
function GambleNewBox: Boolean;
by: WT-Fakawi (left this in here just in case we want to guess)
Description: A random box clicker. Will try to solve the box ONCE, by a random click
@ any of the three answers. THIS IS NOT A BOXSOLVER, JUST A BOXCLICKER!
************************************************** *****************************}

function GambleBox: Boolean;
var
xb, yb, Choise: Integer;
begin
//if FindBitmapToleranceIn(Box, xb, yb, MIX1, MIY1, MIX2, MIY2, 40) then
begin
Mouse(xb, yb, 0, 0, True);
Wait(2000);
Choise:= Random(3);
TakeScreen('Gambling box Choise - '+IntToStr(Choise));
case Choise of
0: Mouse(145, 295, 4, 4, True);
1: Mouse(270, 295, 4, 4, True);
2: Mouse(381, 295, 4, 4, True);
end;
IdleTime(4000, 2000, 1.0);
// if FindBitmapToleranceIn(Box, xb, yb, MIX1, MIY1, MIX2, MIY2, 40) then
begin
WriteLn('Box Missed');
// NOnewboxes := NOnewboxes + 1;
Result := False;
repeat
Logout;
until (not (LoggedIn));
Exit;
end
//else
begin
WriteLn('Box solved');
// newboxes := newboxes + 1;
Result := True;
end;
end;
end;

{************************************************* ******************************
function OpenBox: Boolean;
by: Ashaman88
Description: Opens the box.
************************************************** *****************************}

function OpenBox : Boolean;
var
x, y, i : Integer;
SBMP: TIntegerArray;
begin
Result := False;
SetLength(SBMP, 1);
GameTab(Tab_Inv);
Wait(100 + Random(50));
SBMP[0] := BitmapFromString(22, 15, 'meJxzdHR3BCMbGycgGR2dTBDp6h' +
'pCtISHxwMRXDsxejG1oyFHmHuwOkZeXhFNb3BwFFZzsBoIR3D ZsrJ' +
'GIMJvAi4E0YtsgpdXILIgENnbu0AQMHwgCKt2PCagISsre/wm+PgG' +
'D7gJfv5hA25CQGDEgJsATJwDYgJcBAD7lYWZ');
if FindBitmapToleranceIn(SBMP[0], x, y, MIX1, MIY1, MIX2, MIY2, 40) then
begin
Mouse(x, y, 4, 4, True);
for i := 0 to 9 do
begin
if (GetColor(487, 39) = 13567) and (GetColor(350, 295) = 2304814) then
begin
Result := True;
Break;
end;
Wait(500 + Random(50));
end;
end;
FreeBitmap(SBMP[0]);
end;

type
NumberRotate = record
Number, DTM, BMin, BMax, WMin, WMax: integer;
end;
NumberRotateArray = array of NumberRotate;

var
NumberArray: NumberRotateArray;

{************************************************* ******************************
procedure LoadNumbers;
by: Ashaman88
Description: Loadsup all the numbers!
************************************************** *****************************}

procedure LoadNumbers;
begin
if Length(NumberArray)<>0 then
Exit;

SetLength(NumberArray,10);

with NumberArray[0] do {Good2}
begin
Number := 0;
DTM := DTMFromString('mYQMAAHic1c5bCsIwFIThExWr9YJ2F766D9 9dhptRRFREii0i7jDgBH8xFIX2TQMfpyQzaWZm1nNmiXvPvqQf hP2xjGRAtiudSEJ2iJDPZIoJ/VfP4KSFNudp1N8rdpJcLlIyc/aP9sycmTvZIu6G3hVlpR++C87uuFVyh+juNTb8w3tf22q5aKzJ/d/M9c5f5/5A7fUAGciE0g==');
BMin := 125;
BMax := 215;
WMin := 160;
WMax := 30;
end;

with NumberArray[1] do {Good}
begin
Number := 1;
DTM := DTMFromString('mggAAAHicY2NgYGBigABmIGaBshmBmA+Iua FYCirOAcT1mXEMf//8AWMQG4aNgHLYMBMODAEARdcMkQ==');
BMin := 85;
BMax := 130;
WMin := 0;
WMax := 100;
end;

with NumberArray[2] do {Good2}
begin
Number := 2;
DTM := DTMFromString('mygMAAHic1c5bCoJQFIXh43uWkdnNaAY9NK OG0Dyigkq7XyypqCkK/dESojepF4WP7dlu1z5dY4xjGVOGi6pUrHe/BBsFVVt9R72XouZraEgdnjLTLE/ffElnWzp3VNuqTWW6+t9XbnoOufsMcyywxh4RYhxwwgZLrLBFg CnGmOg90MwOR5xxwfVLLNHHrpt2hMp6ZQ4/3OUhSZL8bDToZ/KPnT3unkdWTmV7nhL4nss=');
BMin := 0;
BMax := 1000;
WMin := 0;
WMax := 1000;
end;

with NumberArray[3] do {Good2}
begin
Number := 3;
DTM := DTMFromString('mHgQAAHic3c/PDsFAEAbwGZTwOH0eF2cnT+EiJaJII0gJ4gn92/KNfomN7MVN2uSXndmd/drGIvIAUZGalmuB5Sllr1Rwzvi1412r73SDK+csowktaEMnwPY b+sm5MNu+QXlmGRHUKeKef29KKSwhgxVsIYc9Wb2BNc8zzs9oz t6yJjCihL3tL77yLfcAZ4/1JziS9TvO++9NmTkm59zfSQa9oGG/+xY6i/EvVaAV8fvzApQlvTI=');
BMin := 140;
BMax := 220;
WMin := 300;
WMax := 550;
end;

with NumberArray[4] do {Good2}
begin
Number := 4;
DTM := DTMFromString('mygMAAHic1c5dCoJAFAXga1ipRVnto4eWUg uIVhG0loiIDEn7ISSjvQ11Bs7ALXrxoQcHPgauc49nLCKRJ9Kl iAJoQxN8aEGDt3vfhxhG0FPcPFa5HWa6HJ/ZdhZyb8Asa6i4rFDtv9A7hw1sYQd7SCClDE5whotyVbMjHLh7g wJKKjj7dqcHPKnkt4z/TtjJ9luzY8rOxhhZLWaVLefTj/sXm/0vE3SvI6+mqp033MCMjw==');
BMin := 130;
BMax := 300;
WMin := 200;
WMax := 450;
end;

with NumberArray[5] do {Good2}
begin
Number := 5;
DTM := DTMFromString('mXQQAAHic3c9dDsFAFAXg26pWikosRWIZ3i 3DAhBpCFHx/x8RLJMMzo0jGk9Sb23ypbczp/fOVEXkAZYl4oBHDrlgw1009Mq9a8O35nLgQx4KpGtZcsljLoAr fr/Jp58dk2FWc2X2878UqUQBZ+p5tmi5J60XtKZNrNb1OczgAMcY/d4xt4QpTCCCPoTQoZCzNDeiAXS534YmtJjtcU8zQxizp85YcfY JLnAGY0wijXrtL0nn/qKCe6WNlUKJnifIELAH');
BMin := 230;
BMax := 300;
WMin := 340;
WMax := 900;
end;

with NumberArray[6] do {Good2B}
begin
Number := 6;
DTM := DTMFromString('mSAQAAHic3c/bCgFRFAbgtYcijyOXbr2DZ5Gc0yTKYXI+xptw52GUGIxJ/t38w+QOd7Pra7da/9qHlIgklEgM4hT98EDmDEc40QXu4vUMZkR5XGxXcphxAzmHtT9 jBO6KqHf+xjNs3n8IvMFm3z/XYa0zS1jBHKYwgQFY0IE2daEPY5gxv+A+Yq/HnJ4dMmtRk1rQABPqUIMyFCAPJaiyZ5I/azJfgSLkYA0b/kG/IZtJy363fdH1t4Lz//r3jiT+FCYqZH5ZT1UtpIA=');
BMin := 160;
BMax := 440;
WMin := 300;
WMax := 600;
end;

with NumberArray[7] do {Good2}
begin
Number := 7;
DTM := DTMFromString('mIgMAAHiczc5hCoJAEAXgtyoZQtfwAN2oI3 SD0JCIEiuR8KjiRm/wBUu/8k+48LHsvGFmcwAjwQEJrWWldySQTPWYnGqe10sQ9A6aHbKa9d vMlDaaGe79OGJSSkUXaqiljp7UU0En5Td6KGv1rpVZz1U1y86a a3sOgUKZ7bp/7av3u1m893+x5d+WyC3Ub+cNI6GFkQ==');
BMin := 140;
BMax := 220;
WMin := 200;
WMax := 550;
end;

with NumberArray[8] do {Good2}
begin
Number := 8;
DTM := DTMFromString('mtQMAAHic1c7NCoJAFIbhMyJZVibeR5vuo3 13EAWVVKRUhEVdttA3+AZuhTYKD2eO52dmbmYDZxZJLEPX5CHn CCOZEBPOEX1BS8i87xvTNyXG1HyfiWPXTDKk5CkS3vGbCdhxUL qzJh7lTMzlJg+5c76SV/KSZ6vua6UUuMiJPX7/FvvWPSV7K2LB/5y+jayZ87WPvKWu607y1fLvur5hoXf3jeuhTt8X9gh9aA==');
BMin := 130;
BMax := 400;
WMin := 200;
WMax := 450;
end;

with NumberArray[9] do {Good2}
begin
Number := 9;
DTM := DTMFromString('mdgMAAHic1c7NCgFRGMbxM4U0Jh8TwzVYWs tOuQTltoTEyCShIffAzk15Tv5Tp0aysDH16z3zdOZ5p2uMqXjG VKUuAecyAvJQWtLkXJMG096JnDzkns3a0kFER0inz46SFFB0dv vOtDtW5iWWDTMmW2BJtpUdcy8nOctFrkjJj9xNZE3HTKaOOXnW n/CN7T7QlfL+uN9yxsP+R5PRIJe96/mFrLunf/0H3p/4/nkC/OhyWw==');
BMin := 160;
BMax := 440;
WMin := 300;
WMax := 600;
end;
End;

{************************************************* ******************************
procedure FreeNumbers;
by: Ashaman88
Description: Frees the number dtms!
************************************************** *****************************}

procedure FreeNumbers;
var
I: Integer;
begin
for i := 0 to high(NumberArray) do
FreeDTM(NumberArray[i].DTM);
end;

{************************************************* ******************************
function GetNumber: Integer;
by: Ashaman88.
Description: Gets the number on the side of the box.
************************************************** *****************************}


function GetNumber: Integer;
var
i, maxScore, maxIndex: integer;
CTS,X,Y: Integer;
MidBox: TPoint;
TPA,TPA1,TPA2,TPAW: TPointArray;
ATPA: T2DPointArray;
BrownBox: TBox;
afound: Extended;
scores: TintegerArray;
begin
LoadNumbers;
setLength(scores, length(NumberArray));

CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);

SetColorSpeed2Modifiers(0.05, 0.31);
MidBox:=MiddleBox(IntToBox(NumberBounds.X1+5, NumberBounds.Y1+5, NumberBounds.X2-5, NumberBounds.Y2-5));
FindColorsSpiralTolerance(MidBox.X, MidBox.Y, TPA, 6187391, NumberBounds.X1, NumberBounds.Y1, NumberBounds.X2, NumberBounds.Y2, 16);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);

ATPA:=FloodFillTPA(TPA);

if Length(ATPA)=0 then
begin
Writeln('No brown found');
Exit;
end;

if DebugBox then
begin
// DebugATPABounds(ATPA);
Writeln('Length of Brown Shape: '+ToStr(Length(ATPA[0])));
End;

BrownBox:=GetTPABounds(ATPA[0]);

FindColorsSpiralTolerance(MSCX, MSCY, TPA1, 16579837, BrownBox.X1, BrownBox.Y1, BrownBox.X2, BrownBox.Y2, 5);
FindColorsSpiralTolerance(MSCX, MSCY, TPA2, 12764106, BrownBox.X1, BrownBox.Y1, BrownBox.X2, BrownBox.Y2, 5);
TPAW:=CombineTPA(TPA1,TPA2);


if DebugBox then
Writeln('Length of White TPA in Brown: '+ToStr(Length(TPAW)));

// loop through fields, scoring each item
for i := 0 to high(NumberArray) do
begin
if inRange(Length(ATPA[0]), NumberArray[i].Bmin, NumberArray[i].BMax) then
scores[i] := scores[i] + 1;

if inRange(Length(TPAW), NumberArray[i].Wmin, NumberArray[i].WMax) then
scores[i] := scores[i] + 1;

if findDTMrotated(NumberArray[i].DTM, x, y, BrownBox.X1-3, BrownBox.Y1-3, BrownBox.X2+3, BrownBox.Y2+3,-Pi,Pi,Pi/30,aFound) then
scores[i] := scores[i] + 5;
Wait(15 + Random(10));
end;

// get the item with the highest score
maxScore := -1;
maxIndex := -1;
for i := 0 to high(scores) do
if (scores[i] > maxScore) then
begin
maxScore := scores[i];
maxIndex := i;
end;

if maxindex<>-1 then
begin
writeln('NumberScan: '+ToStr(NumberArray[maxIndex].number) + ', with a score of ' + intToStr(scores[maxIndex]));

result := NumberArray[maxIndex].number;
end;

SetLength(ATPA,0);
SetLength(TPA,0);
SetLength(TPA1,0);
SetLength(TPA2,0);
SetLength(TPAW,0);
end;

type
ShapeRotate = record
Shape: String;
SMin, SMax, WMin, WMax, BMin, BMax : integer;
end;
ShapeRotateArray = array of ShapeRotate;

var
ShapeArray: ShapeRotateArray;

{************************************************* ******************************
procedure LoadShapes;
by: Ashaman88
Description: Loadsup all the shapes!
************************************************** *****************************}

Procedure LoadShapes;
begin
if Length(ShapeArray)<>0 then
Exit;


SetLength(ShapeArray,5);

with ShapeArray[0] do {Good2}
begin
Shape := 'Triangle';
SMin := 10;
SMax := 13;
WMin := 4600;
WMax := 4900;
BMin := 3200;
BMax := 4500;
end;

with ShapeArray[1] do {Good2}
begin
Shape := 'Square';
SMin := 8;
SMax := 13;
WMin := 5000;
WMax := 5800;
BMin := 100;
BMax := 2500;
end;

with ShapeArray[2] do {Good2}
begin
Shape := 'Star';
SMin := 15;
SMax := 17;
WMin := 4100;
WMax := 4400;
BMin := 7500;
BMax := 8400;
end;

with ShapeArray[3] do {Good2}
begin
Shape := 'Circle';
SMin := 17;
SMax := 20;
WMin := 7000;
WMax := 7500;
BMin := 300;
BMax := 1300;
end;

with ShapeArray[4] do {Good}
begin
Shape := 'Pentagon';
SMin := 8;
SMax := 16;
WMin := 4400;
WMax := 4800;
BMin := 1600;
BMax := 2400;
end;
End;

{************************************************* ******************************
function GetShape: String;
by: Ashaman88.
Description: Gets the shape on the side of the box.
************************************************** *****************************}

Function GetShape: String;
Var
i, maxScore, maxIndex: integer;
CTS: Integer;
TPA,TPA1,TPA2, TPAB: TPointArray;
ATPA,ATPAB: T2DPointArray;
WhiteBox: TBox;
scores: TintegerArray;
begin
LoadShapes;
setLength(scores, length(shapeArray));

Result:='';
FindColorsSpiralTolerance(MSCX, MSCY, TPA1, 16579837, 172, 45, 352, 225, 5);
FindColorsSpiralTolerance(MSCX, MSCY, TPA2, 12764106, 172, 45, 352, 225, 5);
TPA:=CombineTPA(TPA1,TPA2);

ATPA:=FloodFillTPA(TPA);
SortATPASize(ATPA,True);
if DebugBox then
Writeln('Length of Full White ATPA: '+ToStr(Length(ATPA)));
if Length(ATPA)=0 then
begin
Writeln('No white found');
Exit;
End;

//if DebugBox then
// DebugATPABounds(ATPA);

CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);

WhiteBox:=GetTPABounds(ATPA[0]);
NumberBounds:=WhiteBox;

SetColorSpeed2Modifiers(0.05, 0.31);
FindColorsSpiralTolerance(MSCX, MSCY, TPAB, 6187391, WhiteBox.X1, WhiteBox.Y1, WhiteBox.X2, WhiteBox.Y2, 16);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);

SplitTPAWrap(TPAB,10,ATPAB);
SortATPASize(ATPAB,True);

if DebugBox then
begin
Writeln('Length of Shape: '+ToStr(Length(ATPA[0])));
Writeln('Length of OutterBox: '+ToStr(Length(ATPAB[0])));
end;

// loop through fields, scoring each item
for i := 0 to high(ShapeArray) do
begin
if inRange(Length(ATPA[0]), ShapeArray[i].Wmin, ShapeArray[i].WMax) then
scores[i] := scores[i] + 2;

if inRange(Length(ATPAB[0]), ShapeArray[i].Bmin, ShapeArray[i].BMax) then
scores[i] := scores[i] + 1;

if inRange(Length(ATPA), ShapeArray[i].Smin, ShapeArray[i].SMax) then
scores[i] := scores[i] + 4;
Wait(15 + Random(10));
end;

// get the item with the highest score
maxScore := -1;
maxIndex := -1;
for i := 0 to high(scores) do
if (scores[i] > maxScore) then
begin
maxScore := scores[i];
maxIndex := i;
end;

if maxindex<>-1 then
begin
writeln('ShapeScan: '+ShapeArray[maxIndex].shape + ', with a score of ' + intToStr(scores[maxIndex]));

result := ShapeArray[maxIndex].shape;
end;

SetLength(ATPA,0);
SetLength(TPA,0);
SetLength(TPA1,0);
SetLength(TPA2,0);
SetLength(ATPAB,0);
SetLength(TPAB,0);
end;

{************************************************* ******************************
function GetBoxSide: Integer;
by: pups/Ashaman88
Description: Gets Box side and freezes client
************************************************** *****************************}

Procedure GetBoxSide;
var
X,Y: Integer;
begin
repeat
wait(100);
if FindColorTolerance(x, y, 16579837, 182, 45, 182, 225, 5) then continue;
if FindColorTolerance(x, y, 16579837, 342, 45, 342, 225, 5) then continue;
if FindColorTolerance(x, y, 16579837, 172, 55, 352, 55, 5) then continue;
if FindColorTolerance(x, y, 16579837, 172, 215, 352, 215, 5) then continue;
if FindColorTolerance(x, y, 12764106, 182, 45, 182, 225, 5) then continue;
if FindColorTolerance(x, y, 12764106, 342, 45, 342, 225, 5) then continue;
if FindColorTolerance(x, y, 12764106, 172, 55, 352, 55, 5) then continue;
if FindColorTolerance(x, y, 12764106, 172, 215, 352, 215, 5) then continue;
Break;
until False;
Freeze;
end;

{************************************************* ******************************
function GetQuestion(var num: Integer; var shape: String): Integer;
by: pups
Description: Returns number and type.
************************************************** *****************************}

function GetQuestion(var num: Integer; var shape: string): Integer;
var
x, y, i: Integer;
text: string;
begin
num := 10;
shape := '';
for i := 0 to 14 do
begin
case i of
0: text := '0'; //Zero
1: text := '1'; //One
2: text := '2'; //Two
3: text := '3'; //Three
4: text := '4'; //Four
5: text := '5'; //Five
6: text := '6'; //Six
7: text := '7'; //Seven
8: text := '8'; //Eight
9: text := '9'; //Nine
10: text := 'Circle'; //Circle
11: text := 'Triangle'; //Triangle
12: text := 'Square'; //Square
13: text := 'Star'; //Star
14: text := 'Pentagon'; //Pentagon
end;
if (FindText(x, y, Text, upchars07, 110, 250, 415, 275)) then
begin
Result := i;
if (i < 10) then
num := i;
if (i >= 10) then
shape := text;
Exit;
end;
end;
end;


{************************************************* ******************************
function SolveBox: Boolean;
by: Ashaman88
Description: Solves the Box!
************************************************** *****************************}

function SolveBox: Boolean;
var
st2: Integer;
shapeQ, shape, ans: string;
numQ, num: Integer;
x, y: Integer;
begin
while OpenBox do
begin
WriteLn('Found a box, solving...');
Wait(1000);
GetQuestion(numQ, shapeQ);
if (shapeQ = '') and (numQ = 10) then
exit;
WriteLn('Question is:');
if shapeQ = '' then
WriteLn('Which shape has number ' + IntToStr(numQ))
else
WriteLn('What number is the ' + shapeQ);
st2 := GetSystemTime;
repeat
GetBoxSide;
Shape:=GetShape;
Num:=GetNumber;
UnFreeze;
if DebugBox then
Wait(2000) Else
if (num = numQ) or (shape = shapeQ) then
begin
if num = numQ then
ans := shape
else
ans := IntToStr(num);
WriteLn('Answer is ' + ans);
if FindText(x, y, ans, upchars07, 116, 286, 183, 311) then
Mouse(120, 290, 30, 10, True);
Wait(150 + Random(100));
if FindText(x, y, ans, upchars07, 235, 286, 302, 311) then
Mouse(240, 290, 30, 10, True);
Wait(150 + Random(100));
if FindText(x, y, ans, upchars07, 350, 286, 417, 311) then
Mouse(355, 290, 30, 10, True);
Wait(150 + Random(100));
//ClickMouse2(mouse_left);
WriteLn('******** SOLVED BOX RANDOM ********');
Result := True;
Break;
end;
until GetSystemTime > st2 + 12000;
Wait(1500 + Random(1000));
end;
if Length(NumberArray)>0 then
begin
FreeNumbers;
SetLength(NumberArray,0);
end;
if Length(ShapeArray)>0 then
SetLength(ShapeArray,0);
end;

I will probably make a fix for the sandwich lady's object scanning next. I will also attempt the forester soon because I've been getting a lot of them, and there doesn't seem to be a solver atm..

Solar
12-14-2013, 04:43 PM
Going to try these out with one of hoodz's scripts in pascalscript. It should work right?

Awesome work though. If only I had a clue what to do to be of any help.

Ashaman88
12-14-2013, 05:36 PM
I was getting a crazy amount of randoms so I decided to post the ones that I have fixed here..

Fixed the text options for the frog random.. It still uses the backup walk, but it manages to get to the middle of the cave.. It solved before I had a chance to improve it.. Will edit this post if I get another one.
frog.simba

(*
Frog
====

Stores all the routines to solve the Frog random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

*)

var
O_MouseSpeed, FROG_ISLAND_DTM, FROG_ISLAND_DTM_BACKUP, FROG_CROWN_DTM: Integer;

const
FROG_YELLOW = 7986172;
FROG_RED = 3097339;
FROG_GREEN = 879885;
FROG_SWAMP = 8031312;
FROG_CROWN = 1095911;
FROG_CROWN_COLOR_BACKUP = 633312;

//function Frog_Speakto: boolean; forward;
function Frog_IsTalkingTo: boolean; forward;
function Frog_FindFrog: boolean; forward;

(**
* Author: Justin
* Description: Detects if we are in the Frog Random. Small chance it would
* fail to detect due to the frogs being off-screen, checks for Music Track too.
*)
function Frog_Detect(): boolean;
begin
if not (tabExists(TAB_MAGIC)) then
begin
if Length(GetMinimapDots('npc')) >= 4 then
if PercentBlackMM >= 35 then
if (GetMusic = 'Frooland') then
begin
Result := true;
exit;
end;
if (CountColorTolerance(FROG_GREEN, MSX1, MSY1, MSX2, MSY2, 30) >= 100) then
if (CountColorTolerance(FROG_RED, MSX1, MSY1, MSX2, MSY2, 30) >= 20) then
Result := (CountColorTolerance(FROG_YELLOW, MSX1, MSY1, MSX2, MSY2, 30) >= 5);
end;
end;

(**
* Author: Justin
* Description: Gets our player ready to solve the random.
*)
procedure Frog_Setup();
begin
if (not LoggedIn()) then
exit;
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('n');
O_MouseSpeed := MouseSpeed;
MouseSpeed := 26;
end;

(**
* Author: Xtrapsp
* Description: Loads the DTMs that are used within the random.
*)
procedure Frog_Set_DTMS;
begin
FROG_ISLAND_DTM := DTMFromString('mrAAAAHic42BgYDjJxsBwA4qvA/EpID4MxLuAeBMQtwDV9ABxNRAXA3EuEBcBcQkQ1wJxaJAdg3lx Ak4sB1SDDzMSwDAAAMr5E3M=');
FROG_ISLAND_DTM_BACKUP := DTMFromString('maQEAAHicE2RgYLjGxMDwGIjvMEHY54H4NB Sfg+KrQHwTqu4BED8H4idAfAmqfgbQnIlA3AvFE4B4CgNEfB4Q LwLipVA8H8qfDZUHqV8JxIGeNgxmRfFw7ONiARYD4RBvWzAGsf 3dLVHUIWNWoDmUYkYqYAwAAGpfKPw=');
FROG_CROWN_DTM := DTMFromString('mggAAAHicY2NgYNBkZGDQAGItINZDwneBcj eB+BoQXwfiWwwQsUI+doZjkjwMG9u4GN5v42O4tICHIZeHlUEE KIcNM+LAEAAAEgENCw==');
end;

(**
* Author: Xtrapsp
* Description: Unloads the DTMs that were used within the random.
*)
procedure Frog_Free_DTMS;
begin
FreeDTM(FROG_ISLAND_DTM);
FreeDTM(Frog_ISLAND_DTM_BACKUP);
FreeDTM(FROG_CROWN_DTM);
end;

(**
* Author: Xtrapsp/Justin
* Description: Walks our player to the center of the map where the
* Frog Princess is located. If the DTM fails, will use TPA failsafe.
*)
function Frog_WalkCenter: boolean;
var
TPA: TPointArray;
T, TPAX, TPAY: Integer;
begin
if (not loggedIn()) then
exit;
MarkTime(T);
if ClickDTMRotatedIn(FROG_ISLAND_DTM, MMX1, MMY1, MMX2, MMY2, - Pi, Pi, Pi / 30, [], mouse_Left) then
begin
addToSRLLog('Frog_WalkCenter: Moving to center of cave');
FFlag(0);
result := true;
addToSRLLog('Frog_WalkCenter[Main]: result: ' + BoolToStr(result));
end
else
begin
addToSRLLog('Frog_WalkCenter: Unable to find main DTM, Falling back onto backup');
if (FindColorsTolerance(TPA, FROG_SWAMP, MMX1, MMY1, MMX2, MMY2, 50)) then
begin
MiddleTPAEx(TPA, TPAX, TPAY);
Mouse(TPAX, TPAY, 8, 8, mouse_Left);
wait(600 + Random(120));
FFlag(0);
result := true;
addToSRLLog('Frog_WalkCenter[Backup]: result: ' + BoolToStr(result));
end;
end;
end;

(**
* Author: Xtrapsp/Justin
* Description: Finds the Frog Princess via DTM with a TPA failsafe.
* If the DTM fails, it will rotate the camera just incase the Frog Princess
* is off the screen.
*)
function Frog_FindFrog: boolean;
var
T, Attempt, tmpCTS, i, arL: integer;
arP: TPointArray;
ararP: T2DPointArray;
P: TPoint;
begin
addToSRLLog('Frog_FindFrog: Attempting to find the Frog Princess');
Marktime(T);
tmpCTS := GetColorToleranceSpeed;
repeat
if ClickDTMRotatedIn(FROG_CROWN_DTM, MSX1, MSY1, MSX2, MSY2, - Pi, Pi, Pi / 30, ['rog'], mouse_Left) then
begin
addToSRLLog('Frog_FindFrog: Found Frog Princess');
result := true;
addToSRLLog('Frog_FindFrog[Main]: result: ' + BoolToStr(result));
exit;
end else
begin
addToSRLLog('Frog_FindFrog: Could not find Frog Princess. Falling onto backup');
MakeCompass(rs_GetCompassAngleDegrees + RandomRange(85, 95));
wait(800+Random(400));
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.76);
if (FindColorsTolerance(arP, FROG_CROWN, MSX1, MSY1, MSX2, MSY2, 12)) then
begin
addToSRLLog('Frog_FindFrog: Found TPA color, Moving mouse to TPA');
SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arP, 8, 8);
arL := High(ararP);
for i := 0 to arL do
begin
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
addToSRLLog('Frog_FindFrog: Checking multi uptext');
Wait(100 + Random(100));
if (IsUpTextMultiCustom(['Frog', 'Talk', 'rog'])) then
begin
ClickMouse2(mouse_Right);
Result := WaitOptionMulti(['Talk-to', 'alk-t', 'Frog', 'rog'], 500);
addToSRLLog('Frog_FindFrog[Backup]: result: ' + BoolToStr(result));
wait(600 + Random(120));
FFlag(0);
exit;
end else
addToSRLLog('Frog_FindFrog: Could not find uptext');
end;
end else
addToSRLLog('Frog_FindFrog[Backup]: Unable to find TPA');
end;
Inc(Attempt);
addToSRLLog('Frog_FindFrog: Attempt: ' + inttostr(Attempt));
until ((Attempt > 3) or (Result));
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
exit;

end;

{(**
* Author: Xtrapsp/Justin
* Description: Handles talking to the Frog Princeess.
*)
function Frog_SpeakTo: boolean;
var
T, Attempt: integer;
TPA: TPointArray;
begin
addToSRLLog('Frog_SpeakTo: Attempting to speak to the Frog Princess');
Marktime(T);
repeat
if ClickDTMRotatedIn(FROG_CROWN_DTM, MSX1, MSY1, MSX2, MSY2, - Pi, Pi, Pi / 30, ['rog'], mouse_Left) then
begin
addToSRLLog('Frog_SpeakTo: Found Frog Princess, Clicking Frog Princess');
result := true;
addToSRLLog('Frog_SpeakTo[Main]: result: ' + BoolToStr(result));
Wait(3500 + Random(1000));
exit;
end
else
begin
addToSRLLog('Frog_SpeakTo: Could not find Frog Princess. Falling onto backup');
if (FindColorsSpiralTolerance(MSCX, MSCY, TPA, FROG_CROWN_COLOR_BACKUP, MSX1, MSY1, MSX2, MSY2, 25)) then
begin
Mouse(TPA[0].X, TPA[0].Y, 2, 2, mouse_Move);
if IsUpTextMultiCustom(['Frog', 'Talk', 'rog']) then
ClickMouse2(mouse_Left);
wait(600 + Random(120));
FFlag(0);
Result := true;
addToSRLLog('Frog_SpeakTo[Backup]: result: ' + BoolToStr(result));
end;
end;
Inc(Attempt);
MakeCompass(rs_GetCompassAngleDegrees + RandomRange(85, 95));
until ((Attempt > 20) or (Frog_IsTalkingTo))
if (Attempt > 20) then
Frog_WalkCenter;
exit;
end;}

(**
* Author: Xtrapsp/Justin
* Description: Detects if we are talking to the Frog Princess or just a Frog.
*)
function Frog_IsTalkingTo: boolean;
var
T, Attempt: integer;
begin
addToSRLLog('Frog_IsTalkingTo: Speaking to the Frog Princess');
repeat
Result := FindNPCChatText('Hmph. Have you come to apologize for ignoring me?', Nothing);
if Result then
begin
addToSRLLog('Frog_IsTalkingTo: Continuing to chat to Frog Princess');
Wait(1000 + Random(500));
DoConversation('', true);
Wait(1100 + Random(500));
Mouse(137, 399, 252, 7, True);
Wait(1100 + Random(500));
Mouse(153, 449, 130, 5, True);
Wait(1100 + Random(500));
Mouse(243, 450, 130, 4, True);
Wait(2100 + Random(1500));
Result := true;
addToSRLLog('Frog_IsTalkingTo: result: ' + BoolToStr(result));
exit;
end
else
addToSRLLog('Frog_IsTalkingTo: Could not continue chat with Frog Princess');
until ((Attempt > 5) or (TimefromMark(T) > 50000) or Result);
if (Attempt > 5) then
begin
addToSRLLog('Frog_IsTalkingTo: Attempts are greater than 5');
Wait(3000 + Random(1000));
result := false;
end;
end;

(**
* Author: Justin
* Description: Handles solving the random event.
*)
function Frog_Solve(): boolean;
var
t: integer;
begin
if (not loggedIn()) then
exit;
t := (getSystemTime + (10 * 60000));
Frog_Setup();
repeat
if Frog_WalkCenter then
if Frog_FindFrog then
result := Frog_IsTalkingTo;
until (result or (getSystemTime > t));
MouseSpeed := O_MouseSpeed;
if (not result) then
addToSRLLog('Frog_Solve: Frog solver failed or timed out');
end;

Fixed the pillory cage random. Object scanning was freezing up and returning low values for the locks, added wait times and minimum value requirements. Fixed compass angle issues.
pillory.simba

(*
Pillory
=======

Stores all the routines to solve the Pillory random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses color counting to determine the shape
of the lock and which key to use.

*)

procedure PL_Message(Message: string);
begin
addToSRLLog('[Pillory Random] ' + Message);
end;

function PL_LockScreen: Boolean;
begin
Result := (LoggedIn and (GetColor(497, 34) = 65536));
end;

function PL_Detect: boolean;
var
tpa: TPointArray;
begin
if (not TabExists(TAB_OPTIONS)) and (TabExists(TAB_FRIENDS)) then
begin
// red doors of the cages
FindColorsTolerance(tpa, 235, MMCX - 15, MMCY - 15, MMCX + 15, MMCY + 15, 20);
Result := (inRange(length(tpa), 3, 18));
end;
end;

(**
* Author: DannyRS
* Last modified 15/03/2013 By DannyRS
* Description: Opens Cage Interface
*)
function PL_ClickCage: Boolean;
var
t: Integer;
begin
Result := False;

t := GetSystemTime;

if (not LoggedIn) then Exit;

Result := PL_LockScreen;

if (not Result) then
begin
repeat
MMouse(243,143,80,65);

Wait(RandomRange(90, 270));

if (IsUpTextMultiCustom(['Unlock','lock','Cage','age'])) then
begin
ClickMouse2(mouse_left);
if (waitFunc(@PL_LockScreen, 50, 5000)) then
begin
PL_Message('[PL_ClickCage] Opened Lock Screen');
Wait(RandomRange(190, 270));
Result := True;
end else
PL_Message('[PL_ClickCage] Failed to open Lock Screen');
end;
until (Result) or (GetSystemTime - t > 30000);
end;
end;

(**
* Author: DannyRS
* Last modified 15/03/2013 By DannyRS
* Description: Clicks a key 0-2
*)
function PL_ClickKey(Slot: Integer): Boolean;
var
p: TPoint;
begin
Result := False;

if (not PL_LockScreen) then Exit;

p := Point(209 + (Slot*93), 251);

MMouse(RandomRange(p.x - 2, p.x + 2), RandomRange(p.y - 4, p.y + 4), 0, 0);

ClickMouse2(mouse_left);

Result := True;
end;

(**
* Author: DannyRS
* Last modified 9/04/2013 By DannyRS
* Description: Scans for lock type
*)
function PL_GetLock: String;
var
CNum,Count,CountTime,WatchTime: Integer;
begin
Result := '';
WatchTime := RandomRange(9000,10000);
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.21, 2.01);
MarkTime(CountTime);
Count:= 100;
repeat
CNum := CountColorTolerance(1057067, 60, 65, 150, 150, 10);
if (CNum > Count) then
Count := CNum;
wait(50 + random(50));
until (TimeFromMark(CountTime) > WatchTime);
if (Count > 800) and (Count < 1000) then Result := 'square';
if (Count > 570) and (Count < 799) then Result := 'triangle';
if (Count > 400) and (Count < 569) then Result := 'diamond';
if (Count > 1001) and (Count < 1600) then Result := 'circle';
PL_Message('[PL_GetLock] Lock Found: ' + Result + ' [' + ToStr(Count) + ']');
end;

(**
* Author: DannyRS
* Last modified 9/04/2013 By DannyRS
* Description: Scans for key types
*)
function PL_GetKeys: TStringArray;
var
C1,C2,C3,CNum,Count,WatchTime: Integer;
begin
SetLength(Result, 3);

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.43, 2.81);

MarkTime(WatchTime);
Result[0] := '';
Count := 100; CNum := 0;
repeat
CNum := CountColorTolerance(1516846, 180, 170, 235, 260, 7);

case CNum of
286: Result[0] := 'triangle';
493: Result[0] := 'diamond';
506: Result[0] := 'circle';
729: Result[0] := 'square';
end;

if (CNum > Count) then
Count := CNum;
wait(50 + random(50));

until (not (Result[0] = '')) or (TimeFromMark(WatchTime) > 10000);

if (Result[0] = '') then
begin
if InRange(Count, 250, 350) then Result[0] := 'triangle';
if InRange(Count, 400, 500) then Result[0] := 'diamond';
if InRange(Count, 501, 600) then Result[0] := 'circle';
if InRange(Count, 670, 1300) then Result[0] := 'square';
end;

C1 := Count;

MarkTime(WatchTime);
Result[1] := '';
Count := 100; CNum := 0;
repeat
CNum := CountColorTolerance(1516846, 265, 170, 345, 260, 7);

case CNum of
286: Result[1] := 'triangle';
493: Result[1] := 'diamond';
506: Result[1] := 'circle';
729: Result[1] := 'square';
end;

if (CNum > Count) then
Count := CNum;
wait(50 + random(50));

until (not (Result[1] = '')) or (TimeFromMark(WatchTime) > 10000);

if (Result[1] = '') then
begin
if InRange(Count, 250, 350) then Result[1] := 'triangle';
if InRange(Count, 400, 500) then Result[1] := 'diamond';
if InRange(Count, 501, 600) then Result[1] := 'circle';
if InRange(Count, 670, 1300) then Result[1] := 'square';
end;

C2 := Count;

MarkTime(WatchTime);
Result[2] := '';
Count := 100; CNum := 0;
repeat
CNum := CountColorTolerance(1516846, 365, 170, 430, 260, 7);

case CNum of
286: Result[2] := 'triangle';
493: Result[2] := 'diamond';
506: Result[2] := 'circle';
729: Result[2] := 'square';
end;

if (CNum > Count) then
Count := CNum;
wait(50 + random(50));

until (not (Result[2] = '')) or (TimeFromMark(WatchTime) > 10000);

if (Result[2] = '') then
begin
if InRange(Count, 250, 350) then Result[2] := 'triangle';
if InRange(Count, 400, 500) then Result[2] := 'diamond';
if InRange(Count, 501, 600) then Result[2] := 'circle';
if InRange(Count, 670, 1300) then Result[2] := 'square';
end;

C3 := Count;

PL_Message('[PL_GetKeys] Keys Found: '+
Result[0]+' ['+IntToStr(C1)+']'+' '+
Result[1]+' ['+IntToStr(C2)+']'+' '+
Result[2]+' ['+IntToStr(C3)+']');
end;

(**
* Author: DannyRS
* Last modified 15/03/2013 By DannyRS
* Description: Solves the Pillory Random Event
*)
function PL_Solve: Boolean;
var
i, t, keysolves, tmpCTS: Integer;
tmpHM, tmpSM, Deg: Extended;
lock: String;
keys: TStringArray;
begin
Result := False;
keysolves := 0;

tmpCTS := GetColorToleranceSpeed;
GetToleranceSpeed2Modifiers(tmpHM, tmpSM);

if (not LoggedIn) then Exit;

t := GetSystemTime;

Deg := RS_GetCompassAngleDegrees;
Wait(100 + random(50));
MakeCompass('N');
//if (not PL_ClickCage) then Exit;

repeat

Result := (TabExists(TAB_OPTIONS));
if (Result) then Break;

// open the lock screen if it's not already open
if (not PL_LockScreen) then PL_ClickCage;

lock := PL_GetLock;
keys := PL_GetKeys;

for i := 0 to 2 do
if (keys[i] = '') then
begin
PL_Message('[ERROR] [PL_GetKeys] Failed to get all keys');
Break;
end;

if (lock = '') then
begin
PL_Message('[ERROR] [PL_GetLock] Failed to get lock type');
Continue;
end;

for i := 0 to 2 do
if (keys[i] = lock) then
begin
PL_Message('[PL_Solve] Clicking key : ' + keys[i]);
if PL_ClickKey(i) then
begin
keysolves := keysolves + 1;
Wait(RandomRange(1500, 2000));
end;
end;

Result := ((keysolves > 2) and (not PL_LockScreen)) or
(TabExists(TAB_OPTIONS));

until (Result) or (GetSystemTime - t > 120000);

if (Result) then MakeCompass(Deg);

SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(tmpHM, tmpSM);

if (not Result) then
begin
if (GetSystemTime - t > 120000) then
PL_Message('[ERROR] Pillory solver timed out');
end else
Wait(RandomRange(800, 1200));
end;

Fixed the drill demon random. Added 1 new bitmap for each sign, had no problems detecting all 4. Ran it through a few times, changing worlds to test colour difference.
demon.simba

(*
Drill Demon
===========

Stores all the routines to solve the Drill Demon random. None of these routines
should be used throughout scripts. They only need to be called in SRL's random
detection methods.

This solver uses Deformed BMPs to locate the signs
to solve the Drill Demon (Sergeant Damien) random.

*)

procedure DD_Message(Message: String);
begin
addToSRLLog('[DemonDrill Random] ' + Message);
end;

function DD_Detect(): Boolean;
begin
if (not TabExists(TAB_OPTIONS)) and (not TabExists(TAB_EMOTES)) then
Result := (GetMusic = 'CorPoral Punisbment');
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Moves the player back to the center of the random
* Note: Inspired by Le Jingle
*)
function DD_ResetPosition: Boolean;
var
WallTPA: TPointArray;
WallATPA: T2DPointArray;
tb: TBox;
p: TPoint;
//pa: TPointArray;
begin
Result := False;

if (not LoggedIn) then Exit;

SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);
FindColorsTolerance(WallTPA, 15593957, 600, 58, 690, 110, 70);
SplitTPAExWrap(WallTPA, 5, 5, WallATPA);
SortATPASize(WallATPA, True);

if (Length(WallATPA) < 1) then Exit;

//SMART_DrawBoxEx(True, False, WallATPA[0], clGreen);

tb := GetTPABounds(WallATPA[0]);
p := MiddleBox(tb);

//Seems white alone is accurate enough to leave this out - Danny
//pa := GetMiniMapDots('yellow');
//if (Length(pa) < 1) then Exit;
//if (not PointInBox(pa[0], tb)) then Exit;

MMouse(p.x, RandomRange(p.y, p.y + 2), 0, 0);
ClickMouse2(mouse_left);

Wait(RandomRange(300, 400));
Flag;
Wait(RandomRange(800, 1200));

Result := True;
end;

function DD_TalkingToDemon: Boolean;
begin
Result := (Trim(GetNPCChatName) = 'SergeantDamien');
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Talks to Sergeant Damien
*)
function DD_TalkDemon: Boolean;
var
DemonTPA: TPointArray;
DemonATPA: T2DPointArray;
x, y, i, Attemps: Integer;
begin
Result := False;

if (DD_TalkingToDemon) then
begin
Result := True;
Exit;
end;

repeat

if (Attemps > 6) then Break;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.15, 1.61);
FindColorsTolerance(DemonTPA, 994406, MSX1, MSY1, MSX2, MSY2, 16);
SplitTPAExWrap(DemonTPA, 50, 100, DemonATPA);
SortATPASize(DemonATPA, True);

if (Length(DemonATPA) < 1) then
begin
Attemps := Attemps + 1;
Wait(RandomRange(200, 400));
Continue;
end;

for i := 0 to High(DemonATPA) do
begin
if (Length(DemonATPA[i]) < 50) then Continue;
MiddleTPAEx(DemonATPA[i], x, y);
MMouse(RandomRange(x - 5, x + 5), RandomRange(y - 5, y + 5), 0, 0);
ClickMouse2(mouse_right);
Wait(RandomRange(30, 50));
if (ChooseOptionMulti(['Talk','alk-to'])) then
begin
if (WaitFunc(@DD_TalkingToDemon, 50, 25000)) then
begin
DD_Message('[DD_TalkDemon] Talked to demon');
Result := True;
Exit;
end else
DD_Message('[DD_TalkDemon] Failed to Talked to demon');
end;
end;
Attemps := Attemps + 1;

until (Result) or (Attemps > 6);
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Gets the TBoxes of the green signs
*)
function DD_GetSigns: TBoxArray;
var
ESignsTPA: TPointArray;
ESignsATPA: T2DPointArray;
SignsSorted: Boolean;
i: Integer;
begin
SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);
FindColorsTolerance(ESignsTPA, 4553552, MSX1, MSY1, MSX2, MSY2, 30);
SplitTPAExWrap(ESignsTPA, 70, 60, ESignsATPA);

repeat
SignsSorted := True;
for i := 0 to High(ESignsATPA) do
begin
if (Length(ESignsATPA[i]) < 5) then
begin
DeleteValueInATPA(ESignsATPA,i);
SignsSorted := False;
Break;
end;
end;
until (SignsSorted);

SetLength(Result, Length(ESignsATPA));

for i := 0 to high(ESignsATPA) do
begin
Result[i] := GetTPABounds(ESignsATPA[i]);
end;

DD_Message('[DD_GetSigns] Number of signs located : ' +
IntToStr(Length(ESignsATPA)));
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description:
* Compares bitmaps to the signs and tries to
* return it's position, roughly centered
*)
function DD_FindSign(WhichSign: String): TPoint;
var
SB: TBoxArray;
x, y, i, ib, hb: Integer;
Saccuracy: Extended;
SBMP: TIntegerArray;
begin
Result := Point(-1, -1);

SB := DD_GetSigns;
if (Length(SB) < 1) then Exit;

SetLength(SBMP, 3);

hb := High(SBMP);

SetColorToleranceSpeed(1);
SetToleranceSpeed2Modifiers(0.02, 0.02);

case LowerCase(WhichSign) of
'jog': begin
SBMP[0] := BitmapFromString(14, 15, 'meJxzrw1KnFAOQe5IbAgXDRGvEo' +
'6y5zQDEVw7Vlk4wm8UmktooRJNMS4PojkVlxq4p5BDDKsaTBu RVWI' +
'qw2UvVmUE44VaiolMEkAEAE9f+0k=');
SBMP[1] := BitmapFromString(26, 17, 'meJxzqwl0w0AJfWUQhMYmD2E1jR' +
'IDIShrdhMQwa2grmlkGwgxB4IodxVaMFLXNGQDKYwRNM+SHcv IQQf' +
'XS57b0CICOQVSYhSmH8k2jSrxOJhNc0PNVhQiKhYdbuQmKgBk SPbW');
SBMP[2] := BitmapFromString(29, 10, 'meJxzrQ5wJRrF9ZUSr3gwGItsMh' +
'qXbJQ5qxGI4EZRxViImRBjIaZRbizcTGR3UmgsmpnUCltcxlI rVKl' +
'rLNxk4tUDAIc3Qs8=');
end;
'starjumps': begin
SBMP[0] := BitmapFromString(16, 16, 'meJxzrw1yx0CJE8ohCFMKK4Krx9' +
'SSu7AdiEg1H6su/GogXPwIlyHEqMSlnhhH0kg9hS6nonqsyrBqgcQ' +
'7LjOJUY/VXswEhifGkZMfAK38Sfc=');
SBMP[1] := BitmapFromString(33, 17, 'meJxzqwl0Ixol9JUBEfHqSUUQ8+' +
'lmC4Xm5CxohSNaqMeqkSCilo+objhBu6ge0cPAClrHAi4rqGg LHZI' +
'TprHUtQWXsym3Al4Q4XIwsjh5pRa8uMPjWmTzyS4Y4bbgCUZi SngA' +
'a5KX0w==');
SBMP[2] := BitmapFromString(37, 16, 'meJxzrQ5wJR3F9ZXCERnacaHs+S' +
'34raOiXXAbIYjqJhNjKfGIPjbSx5t0C1U6RyI97Ro21tEtNdL HOuR' +
'iCtN8qtuIXDBiNZlGHgQiXMbSIgbh1uGJUyKrJAA7N7QN');
end;
'situps': begin
SBMP[0] := BitmapFromString(32, 12, 'meJxzrwl0R0U5C9uAyB1DnCoIYj' +
'gdzCfPCoK6KDGfoC5kw0m1ghgtmOYTaQWRWpAVEG8+msm4tGA qI9I' +
'KrBoJBiDWsCKIsJqf0F8GRJiuJcN8ZKOQDYeLE4xugobDzYew SUoY' +
'xBiObD7QBABMTOo0');
SBMP[1] := BitmapFromString(36, 14, 'meJxzqwl0GwQoZ0ErENHNIgrtIl' +
'I73C7yrCNeL7JFZNhFkl40u0iyjiSNmBYRbxepepHVUBIaboR SMpr' +
'J+O3C6gus2km1i3gE0ZvQV0aMO4lxOR4EtAWCkEXgZqJJUWIX 3CKs' +
'BqLJEh8pBO1C9g6dEQA0UXaL');
SBMP[2] := BitmapFromString(37, 16, 'meJxzrQ5wHRwoe34LENHTLgqtI1' +
'473DqybSReL7Jd5FlHkl4060i1kSSNmHaRZB2pepGVkWojmnq CGtE' +
'MpyRYiLcOf8ASg4hJMJiyZFsX11cKRMhcuJkQKbgswWRDpF3I 1mHa' +
'BZElJpUSaRcEkZSDyLCRVPOHEwIAf3vRcQ==');
end;
'pushups': begin
SBMP[0] := BitmapFromString(37, 16, 'meJxzrw1KnFAOQe61QXRAdLZuYF' +
'HuwnYIoqddyIjO1tHIakwzaWc1HkNoYSlB7VQMZ+K1ELSUGHM ocSF' +
'J9sKLFMpjgZ6pmnaJihJ7aWcjWmTRoQrAtAsAxiXG8w==');
SBMP[1] := BitmapFromString(39, 16, 'meJxzqwl0qwlM6CuDIDcwlz5oYC' +
'2ls73IKGdBKwTR30ZkNCCW0tQBBG2kugOwmkZre/GbQwt7iTeEin6' +
'nRAsZboCUCZSEFalpD7ksonpqHFRZntb2okUina1DthEAClrm ig==');
SBMP[2] := BitmapFromString(43, 16, 'meJxzrQ5wBaO4vlI4coUJ0hMhO2' +
'Cg3ICJsue3ANHA2o6MBtZ2OjuGoANo6hhMk+npBjxm0scNBE2 jaWg' +
'QbwiNkgcZuqiSVuEFICUBOLAZh57phFqOoacb0OJ6AK3GtB0A juAl' +
'9Q==');
end;
end;

for i := 0 to High(SB) do
begin
for ib := 0 to hb do
begin
if (Result.X > 0) or (Result.Y > 0) then Break;
if (SB[i].X1 > SB[i].X2) or (SB[i].Y1 > SB[i].Y2) then Continue;

if FindDeformedBitmapToleranceIn(SBMP[ib], x, y, SB[i].X1-2, SB[i].Y1-2,
SB[i].X2+2, SB[i].Y2+2, 2, 4, False, Saccuracy) then
begin
Result := Point(x + 20, y + 7);
DD_Message('[DD_FindSign] Matching sign found at : ' + ToStr(Result));
Break;
end;
end;
end;

for ib := 0 to hb do
FreeBitmap(SBMP[ib]);
end;

(**
* Author: DannyRS
* Last Modified: 17/03/2013 - DannyRS
* Description: Attemps to solve the Drill Demon random
*)
function DD_Solve(): boolean;
var
p: TPoint;
t, tmpCompass, tmpCTS, MMoves, debugColorCount: Integer;
tmpHM, tmpSM: Extended;
MatName, LastMatt: String;
begin
Result := False;

if (not LoggedIn) then Exit;

t := GetSystemTime;

tmpCTS := GetColorToleranceSpeed;
GetToleranceSpeed2Modifiers(tmpHM, tmpSM);
tmpCompass := Round(rs_GetCompassAngleDegrees);

SetAngle(SRL_ANGLE_LOW);
MakeCompass('N');

repeat

Result := TabExists(TAB_MAGIC);

if (Result) then Break;

if (not DD_TalkDemon) then
begin
DD_ResetPosition;
Continue;
end;

Wait(RandomRange(1200, 1600));

debugColorCount := CountColor(0, MCX1, MCY1, MCX2, MCY2);
case debugColorCount of
687,988,691 : MatName := 'jog';
707,711 : MatName := 'starjumps';
569,573 : MatName := 'situps';
637,938,641 : MatName := 'pushups';
else
begin
ClickToContinue;
Wait(RandomRange(1200, 1500));
Continue;
end;
end;
DD_Message('[DD_Solve] Last color count: ' + inttostr(debugColorCount));
LastMatt := '';
if (LastMatt = MatName) then
begin
MMoves := 0;

DD_Message('[DD_Solve] Already standing on the matt : ' + MatName);
DD_Message('[DD_Solve] Using matt : ' + MatName + ' again');

repeat
MMouse(246, 184, 40, 30);
MMoves := MMoves + 1;
Wait(RandomRange(90, 340));
if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
begin
ClickMouse2(mouse_right);
Wait(RandomRange(40, 90));
if (ChooseOptionMulti(['Use'])) then
begin
Wait(RandomRange(1200, 1500));
if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
begin
DD_Message('[DD_Solve] Used matt successfully');
LastMatt := MatName;
Break;
end else
begin
DD_Message('[ERROR] Failed to use matt');
Break;
end;
end;
end;
until (MMoves > 10);

Continue;
end;

DD_Message('[DD_Solve] Walking to center to search for sign');

if (not DD_ResetPosition) then
begin
DD_Message('[ERROR] Failed to walk to center');
Continue;
end;

DD_Message('[DD_Solve] Searching for sign : ' + MatName);

p := DD_FindSign(MatName);

if (p.x < 0) or (p.y < 0) then
begin
DD_Message('[ERROR] Failed to find sign : ' + MatName);
Continue;
end;

MMoves := 0;

DD_Message('[DD_Solve] Searching for matt : ' + MatName);

repeat

MMouse(p.x - 10, p.y + 64, 50, 30);

//SMART_DrawBoxEx(True,False,IntToBox(p.x-10,p.y+64,p.x+40,p.y+94),clGreen);

MMoves := MMoves + 1;
Wait(RandomRange(90, 340));
if (IsUpTextMultiCustom(['Use','xercise','mat'])) then
begin
ClickMouse2(mouse_right);
Wait(RandomRange(40, 90));
if (ChooseOptionMulti(['Use'])) then
begin
Wait(RandomRange(1200, 1500));
if (WaitFunc(@DD_TalkingToDemon, 50, 15000)) then
begin
DD_Message('[DD_Solve] Used matt successfully');
LastMatt := MatName;
Break;
end else
begin
DD_Message('[ERROR] Failed to use matt');
Break;
end;
end;
end;
until (MMoves > 10);

Result := TabExists(TAB_MAGIC);

until (Result) or (GetSystemTime - t > 240000);

if (not Result) then
begin
if (GetSystemTime - t > 240000) then
DD_Message('[ERROR] DrillDemon solver timed out');
end else
Wait(RandomRange(1200, 1600));

SetAngle(SRL_ANGLE_HIGH);
MakeCompass(tmpCompass);

SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(tmpHM, tmpSM);
end;

Fixed the strange box random. Changed dtm-finding to bmptol-finding for the box item, fast and accurate. Added wait times to the item and number scanning, getting a much higher solve rate, roughly 85% and significantly less extra boxes from in-game time-outs. Call it with SolveBox; because it's not included in the normal random-finding routines.
box.simba

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ? Box Routines --//
//-----------------------------------------------------------------//
// * function GambleBox: Boolean; // * by WT-Fakawi
// * function GetBoxSide: Integer; // * by pups/Ashaman88
// * function GetQuestion(var num: Integer; var shape: string): Integer; // * by pups
// * function GetNumber: Integer; // * by Ashaman88
// * function GetShape: String; // * by Ashaman88
// * function OpenBox: Boolean; // * by Ashaman88
// * function SolveBox: Boolean; // * by Ashaman88

//{$I SRL-OSR/SRL/misc/Debug.Simba}
//{$I SRL-OSR/SRL/misc/SmartGraphics.Simba}
var
NumberBounds: TBox;

const
DebugBox=False;

{************************************************* ******************************
function GambleNewBox: Boolean;
by: WT-Fakawi (left this in here just in case we want to guess)
Description: A random box clicker. Will try to solve the box ONCE, by a random click
@ any of the three answers. THIS IS NOT A BOXSOLVER, JUST A BOXCLICKER!
************************************************** *****************************}

function GambleBox: Boolean;
var
xb, yb, Choise: Integer;
begin
//if FindBitmapToleranceIn(Box, xb, yb, MIX1, MIY1, MIX2, MIY2, 40) then
begin
Mouse(xb, yb, 0, 0, True);
Wait(2000);
Choise:= Random(3);
TakeScreen('Gambling box Choise - '+IntToStr(Choise));
case Choise of
0: Mouse(145, 295, 4, 4, True);
1: Mouse(270, 295, 4, 4, True);
2: Mouse(381, 295, 4, 4, True);
end;
IdleTime(4000, 2000, 1.0);
// if FindBitmapToleranceIn(Box, xb, yb, MIX1, MIY1, MIX2, MIY2, 40) then
begin
WriteLn('Box Missed');
// NOnewboxes := NOnewboxes + 1;
Result := False;
repeat
Logout;
until (not (LoggedIn));
Exit;
end
//else
begin
WriteLn('Box solved');
// newboxes := newboxes + 1;
Result := True;
end;
end;
end;

{************************************************* ******************************
function OpenBox: Boolean;
by: Ashaman88
Description: Opens the box.
************************************************** *****************************}

function OpenBox : Boolean;
var
x, y, i : Integer;
SBMP: TIntegerArray;
begin
Result := False;
SetLength(SBMP, 1);
GameTab(Tab_Inv);
Wait(100 + Random(50));
SBMP[0] := BitmapFromString(22, 15, 'meJxzdHR3BCMbGycgGR2dTBDp6h' +
'pCtISHxwMRXDsxejG1oyFHmHuwOkZeXhFNb3BwFFZzsBoIR3D ZsrJ' +
'GIMJvAi4E0YtsgpdXILIgENnbu0AQMHwgCKt2PCagISsre/wm+PgG' +
'D7gJfv5hA25CQGDEgJsATJwDYgJcBAD7lYWZ');
if FindBitmapToleranceIn(SBMP[0], x, y, MIX1, MIY1, MIX2, MIY2, 40) then
begin
Mouse(x, y, 4, 4, True);
for i := 0 to 9 do
begin
if (GetColor(487, 39) = 13567) and (GetColor(350, 295) = 2304814) then
begin
Result := True;
Break;
end;
Wait(500 + Random(50));
end;
end;
FreeBitmap(SBMP[0]);
end;

type
NumberRotate = record
Number, DTM, BMin, BMax, WMin, WMax: integer;
end;
NumberRotateArray = array of NumberRotate;

var
NumberArray: NumberRotateArray;

{************************************************* ******************************
procedure LoadNumbers;
by: Ashaman88
Description: Loadsup all the numbers!
************************************************** *****************************}

procedure LoadNumbers;
begin
if Length(NumberArray)<>0 then
Exit;

SetLength(NumberArray,10);

with NumberArray[0] do {Good2}
begin
Number := 0;
DTM := DTMFromString('mYQMAAHic1c5bCsIwFIThExWr9YJ2F766D9 9dhptRRFREii0i7jDgBH8xFIX2TQMfpyQzaWZm1nNmiXvPvqQf hP2xjGRAtiudSEJ2iJDPZIoJ/VfP4KSFNudp1N8rdpJcLlIyc/aP9sycmTvZIu6G3hVlpR++C87uuFVyh+juNTb8w3tf22q5aKzJ/d/M9c5f5/5A7fUAGciE0g==');
BMin := 125;
BMax := 215;
WMin := 160;
WMax := 30;
end;

with NumberArray[1] do {Good}
begin
Number := 1;
DTM := DTMFromString('mggAAAHicY2NgYGBigABmIGaBshmBmA+Iua FYCirOAcT1mXEMf//8AWMQG4aNgHLYMBMODAEARdcMkQ==');
BMin := 85;
BMax := 130;
WMin := 0;
WMax := 100;
end;

with NumberArray[2] do {Good2}
begin
Number := 2;
DTM := DTMFromString('mygMAAHic1c5bCoJQFIXh43uWkdnNaAY9NK OG0Dyigkq7XyypqCkK/dESojepF4WP7dlu1z5dY4xjGVOGi6pUrHe/BBsFVVt9R72XouZraEgdnjLTLE/ffElnWzp3VNuqTWW6+t9XbnoOufsMcyywxh4RYhxwwgZLrLBFg CnGmOg90MwOR5xxwfVLLNHHrpt2hMp6ZQ4/3OUhSZL8bDToZ/KPnT3unkdWTmV7nhL4nss=');
BMin := 0;
BMax := 1000;
WMin := 0;
WMax := 1000;
end;

with NumberArray[3] do {Good2}
begin
Number := 3;
DTM := DTMFromString('mHgQAAHic3c/PDsFAEAbwGZTwOH0eF2cnT+EiJaJII0gJ4gn92/KNfomN7MVN2uSXndmd/drGIvIAUZGalmuB5Sllr1Rwzvi1412r73SDK+csowktaEMnwPY b+sm5MNu+QXlmGRHUKeKef29KKSwhgxVsIYc9Wb2BNc8zzs9oz t6yJjCihL3tL77yLfcAZ4/1JziS9TvO++9NmTkm59zfSQa9oGG/+xY6i/EvVaAV8fvzApQlvTI=');
BMin := 140;
BMax := 220;
WMin := 300;
WMax := 550;
end;

with NumberArray[4] do {Good2}
begin
Number := 4;
DTM := DTMFromString('mygMAAHic1c5dCoJAFAXga1ipRVnto4eWUg uIVhG0loiIDEn7ISSjvQ11Bs7ALXrxoQcHPgauc49nLCKRJ9Kl iAJoQxN8aEGDt3vfhxhG0FPcPFa5HWa6HJ/ZdhZyb8Asa6i4rFDtv9A7hw1sYQd7SCClDE5whotyVbMjHLh7g wJKKjj7dqcHPKnkt4z/TtjJ9luzY8rOxhhZLWaVLefTj/sXm/0vE3SvI6+mqp033MCMjw==');
BMin := 130;
BMax := 300;
WMin := 200;
WMax := 450;
end;

with NumberArray[5] do {Good2}
begin
Number := 5;
DTM := DTMFromString('mXQQAAHic3c9dDsFAFAXg26pWikosRWIZ3i 3DAhBpCFHx/x8RLJMMzo0jGk9Sb23ypbczp/fOVEXkAZYl4oBHDrlgw1009Mq9a8O35nLgQx4KpGtZcsljLoAr fr/Jp58dk2FWc2X2878UqUQBZ+p5tmi5J60XtKZNrNb1OczgAMcY/d4xt4QpTCCCPoTQoZCzNDeiAXS534YmtJjtcU8zQxizp85YcfY JLnAGY0wijXrtL0nn/qKCe6WNlUKJnifIELAH');
BMin := 230;
BMax := 300;
WMin := 340;
WMax := 900;
end;

with NumberArray[6] do {Good2B}
begin
Number := 6;
DTM := DTMFromString('mSAQAAHic3c/bCgFRFAbgtYcijyOXbr2DZ5Gc0yTKYXI+xptw52GUGIxJ/t38w+QOd7Pra7da/9qHlIgklEgM4hT98EDmDEc40QXu4vUMZkR5XGxXcphxAzmHtT9 jBO6KqHf+xjNs3n8IvMFm3z/XYa0zS1jBHKYwgQFY0IE2daEPY5gxv+A+Yq/HnJ4dMmtRk1rQABPqUIMyFCAPJaiyZ5I/azJfgSLkYA0b/kG/IZtJy363fdH1t4Lz//r3jiT+FCYqZH5ZT1UtpIA=');
BMin := 160;
BMax := 440;
WMin := 300;
WMax := 600;
end;

with NumberArray[7] do {Good2}
begin
Number := 7;
DTM := DTMFromString('mIgMAAHiczc5hCoJAEAXgtyoZQtfwAN2oI3 SD0JCIEiuR8KjiRm/wBUu/8k+48LHsvGFmcwAjwQEJrWWldySQTPWYnGqe10sQ9A6aHbKa9d vMlDaaGe79OGJSSkUXaqiljp7UU0En5Td6KGv1rpVZz1U1y86a a3sOgUKZ7bp/7av3u1m893+x5d+WyC3Ub+cNI6GFkQ==');
BMin := 140;
BMax := 220;
WMin := 200;
WMax := 550;
end;

with NumberArray[8] do {Good2}
begin
Number := 8;
DTM := DTMFromString('mtQMAAHic1c7NCoJAFIbhMyJZVibeR5vuo3 13EAWVVKRUhEVdttA3+AZuhTYKD2eO52dmbmYDZxZJLEPX5CHn CCOZEBPOEX1BS8i87xvTNyXG1HyfiWPXTDKk5CkS3vGbCdhxUL qzJh7lTMzlJg+5c76SV/KSZ6vua6UUuMiJPX7/FvvWPSV7K2LB/5y+jayZ87WPvKWu607y1fLvur5hoXf3jeuhTt8X9gh9aA==');
BMin := 130;
BMax := 400;
WMin := 200;
WMax := 450;
end;

with NumberArray[9] do {Good2}
begin
Number := 9;
DTM := DTMFromString('mdgMAAHic1c7NCgFRGMbxM4U0Jh8TwzVYWs tOuQTltoTEyCShIffAzk15Tv5Tp0aysDH16z3zdOZ5p2uMqXjG VKUuAecyAvJQWtLkXJMG096JnDzkns3a0kFER0inz46SFFB0dv vOtDtW5iWWDTMmW2BJtpUdcy8nOctFrkjJj9xNZE3HTKaOOXnW n/CN7T7QlfL+uN9yxsP+R5PRIJe96/mFrLunf/0H3p/4/nkC/OhyWw==');
BMin := 160;
BMax := 440;
WMin := 300;
WMax := 600;
end;
End;

{************************************************* ******************************
procedure FreeNumbers;
by: Ashaman88
Description: Frees the number dtms!
************************************************** *****************************}

procedure FreeNumbers;
var
I: Integer;
begin
for i := 0 to high(NumberArray) do
FreeDTM(NumberArray[i].DTM);
end;

{************************************************* ******************************
function GetNumber: Integer;
by: Ashaman88.
Description: Gets the number on the side of the box.
************************************************** *****************************}


function GetNumber: Integer;
var
i, maxScore, maxIndex: integer;
CTS,X,Y: Integer;
MidBox: TPoint;
TPA,TPA1,TPA2,TPAW: TPointArray;
ATPA: T2DPointArray;
BrownBox: TBox;
afound: Extended;
scores: TintegerArray;
begin
LoadNumbers;
setLength(scores, length(NumberArray));

CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);

SetColorSpeed2Modifiers(0.05, 0.31);
MidBox:=MiddleBox(IntToBox(NumberBounds.X1+5, NumberBounds.Y1+5, NumberBounds.X2-5, NumberBounds.Y2-5));
FindColorsSpiralTolerance(MidBox.X, MidBox.Y, TPA, 6187391, NumberBounds.X1, NumberBounds.Y1, NumberBounds.X2, NumberBounds.Y2, 16);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);

ATPA:=FloodFillTPA(TPA);

if Length(ATPA)=0 then
begin
Writeln('No brown found');
Exit;
end;

if DebugBox then
begin
// DebugATPABounds(ATPA);
Writeln('Length of Brown Shape: '+ToStr(Length(ATPA[0])));
End;

BrownBox:=GetTPABounds(ATPA[0]);

FindColorsSpiralTolerance(MSCX, MSCY, TPA1, 16579837, BrownBox.X1, BrownBox.Y1, BrownBox.X2, BrownBox.Y2, 5);
FindColorsSpiralTolerance(MSCX, MSCY, TPA2, 12764106, BrownBox.X1, BrownBox.Y1, BrownBox.X2, BrownBox.Y2, 5);
TPAW:=CombineTPA(TPA1,TPA2);


if DebugBox then
Writeln('Length of White TPA in Brown: '+ToStr(Length(TPAW)));

// loop through fields, scoring each item
for i := 0 to high(NumberArray) do
begin
if inRange(Length(ATPA[0]), NumberArray[i].Bmin, NumberArray[i].BMax) then
scores[i] := scores[i] + 1;

if inRange(Length(TPAW), NumberArray[i].Wmin, NumberArray[i].WMax) then
scores[i] := scores[i] + 1;

if findDTMrotated(NumberArray[i].DTM, x, y, BrownBox.X1-3, BrownBox.Y1-3, BrownBox.X2+3, BrownBox.Y2+3,-Pi,Pi,Pi/30,aFound) then
scores[i] := scores[i] + 5;
Wait(15 + Random(10));
end;

// get the item with the highest score
maxScore := -1;
maxIndex := -1;
for i := 0 to high(scores) do
if (scores[i] > maxScore) then
begin
maxScore := scores[i];
maxIndex := i;
end;

if maxindex<>-1 then
begin
writeln('NumberScan: '+ToStr(NumberArray[maxIndex].number) + ', with a score of ' + intToStr(scores[maxIndex]));

result := NumberArray[maxIndex].number;
end;

SetLength(ATPA,0);
SetLength(TPA,0);
SetLength(TPA1,0);
SetLength(TPA2,0);
SetLength(TPAW,0);
end;

type
ShapeRotate = record
Shape: String;
SMin, SMax, WMin, WMax, BMin, BMax : integer;
end;
ShapeRotateArray = array of ShapeRotate;

var
ShapeArray: ShapeRotateArray;

{************************************************* ******************************
procedure LoadShapes;
by: Ashaman88
Description: Loadsup all the shapes!
************************************************** *****************************}

Procedure LoadShapes;
begin
if Length(ShapeArray)<>0 then
Exit;


SetLength(ShapeArray,5);

with ShapeArray[0] do {Good2}
begin
Shape := 'Triangle';
SMin := 10;
SMax := 13;
WMin := 4600;
WMax := 4900;
BMin := 3200;
BMax := 4500;
end;

with ShapeArray[1] do {Good2}
begin
Shape := 'Square';
SMin := 8;
SMax := 13;
WMin := 5000;
WMax := 5800;
BMin := 100;
BMax := 2500;
end;

with ShapeArray[2] do {Good2}
begin
Shape := 'Star';
SMin := 15;
SMax := 17;
WMin := 4100;
WMax := 4400;
BMin := 7500;
BMax := 8400;
end;

with ShapeArray[3] do {Good2}
begin
Shape := 'Circle';
SMin := 17;
SMax := 20;
WMin := 7000;
WMax := 7500;
BMin := 300;
BMax := 1300;
end;

with ShapeArray[4] do {Good}
begin
Shape := 'Pentagon';
SMin := 8;
SMax := 16;
WMin := 4400;
WMax := 4800;
BMin := 1600;
BMax := 2400;
end;
End;

{************************************************* ******************************
function GetShape: String;
by: Ashaman88.
Description: Gets the shape on the side of the box.
************************************************** *****************************}

Function GetShape: String;
Var
i, maxScore, maxIndex: integer;
CTS: Integer;
TPA,TPA1,TPA2, TPAB: TPointArray;
ATPA,ATPAB: T2DPointArray;
WhiteBox: TBox;
scores: TintegerArray;
begin
LoadShapes;
setLength(scores, length(shapeArray));

Result:='';
FindColorsSpiralTolerance(MSCX, MSCY, TPA1, 16579837, 172, 45, 352, 225, 5);
FindColorsSpiralTolerance(MSCX, MSCY, TPA2, 12764106, 172, 45, 352, 225, 5);
TPA:=CombineTPA(TPA1,TPA2);

ATPA:=FloodFillTPA(TPA);
SortATPASize(ATPA,True);
if DebugBox then
Writeln('Length of Full White ATPA: '+ToStr(Length(ATPA)));
if Length(ATPA)=0 then
begin
Writeln('No white found');
Exit;
End;

//if DebugBox then
// DebugATPABounds(ATPA);

CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);

WhiteBox:=GetTPABounds(ATPA[0]);
NumberBounds:=WhiteBox;

SetColorSpeed2Modifiers(0.05, 0.31);
FindColorsSpiralTolerance(MSCX, MSCY, TPAB, 6187391, WhiteBox.X1, WhiteBox.Y1, WhiteBox.X2, WhiteBox.Y2, 16);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);

SplitTPAWrap(TPAB,10,ATPAB);
SortATPASize(ATPAB,True);

if DebugBox then
begin
Writeln('Length of Shape: '+ToStr(Length(ATPA[0])));
Writeln('Length of OutterBox: '+ToStr(Length(ATPAB[0])));
end;

// loop through fields, scoring each item
for i := 0 to high(ShapeArray) do
begin
if inRange(Length(ATPA[0]), ShapeArray[i].Wmin, ShapeArray[i].WMax) then
scores[i] := scores[i] + 2;

if inRange(Length(ATPAB[0]), ShapeArray[i].Bmin, ShapeArray[i].BMax) then
scores[i] := scores[i] + 1;

if inRange(Length(ATPA), ShapeArray[i].Smin, ShapeArray[i].SMax) then
scores[i] := scores[i] + 4;
Wait(15 + Random(10));
end;

// get the item with the highest score
maxScore := -1;
maxIndex := -1;
for i := 0 to high(scores) do
if (scores[i] > maxScore) then
begin
maxScore := scores[i];
maxIndex := i;
end;

if maxindex<>-1 then
begin
writeln('ShapeScan: '+ShapeArray[maxIndex].shape + ', with a score of ' + intToStr(scores[maxIndex]));

result := ShapeArray[maxIndex].shape;
end;

SetLength(ATPA,0);
SetLength(TPA,0);
SetLength(TPA1,0);
SetLength(TPA2,0);
SetLength(ATPAB,0);
SetLength(TPAB,0);
end;

{************************************************* ******************************
function GetBoxSide: Integer;
by: pups/Ashaman88
Description: Gets Box side and freezes client
************************************************** *****************************}

Procedure GetBoxSide;
var
X,Y: Integer;
begin
repeat
wait(100);
if FindColorTolerance(x, y, 16579837, 182, 45, 182, 225, 5) then continue;
if FindColorTolerance(x, y, 16579837, 342, 45, 342, 225, 5) then continue;
if FindColorTolerance(x, y, 16579837, 172, 55, 352, 55, 5) then continue;
if FindColorTolerance(x, y, 16579837, 172, 215, 352, 215, 5) then continue;
if FindColorTolerance(x, y, 12764106, 182, 45, 182, 225, 5) then continue;
if FindColorTolerance(x, y, 12764106, 342, 45, 342, 225, 5) then continue;
if FindColorTolerance(x, y, 12764106, 172, 55, 352, 55, 5) then continue;
if FindColorTolerance(x, y, 12764106, 172, 215, 352, 215, 5) then continue;
Break;
until False;
Freeze;
end;

{************************************************* ******************************
function GetQuestion(var num: Integer; var shape: String): Integer;
by: pups
Description: Returns number and type.
************************************************** *****************************}

function GetQuestion(var num: Integer; var shape: string): Integer;
var
x, y, i: Integer;
text: string;
begin
num := 10;
shape := '';
for i := 0 to 14 do
begin
case i of
0: text := '0'; //Zero
1: text := '1'; //One
2: text := '2'; //Two
3: text := '3'; //Three
4: text := '4'; //Four
5: text := '5'; //Five
6: text := '6'; //Six
7: text := '7'; //Seven
8: text := '8'; //Eight
9: text := '9'; //Nine
10: text := 'Circle'; //Circle
11: text := 'Triangle'; //Triangle
12: text := 'Square'; //Square
13: text := 'Star'; //Star
14: text := 'Pentagon'; //Pentagon
end;
if (FindText(x, y, Text, upchars07, 110, 250, 415, 275)) then
begin
Result := i;
if (i < 10) then
num := i;
if (i >= 10) then
shape := text;
Exit;
end;
end;
end;


{************************************************* ******************************
function SolveBox: Boolean;
by: Ashaman88
Description: Solves the Box!
************************************************** *****************************}

function SolveBox: Boolean;
var
st2: Integer;
shapeQ, shape, ans: string;
numQ, num: Integer;
x, y: Integer;
begin
while OpenBox do
begin
WriteLn('Found a box, solving...');
Wait(1000);
GetQuestion(numQ, shapeQ);
if (shapeQ = '') and (numQ = 10) then
exit;
WriteLn('Question is:');
if shapeQ = '' then
WriteLn('Which shape has number ' + IntToStr(numQ))
else
WriteLn('What number is the ' + shapeQ);
st2 := GetSystemTime;
repeat
GetBoxSide;
Shape:=GetShape;
Num:=GetNumber;
UnFreeze;
if DebugBox then
Wait(2000) Else
if (num = numQ) or (shape = shapeQ) then
begin
if num = numQ then
ans := shape
else
ans := IntToStr(num);
WriteLn('Answer is ' + ans);
if FindText(x, y, ans, upchars07, 116, 286, 183, 311) then
Mouse(120, 290, 30, 10, True);
Wait(150 + Random(100));
if FindText(x, y, ans, upchars07, 235, 286, 302, 311) then
Mouse(240, 290, 30, 10, True);
Wait(150 + Random(100));
if FindText(x, y, ans, upchars07, 350, 286, 417, 311) then
Mouse(355, 290, 30, 10, True);
Wait(150 + Random(100));
//ClickMouse2(mouse_left);
WriteLn('******** SOLVED BOX RANDOM ********');
Result := True;
Break;
end;
until GetSystemTime > st2 + 12000;
Wait(1500 + Random(1000));
end;
if Length(NumberArray)>0 then
begin
FreeNumbers;
SetLength(NumberArray,0);
end;
if Length(ShapeArray)>0 then
SetLength(ShapeArray,0);
end;

I will probably make a fix for the sandwich lady's object scanning next. I will also attempt the forester soon because I've been getting a lot of them, and there doesn't seem to be a solver atm..

Awesome job man, if they work send in those pull requests!

Krazy_Meerkat
12-15-2013, 08:47 AM
Awesome job man, if they work send in those pull requests!

Where do I send these pull requests? A forum search for "osr pull request" sent me back here.. There are a few places to download OSR so I didn't know if I should PM Flight or hoodz or what.. These are for the pascal version of osr (I can do fixes for the lape version if needed).

All of them work, only the frog random is a quick-fix.. I have a new version which uses some of Flight's frog_solve2 but haven't tested yet, it will still use the quick-fix as a backup.
I updated my previous post because I fixed the cage-finding routine for the pillory random (it was just using mousebox). Works great now, if you use it, post feedback here.

I found that there was a forester solver after all, I started working on it but got stuck on the mainscreen tail-finding.. If you fail the forester you get sent to the party room, which isn't an issue for my script which uses hometele, but I'd like the solver to find the pheasant with X number of tails and I'm not up to scratch on my colour routines.. I'll try again when I get another one.

The Mayor
12-15-2013, 09:38 AM
Awesome work here Krazy_Meerkat :) I know a lot of people were complaining about the random solvers for OSR.

Hoodz
12-15-2013, 09:38 AM
Where do I send these pull requests? A forum search for "osr pull request" sent me back here.. There are a few places to download OSR so I didn't know if I should PM Flight or hoodz or what.. These are for the pascal version of osr (I can do fixes for the lape version if needed).


I can put them in the include of my tutorial.
My version is the same as the github version (i think that is what you search) but it has a some extra reflection functions and al_include. The smartparams file works with the latest version of smart too.

Krazy_Meerkat
12-15-2013, 10:51 AM
I can put them in the include of my tutorial.
My version is the same as the github version (i think that is what you search) but it has a some extra reflection functions and al_include. The smartparams file works with the latest version of smart too.

It be great if you could include them in your version hoodz, I link to that version because of the neat reflection hooks and your setup tutorial :)

Thanks Mayor, the less rands the better imo.. I got 2 more SL's and they solved with the regular solver so I haven't edited that yet.. But I've got a mordaut random atm, so I'm testing a few things..

Ashaman88
12-15-2013, 01:35 PM
I can put them in the include of my tutorial.
My version is the same as the github version (i think that is what you search) but it has a some extra reflection functions and al_include. The smartparams file works with the latest version of smart too.

Is that version linked with the github version? It's not a good idea to have all of these things fragmented.... Speaking of which I would think the reflection I clues should also be setup on the srl git. This way whenever the devs finally get included with simba srl update there won't be any fragmentation.

If everyone uses a certain function... Like some of flights stuff, why wouldn't we just add to the official git?


Sending a pull request isn't very difficult - idk if we have tutorials here on it but it should be an easy google search I believe. If not you can just send me changes and I'll put them up there

Krazy_Meerkat
12-18-2013, 05:47 PM
Finished some fixes to the frog random, I'll update the post to include this new version. Credits to Flight for the conversation-handling (adapted from Frog_Solve2) and the frog dtm. Frog-finding is the only thing that uses a back-up because the bmp-finding and dtm-finding aren't working very well for the crown. I re-worked the Frog_WalkCenter method because dtm-finding no longer works on the minimap. Added compass handling. Ran it through a few times to make sure everything worked. You can make the edits Flight recommends to FindTalk; (which handle frogs before you enter the cave) and they will not clash with Frog_Solve. Frog_Solve2 method included does not use cave-walking.
I've been making a few more edits to the strangebox random to try and get a more constant solve rate.. I haven't altered the shape settings, just added some score requirements.. I don't really like the scanrotateobject methods because they appear to cause a lot of lag, but I don't have any new solutions..
The mordaut random was too much atm.. I improved small object finding a little bit and then got stuck on the big item puzzle because nothing was getting recognised and when I set the accuracy lower, nearly everything was incorrect. Much respect for Coh3n & DemiseScythe who created the original solver, most item info will likely need to be re-calibrated.

Ashaman88
12-18-2013, 05:49 PM
Finished some fixes to the frog random, I'll update the post to include this new version. Credits to Flight for the conversation-handling (adapted from Frog_Solve2) and the frog dtm. Frog-finding is the only thing that uses a back-up because the bmp-finding and dtm-finding aren't working very well for the crown. I re-worked the Frog_WalkCenter method because dtm-finding no longer works on the minimap. Added compass handling. Ran it through a few times to make sure everything worked. You can make the edits Flight recommends to FindTalk; (which handle frogs before you enter the cave) and they will not clash with Frog_Solve. Frog_Solve2 method included does not use cave-walking.
I've been making a few more edits to the strangebox random to try and get a more constant solve rate.. I haven't altered the shape settings, just added some score requirements.. I don't really like the scanrotateobject methods because they appear to cause a lot of lag, but I don't have any new solutions..
The mordaut random was too much atm.. I improved small object finding a little bit and then got stuck on the big item puzzle because nothing was getting recognised and when I set the accuracy lower, nearly everything was incorrect. Much respect for Coh3n & DemiseScythe who created the original solver, most item info will likely need to be re-calibrated.

Yeah some of those spinning objects/changing color randoms are a huge pain with color. Might also be worth looking into reflection solutions for them.

mrkeen1
03-31-2014, 08:43 PM
Yes very good

Haxz
06-30-2014, 07:39 AM
Been more than half a year since anyone posted here, hope I don't get flame for gravedigging.

For some reasons, FindNonInvetoryRandoms will still go back to clicking the inventory tab, can't find which part of antirandoms include is doing that. I've done some changes in Pillory's color and colorcount, working perfectly fine now. I found a way to differentiate the frogs in frog random, now I'm testing on solving the frog random when it is found, instead of solving it in the cave.

Not sure if this was a typo or it was done intentionally...
http://puu.sh/9Qp66/36f8e06027.png

Krazy_Meerkat
07-01-2014, 07:41 AM
Been more than half a year since anyone posted here, hope I don't get flame for gravedigging.

For some reasons, FindNonInvetoryRandoms will still go back to clicking the inventory tab, can't find which part of antirandoms include is doing that. I've done some changes in Pillory's color and colorcount, working perfectly fine now. I found a way to differentiate the frogs in frog random, now I'm testing on solving the frog random when it is found, instead of solving it in the cave.

Not sure if this was a typo or it was done intentionally...
http://puu.sh/9Qp66/36f8e06027.png

If you're using reflection, there is a boolean R_InventoryRandoms which controls it, but the Rewards() solver is the one which causes the problem (searching for the lamp etc.).

Solar
07-01-2014, 08:32 AM
If you're using reflection, there is a boolean R_InventoryRandoms which controls it, but the Rewards() solver is the one which causes the problem (searching for the lamp etc.).

Do you see the Frogland track name is Frooland in the frog.simba file though? Think that's what he is referring to.

Haxz
07-01-2014, 09:16 AM
If you're using reflection, there is a boolean R_InventoryRandoms which controls it, but the Rewards() solver is the one which causes the problem (searching for the lamp etc.).

The OSR include's antirandom is the one giving me problems, reflection's working fine. At some point my script will go back to inventory tab to eat food, reflection's reward solver is working great, never had any problems solving mysterious box, lamps etc. Since reflection's include will be automatically updated, I'm not changing anything inside reflection include, else my work will be gone lol.

Krazy_Meerkat
07-02-2014, 01:42 AM
The OSR include's antirandom is the one giving me problems, reflection's working fine. At some point my script will go back to inventory tab to eat food, reflection's reward solver is working great, never had any problems solving mysterious box, lamps etc. Since reflection's include will be automatically updated, I'm not changing anything inside reflection include, else my work will be gone lol.

Hmm.. Well the Rewards random is the only Inventory random on the list, that's why I mentioned it.
Some of the other randoms have a Rewardbox, but they are not classed as inventory randoms.. This is the part of OSR's antirandom which causes the issue:
// solve reward box if a non inventory random was just solved
if (loggedIn()) then // if solver failed, player would be logged out
if (not SRL_Randoms[i].isInvRandom) then
begin
// reward box doesn't exist if inventory is full/some randoms don't have reward box
result := (invFull() or (not SRL_Randoms[i].hasRewardBox));
As you can see, it clearly checks your inventory if it's not an inv random. I might submit a pull request on this, but if you'd like a quick fix yourself, you can just change the part where it checks .isInvRandom and also add checkInv like this:

if ((not SRL_Randoms[i].isInvRandom) and checkInv) then

Haxz
07-02-2014, 02:43 AM
Hmm.. Well the Rewards random is the only Inventory random on the list, that's why I mentioned it.
Some of the other randoms have a Rewardbox, but they are not classed as inventory randoms.. This is the part of OSR's antirandom which causes the issue:
// solve reward box if a non inventory random was just solved
if (loggedIn()) then // if solver failed, player would be logged out
if (not SRL_Randoms[i].isInvRandom) then
begin
// reward box doesn't exist if inventory is full/some randoms don't have reward box
result := (invFull() or (not SRL_Randoms[i].hasRewardBox));
As you can see, it clearly checks your inventory if it's not an inv random. I might submit a pull request on this, but if you'd like a quick fix yourself, you can just change the part where it checks .isInvRandom and also add checkInv like this:

if ((not SRL_Randoms[i].isInvRandom) and checkInv) then

Thanks! I actually gave up on using OSR's randoms finding functions already lol. I'll do a quick fix on the include :D

Flight
07-02-2014, 03:12 AM
Just got the Mordaut random again so I did some more object recording in the big puzzle (as I plan to solve this random the same way my certer-solver works) and I see now why my results are never consistent: in each puzzle the item changes size as well, how many sizes are possible I have no idea but if it's certain amount it won't be a problem. Now this does complicate how my solver will work and I'll need to make multiple object profiles based on how many sizes are possible for each item but I've updated my debugger to record both, the rest is all manual. Frustrating no doubt but this random event is very common so it makes sense to give more attention to making a solver for it.

That's all, just wanted to give some helpful tips on anyone else trying to tackle this one and a simple update for everyone else.

Krazy_Meerkat
07-02-2014, 03:14 AM
I think I remember checking the 'frooland' thing myself by printing the text it found using GetMusic and it was read by simba as 'frooland'.. I think anyway.. I've never had any problems detecting the frog random :)

Haxz
07-02-2014, 03:59 AM
Just got the Mordaut random again so I did some more object recording in the big puzzle (as I plan to solve this random the same way my certer-solver works) and I see now why my results are never consistent: in each puzzle the item changes size as well, how many sizes are possible I have no idea but if it's certain amount it won't be a problem. Now this does complicate how my solver will work and I'll need to make multiple object profiles based on how many sizes are possible for each item but I've updated my debugger to record both, the rest is all manual. Frustrating no doubt but this random event is very common so it makes sense to give more attention to making a solver for it.

That's all, just wanted to give some helpful tips on anyone else trying to tackle this one and a simple update for everyone else.

It'll be great if there's a working solver for mordaut, which I think is outside of my ability to make one.


I think I remember checking the 'frooland' thing myself by printing the text it found using GetMusic and it was read by simba as 'frooland'.. I think anyway.. I've never had any problems detecting the frog random :)

You were right :p

jhildy
08-09-2014, 07:31 PM
Made a Molly Solver

program R_MollySolve;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/misc/al_functions.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

VAR
Molly: TNPC;
Fakes: array of TNPC;
StartArea, RandomArea: TBox;
PlayerLoc, CraneLoc, DoorLoc, mousetile: TPoint;
i: Integer;
Twin,t: TNPC;

Function InMollyRoom: Boolean;
begin
if (R_FindNPC('Molly', Molly)) then
begin
writeln('found molly: ' + inttostr(Molly.NPCId));
Result := true;
end;
end;

Procedure WalkOutDoor;
var DoorLoc, Coord: TPoint;

begin
DoorLoc := Point((R_GetTileGlobal.x + 2), R_GetTileGlobal.y);
R_OpenDoor(DoorLoc, 'E');
repeat
wait(100);
until(FindNPCChatText('Molly', Nothing));
clicktoContinue;
ChatWait;
ChatWait;
if FindNPCChatText('Select', Nothing) then
begin
FindNPCChatText('know', ClickLeft);
ChatWait;
ChatWait;
ClickToContinue;
ChatWait;
ChatWait;
ClickToContinue;
wait(2000);
end;
end;

Function GoToControls: Boolean;
var ControlBoxLoc, BoxCoords: TPoint;
begin
MakeCompass('E');
ControlBoxLoc := Point((R_getTileGlobal.x + 5), (R_getTileGlobal.y - 2));
BoxCoords := R_TileToMS(ControlBoxLoc);
MMouse(BoxCoords.x, BoxCoords.y, 3, 3);
wait(200+random(200));
if (IsUpText('panel')) then
begin
clickmouse2(Mouse_left);
end;
end;

Function OnControls: Boolean;
var x, y: Integer;
begin
result := findcolortolerance(x,y,39423,665,212,723,257,1);
end;

Function findEvilTwin: TNPC;
var tempTNPCArray: TNPCArray;
tmp: TNPC;
i, loc, lowestID: integer;
begin
tempTNPCArray := R_GetAllNPCs;
lowestID := 10000000;
for i := 0 to high(tempTNPCArray) do
begin
if (tempTNPCArray[i].Index < lowestID) then
begin
lowestId := tempTNPCArray[i].index;
loc := i;
end;
end;
result := tempTNPCArray[loc];

end;

Procedure ControlArm(dir: String; var Coord: Tpoint);
begin
case dir of
'u': begin
Mouse(640, 290, 1, 1, Mouse_left);
dec(Coord.y);
wait(300+random(500))
end;
'd': begin
Mouse(639, 385, 1, 1, Mouse_left);
inc(Coord.y);
wait(300+random(500))
end;
'l': begin
Mouse(593, 333, 1, 1, Mouse_left);
inc(Coord.x);
wait(300+random(500))
end;
'r': begin
Mouse(693, 330, 1, 1, Mouse_left);
dec(Coord.x);
wait(300+random(500))
end;
end;
end;

Function overFake: boolean;
begin
R_FindNPC(t.NPCID, Twin);
Result:= ((CraneLoc.x = Twin.Tile.x) and (CraneLoc.y = Twin.Tile.y))
end;


Function GoUp:Boolean;
begin
R_FindNPC(t.NPCID, Twin);
Result := (CraneLoc.y > Twin.tile.y);
end;

Function GoDown: Boolean;
begin
R_FindNPC(t.NPCID, Twin);
Result := (CraneLoc.y < Twin.tile.y);
end;

Function GoRight: Boolean;
begin
R_FindNPC(t.NPCID, Twin);
Result := (CraneLoc.x > Twin.tile.x);
end;

Function GoLeft: Boolean;
begin
R_FindNPC(t.NPCID, Twin);
Result := (CraneLoc.x < Twin.tile.x);
end;

Function WaitForControl:boolean;
begin
repeat
wait(100);
until(GetColor(699, 234) = 39423)
result := true;
end;


Function CatchTheFake:Boolean;
var xStart: Tpoint;
dir: String;
i, yDis, xDis:Integer;
begin

CraneLoc.x := R_GetTileGlobal.x;
CraneLoc.y := R_GetTileGlobal.y - 4;
repeat
R_FindNPC(t.NPCID, Twin);
begin
if (overFake) then
begin
Mouse(699,423,2,2,Mouse_left);
continue;
end;
if GoUp then
begin
R_FindNPC(t.NPCID, Twin);
ControlArm('u',CraneLoc);
continue;
end;
if GoDown then
begin
R_FindNPC(t.NPCID, Twin);
ControlArm('d',CraneLoc);
continue;
end;
if GoLeft then
begin
R_FindNPC(t.NPCID, Twin);
ControlArm('l',CraneLoc);
continue;
end else
if GoRight then
begin
R_FindNPC(t.NPCID, Twin);
ControlArm('r',CraneLoc);
continue;
end;

end;
until(FindBlackChatMessage('Evil'));
end;

Procedure BackToDoor;
begin
doorLoc.x:= R_GetTileGlobal.x - 5;
doorLoc.y:= R_GetTileGlobal.y + 1;
R_OpenDoor(doorLoc,'W');
end;

Procedure WaitTilInRoom;
var PlayerLoc: TPoint;
begin
repeat
wait(100);
until(R_FindNPC('Molly',Molly));
PlayerLoc := R_TileToMS(Molly.Tile)
Mouse(playerLoc.x, PlayerLoc.Y, 1, 1, Mouse_Left);
end;

begin
SetupSRL;
SetupReflection;
ActivateClient;
if InMollyRoom then
begin
MakeCompass('N');
WalkOutDoor;
GoToControls;
WaitForControl;
t:= findEvilTwin;
CatchTheFake;
repeat
wait(100);
until(FindNPCCHatText('Molly',nothing));
ClickToContinue;
ChatWait;
ClickToContinue;
makeCompass('w');
doorLoc.x:= R_GetTileGlobal.x - 5;
doorLoc.y:= R_GetTileGlobal.y + 1;
mousetile := R_TileToMS(doorLoc);
Mouse(mouseTile.x, Mousetile.y, 1, 1, Mouse_left)
wait(4000);
R_OpenDoor(R_GetTileGlobal,'W');
waitTilInRoom;
wait(1000);
clicktoContinue;
ChatWait;
ChatWait;
ClickToContinue;
ChatWait;
ChatWait;
ClickToContinue;
end;




end.

The Function InMollyRoom will detect if you are in the random.

I'd like to know if this works for everyone. I found that the index of the twin was always the lowest number out of all the possible evil twins so it wasn't too difficult figuring out.