Jump to content
Wanted

OSI 2 Updates! Major RS07 Progress!!

Recommended Posts

https://github.com/OfficialSCARInclude/OSI2/commit/3b4a8c69a198bccd91e0dc932e38f1b8bf683041

 

OSI still compiling in under 90ms!!

RS07 Global Additions

Half of Game Tab functions

Half of Inventory functions

Half of Map functions

FindBitmapColor routines

Box/TBAFromGrid

TPAExtractPoints/TPAExtractSlice RS07 compatibly

Small structure change. Game-TabX above Game-Tabs.scar

Add DTM.scar, DTM Wrappers

FindBitmap Wrappers

More FindColor Wrappers

 

Lots of goodies!

 

Let's just go down the list

 

Globals

 

MMTPA is now available! With backup (not that is ever going to be needed, but hey...)!

 

83172326.png

 

[sCAR]{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function MMTPA: TPointArray;

Contributors: Wanted

Description: All MiniMap dynamic points.

Date Created: March 7th, 2013. By Wanted. RS07 Build ???.

Last Modified: March 7th, 2013. By Wanted. RS07 Build ???.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}[/sCAR]

 

[sCAR]{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function MMPA: LongInt;

Contributors: Wanted

Description: MiniMap TPA search are pixel count. Like this because if it reverts

or ever changes this has to be dynamically changable.

Date Created: March 7th, 2013. By Wanted. RS07 Build ???.

Last Modified: March 7th, 2013. By Wanted. RS07 Build ???.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}[/sCAR]

 

GameTab

 

Half? Ok I guess ALL of them that I can think of for now are done. I forgot I moved out all the other functions into their respective files in \GameTabs\

 

[sCAR] * function GetAllTabBounds: TBoxArray;

By: Wanted

* function GetTabBounds(Tab: Integer): TBox;

By: Wanted

* function TabExists(Tab: Integer): Integer;

By: Wanted

* function GetCurrentTab: Integer;

By: Wanted

* function SetGameTab(Tab: Integer): Integer;

By: Wanted[/sCAR]

 

 

 

[sCAR]{$DEFINE RS07}

{$DEFINE OSI_RS07_Color_Anti_Randoms}

 

{$I OSI\OSI.scar}

{$I OSI\Divi\Misc\Debug.scar}

 

procedure ScriptTerminate;

begin

FreeOSI;

end;

 

begin

SetUpOSI;

DebugTBA(GetAllTabBounds)

end.[/sCAR]

 

[sCAR]const

Tab_Count = 14;

Tab_Combat = 0;

Tab_Stats = 1;

Tab_Quest = 2;

Tab_Inv = 3;

Tab_Equip = 4;

Tab_Prayer = 5;

Tab_Magic = 6;

Tab_Clan = 7;

Tab_Friends = 8;

Tab_Ignore = 9;

Tab_LogOut = 10;

Tab_Options = 11;

Tab_Emotes = 12;

Tab_Music = 13;[/sCAR]

 

31372149.png

 

Inventory

 

I couldn't do any of the OCR (i.e. Drop functions) they are already coded but there is no chooseoption yet! Fear not that will be done soon for now here's the other half! well....2/3 really..

 

[sCAR] * function GetAllInvSlotBounds: TBoxArray;

By: Wanted

* function InvSlotsBounds: TBox;

By: Wanted

* function GetInvSlotBounds(Slot: Integer): TBox;

By: Wanted

* function CordsToInvSlot(P: TPoint): Integer;

By: Wanted

* function InvItemExists(Slot: Integer; CheckIT: Boolean): Boolean;

By: Wanted

* function InvCount(CheckIT: Boolean): Integer;

By: Wanted

* function InvFull(CheckIT: Boolean): Boolean;

By: Wanted

* function InvEmpty(CheckIT: Boolean): Boolean;

By: Wanted

* function MouseItem(Slot: Integer; TypeC: ClickActions; CheckIT: Boolean): Boolean;

By: Wanted

* function DragItem(FromSlot, ToSlot: Integer; CheckIT: Boolean): Boolean;

By: Wanted

* function FindInvItemsDTM(dtm: Integer; CheckIT: Boolean): TIntegerArray;

By: Wanted

* function CountInvItemsDTM(dtm: Integer; CheckIT: Boolean): Integer;

By: Wanted

* function FindInvItemsBMP(bmp, Tol: Integer; CheckIT: Boolean): TIntegerArray;

By: Wanted

* function CountInvItemsBMP(bmp, Tol: Integer; CheckIT: Boolean): Integer;

By: Wanted[/sCAR]

 

[sCAR]{$DEFINE RS07}

{$DEFINE OSI_RS07_Color_Anti_Randoms}

 

{$I OSI\OSI.scar}

{$I OSI\Divi\Misc\Debug.scar}

 

procedure ScriptTerminate;

begin

FreeOSI;

end;

 

begin

SetUpOSI;

DebugTBA(GetAllInvSlotBounds)

end.[/sCAR]

 

[sCAR]{$DEFINE RS07}

{$DEFINE OSI_RS07_Color_Anti_Randoms}

 

{$I OSI\OSI.scar}

{$I OSI\Divi\Misc\Debug.scar}

 

procedure ScriptTerminate;

begin

FreeOSI;

end;

 

begin

SetUpOSI;

DebugBox(InvSlotsBounds)

end.

[/sCAR]

 

31955833.png

 

Map

 

You already saw MMTPA up in Globals but here's some more useful stuff out of map... about half of all of Map.

 

[sCAR] * function OnMM(P: TPoint): Boolean;

By: Wanted

* function TPAOnMM(TPA: TPointArray): Boolean;

By: Wanted

* procedure TPAExtractMMPoints(var TPA: TPointArray);

By: Wanted

* function MMToMSEx(MM: TPoint; Height: Extended): TPoint;

By: Wanted

* function MMToMS(MM: TPoint): TPoint;

By: Wanted

* function MMOnMS(MM: TPoint): Boolean;

By: Wanted

* function MMsToMSs(TPA: TPointArray): TPointArray;

By: Wanted

* function FilterMMPointsMS(TPA: TPointArray): TPointArray;

By: Wanted

* function FindMMColorTol(var P: TPoint; Color, Tol: Integer): Boolean;

By: Wanted

* function FindMMColorsTolerance(var TPA: TPointArray; Color, Tol: Integer): Boolean;

By: Wanted

* procedure SetAngle(Highest: Boolean);

By: Wanted[/sCAR]

 

MMToMS needs improvement =/

 

Box/TBA

 

Here's the key functions behind GetInvItemBounds, GetTabBounds etc. Thanks to Janilabo for the idea and using something similar before me =P (the code has been in OSI 1 for a long time but never organized into its own function before!!)

 

[sCAR]{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function BoxFromGrid(P: TPoint; Index, Width, Height, Rows, Columns, RowSpace, ColumnSpace: LongInt): TBox;

Contributors: Wanted, Janilabo.

Description: Creates box from indexes of boxes arranged in rows and columns.

Date Created: March 7th, 2013. By Wanted

Last Modified: March 7th, 2013. By Wanted

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function BoxFromGrid(P: TPoint; Index, Width, Height, Rows, Columns, RowSpace, ColumnSpace: LongInt): TBox;

var

TP: TPoint;

begin

TP := Point(P.X + ((Index mod Columns) * ColumnSpace), P.Y + ((Index div Columns) * RowSpace));

Result := Box(TP.X, TP.Y, TP.X + (Width - 1), TP.Y + (Height - 1));

end;[/sCAR]

 

[sCAR]{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function TBAFromGrid(P: TPoint; Width, Height, Rows, Columns, RowSpace, ColumnSpace: LongInt): TBoxArray;

Contributors: Wanted, Janilabo.

Description: Creates TBAs arranged in rows and columns.

Date Created: March 7th, 2013. By Wanted

Last Modified: March 7th, 2013. By Wanted

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function TBAFromGrid(P: TPoint; Width, Height, Rows, Columns, RowSpace, ColumnSpace: LongInt): TBoxArray;

var

I, H: LongInt;

begin

Result := [];

H := (Rows * Columns) - 1;

SetLength(Result, H + 1);

for I := 0 to H do

Result := BoxFromGrid(P, I, Width, Height, Rows, Columns, RowSpace, ColumnSpace);

end;[/sCAR]

 

TPA

 

[sCAR]{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

procedure TPAExtractPoints(var TPA: TPointArray; WithinTPA: TPointArray);

Contributors: Wanted

Description: Removes all points in TPA not within the other TPA.

Date Created: March 7th, 2013. By Wanted

Last Modified: March 7th, 2013. By Wanted

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

procedure TPAExtractPoints(var TPA: TPointArray; WithinTPA: TPointArray);

var

TBLA: TBooleanArray;

I, H: LongInt;

begin

H := High(TPA);

SetLength(TBLA, H + 1);

for I := 0 to H do

if (not (TPAContains(WithinTPA, TPA))) then

TBLA := True;

for I := 0 to H do

if (TBLA) then

TPADelete(TPA, I);

end;[/sCAR]

 

Fixed TPAExtractSlice for RS07 too

 

Wrappers

 

OSI is moving towards Point in Box wrappers in your functions!

 

Basically what this is Allowing you to do FindColorsP(P, Color, B) instead of typing out P.X, P.Y, B.X1, B.Y1 etc. very annoying indeed! this is being applied to all kinds of things! Everything eventually! You can imagine it's a lot of redundant work so I'm doing them as I go or when I get bored, feel free to request specific ones :)

 

Bitmap

 

Introducing a new way to search for colors (Much like 'Freeze', 'Unfreeze' in simba) this method has also been in OSI for a long time but is finally refined now thanks to Freddy's new SCAR bmp system, Janibalo's great idea for innovations, and me putting it all together.

 

[sCAR] * function FindBitmapColorIn(var P: TPoint; Color: LongInt; bmp: TSCARBitmap; B: TBox): Boolean;

By: Wanted

* function FindBitmapColor(var P: TPoint; Color: LongInt; bmp: TSCARBitmap): Boolean;

By: Wanted

* function FindBitmapColorExIn(var TPA: TPointArray; Color: LongInt; bmp: TSCARBitmap; B: TBox): Boolean;

By: Wanted

* function FindBitmapColorEx(var TPA: TPointArray; Color: LongInt; bmp: TSCARBitmap): Boolean;

By: Wanted [/sCAR]

 

You can now capture a part of the screen and 'freeze' it or just search for colors on a normal bitmap simply by calling a different FindColor function listed about.

 

Example of this powerful usage below in LoadMMTPA

 

[sCAR]{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

procedure LoadMMTPA;

Contributors: Wanted

Description: Loads all points of the minimap and count of that for use in MMTPA

and MMPA by using a Blank Map and reverting to 6 pie slices if failed.

Date Created: March 7th, 2013. By Wanted. RS07 Build ???.

Last Modified: March 7th, 2013. By Wanted. RS07 Build ???.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

procedure LoadMMTPA;

var

bmpBlankMap: TSCARBitmap;

ATPA: T2DPointArray;

I: Integer;

begin

bmpBlankMap := TSCARBitmap.Create('deNrt1TESAjEMBEH/PyPiuUdKBAHlK0bu' +

'/YGmAz3Wc03a9XHL/g/ll2lbkWLXlWLXlWLXlWLXlWKXxjoW7ho0XtRggYM1Hu' +

'46cryo8aIGKw3HqKVGp6XGJaSGowVHoaWmf0tN+Zaa5i01tVtqOufURG6RKdxS' +

'07alpmpLTc+cmpgtMiVbahq21NTLqUnXItMtpyZai0yxnJpcLTKtWmoq5dQkap' +

'Hpk1MTp0WmTE5NFmS2lUyTnJogyGwrmRo5NSmQGTJ7J9MhpyYCMjMzM4/MkCEz' +

'ZIYMmSEzZMgMmSFDZshsExm1nBcyZIbMkCEzZPaVjFrOCxkyQ2bIkBky+0pGLe' +

'eFDJndQEYt54UMmd1ARi3nhQyZ3UBGLeeFrEhGLeeFrEhGLeeFrEhGLedFrehF' +

'reiFrEhGLedFrehFregFrohFLepFregFrohFLerFrigFrotFLeoFrohFLep1LN' +

'waMV7gYIGDdY7aOmmwqPECB2uAGqmWGqOWGp2WGpeWGpGWGouWGoWWmv4tNeVb' +

'apojQ4aMGi9khowarxlqCofgVG2p6YnM9sFp2FJTL4E45swXg+jNaA==');

if (FindBitmapColorEx(MMTPAv, clWhite, bmpBlankMap)) then

begin

OffsetTPA(MMTPAv, MMX1, MMY1);

MMPAv := Length(MMTPAv);

end

else

begin

WriteLn('Failed to load bmpBlankMap!');

WriteLn('Reverting to backup MMTPA/MMPA...');

SetLength(ATPA, 6);

for I := 0 to 5 do

ATPA := TPAFromBox(MMB);

TPAExtractSlice(ATPA[0], 0, 72, -75, 75, MMCP);

TPAExtractSlice(ATPA[1], 0, 67, 245, 285, MMCP);

TPAExtractSlice(ATPA[2], 0, 67, 75, 115, MMCP);

TPAExtractSlice(ATPA[3], 0, 58, 115, 245, MMCP);

TPAExtractSlice(ATPA[4], 58, 68, 168, 195, MMCP);

TPAExtractSlice(ATPA[5], 68, 73, 173, 190, MMCP);

MMTPAv := MergeATPA(ATPA);

TPAUnique(MMTPAv);

MMPAv := Length(MMTPAv);

end;

try

bmpBlankMap.Free;

except

end;

WriteLn('Loaded MMTPA/MMPA');

MMTPALoaded := True;

end;[/sCAR]

 

Well that's all for now!

 

I am working VERY HARD to get OSI 2 /RS07 done as quickly as possible and starting with the essentials to get you all using OSI 2 with your RS07 scripts as quickly as possible while still striving for the best (runescape..and overall) include ever dreamed of.

 

Hopefully more great stuff for tomorrow!

 

OCR, Bank, the other halfs of Map and Inventory, Stats tab, Login etc.!

 

Looking forward to all your feedback and encouragements.

 

Together we can give these simba and java skids a run for their money!

 

Thanks again

 

OSI Lead developer

 

-Wanted

Edited by Wanted
Link to comment
Share on other sites

Really nice work James! Everything here looks pretty damn professional to me. :P

..and you are right, this is some major progress you have done during last few days, awesomness mate! Keep it going. So far, so good.

 

U liek teh Bitmap API Freddy built us, don't cha?! ;)

The more you learn of it, the more you'll love it.. Pretty much!

 

P.S. Gotta love those pictures, beautiful colors everywhere.

 

-Jani

Link to comment
Share on other sites

Introducing a new way to search for colors (Much like 'Freeze', 'Unfreeze' in simba) this method has also been in OSI for a long time but is finally refined now thanks to Freddy's new SCAR bmp system, Janibalo's great idea for innovations, and me putting it all together.

 

That's essentially what SCAR does internally :P

Link to comment
Share on other sites

I gotta start contributing more. Have to chuckle when "innovative" stuff I've been doing for ages in private scripts shows up in the includes.

 

Side note: MCCX is inaccurate? Would expect it to be the same as MSCX but it isn't.

 

[sCAR] MSCX = 260; // Main Screen Center Points // August 7, 2011 Wanted 660

MSCY = 171; // August 7, 2011 Wanted 660

MSX1 = 4; // Main Screen Edge Points // August 7, 2011 Wanted 660

MSY1 = 4; // August 7, 2011 Wanted 660

MSX2 = 515; // August 7, 2011 Wanted 660

MSY2 = 337; [/sCAR]

 

[sCAR] MCCX = 176; // Chat Box Center Points // March 5, 2013 Wanted ???

MCCY = 409; // March 5, 2013 Wanted ???

MCX1 = 7; // Chat Box Edge Points // August 8, 2011 Wanted 660

MCY1 = 345; // August 8, 2011 Wanted 660

MCX2 = 496; // March 5, 2013 Wanted ???

MCY2 = 473; // March 5, 2013 Wanted ???

MCPW = (MCX2 - MCX1) + 1; // Chat Box Width // June 23, 2012 LordJashin 718

MCPH = (MCY2 - MCY1) + 1; // Chat Box Height // June 23, 2012 LordJashin 718

MCPA = MIPW * MIPH; // Chat Box Area // June 23, 2012 LordJashin 718

[/sCAR]

 

93834079.png

 

It's hard to see the the gray MS box, but you can see they have different bounds and centers.

 

 

Thanks for the feedback everyone

 

Hope to get another good update out again soon

Link to comment
Share on other sites

So let me get this straight. You can capture a part of the screen (Bitmap), and only search for colors on that? Is that what the FindBitmapColorIn does?

 

Good idea :D

 

Yea all you have to do is

 

Map := GetClient.CaptureExB(MMB);

FindBitmapColor.. etc.

 

O_O last time I checked you could already do that? O_O maybe I'm just missing something.

 

Areas, but if your capturing a part of active screen /rs the pixels move pretty fast constantly so if you reference back to those points they'll have probably of moved.

 

And yes we've been able to do this for a long time in SCAR but only recently has it been made convenient.

Link to comment
Share on other sites

Yes, but *this* much difference? Here is the mouse at (MCCX, MCCY):

 

[ATTACH=CONFIG]775[/ATTACH]

 

Not where I expected it to be.

 

[sCAR]MCCX = 252; // Chat Box Center Points // March 11, 2013 Wanted ???

MCCY = 409; // March 5, 2013 Wanted ???[/sCAR]

 

That has been corrected. Nice catch. Typo on my end. Some of the other center points were a few pixels off and I have adjusted.. I have no idea how though.

 

I'll push later with Login stuff

 

You can see though it's significantly different than MSCP

 

[sCAR]MSCX = 260; // Main Screen Center Points // August 7, 2011 Wanted 660

MSCY = 171; // August 7, 2011 Wanted 660[/sCAR]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...