SRL Archive - Unofficial Development

Danlib - Resizable OSRS Include


Dan the man

2019-08-25 23:30:23

Hi all,

Thought I would drop my resizable OSRS include here for those that are wanting something to use outside of fixed mode.

A lot of the code came from Aerolib and SRL/OSR (because why reinvent the wheel), so hats off to Flight, Olly and Slacky for that.

The include is pretty straight forward. In order to initiate it, declare it at the top of the script with:
{$i Danlib/Danlib.Simba} 

It doesn't require any initiation functions in order to run.

Since it works in resizable, it doesn't have static locations declared like AL and SRL/OSR does. A lot of the locations are calculated using the client dimensions.

A few example functions:

function GetMSDimensions: TBox; // Outputs a tbox for the bounds of the client
function GetMMBox:TBox; // Outputs a tbox for the bounds of the minimap
function GetChatBox: TBox; // Outputs a tbox for the bounds of the chatbox
function GetMenuBox(MPanel:string): TBox; // Outputs the tbox for the inventory tab
function GetInventoryDimensions: Tbox; // Outputs the tbox for the inventory
function GetOrbAmount(OrbType: string): integer;// Outputs the amount of hp we have left
function GetBankScreenBox(var BankBox:TBox; TabbedBanking:boolean):boolean; // Gets the BankScreenBox if it is visible and stores it into the tbox var. Checks if using tabs or not.
When the box locations are searched for the first time, it will store the locations into a global var, allowing for faster finding in future calls.

An example of how these can be used:
program new;
{$i Danlib/Danlib.Simba}

var
Col:TColEx;
TPA:TPointArray;
begin
Col.create(0, 0);
if Col.findAllIn(GetMSDimensions, TPA) then
DebugTPA(TPA, '');
end.

Include also supports discord notifications.
Open chat.simba in Danlib\Chat and add your hook URL to line 2.
You can make your own function, or use the functions in Discord.simba in Danlib\Utility

program new;
{$i Danlib/Danlib.Simba}
var
XpGained:integer;

begin
ScriptName := 'TestExample';
SendDiscordWebhook(FormatDiscordMsg(XpGained, 'Terminated for whatever reason'));
end.
Would output:

[13:25:43]

__
Script Name: TestExample
Player Name:
Start Time: 01:25:43 PM
Stop Time: 01:25:43 PM
Duration: 0 Seconds
XP Gained: 0
Terminate Reason: Terminated for whatever reason
__

If there is enough interest in this, I will write a few tutorials and add more explanations around each function.

Let me know if you have any questions.

Github link: https://github.com/ImTheNewGuy/Danlib

LordJashin

2019-08-26 20:17:38

Nice +Rep. I will probably try to include this in my scripts at some point. Idk if Jamflex looks for it in their bot searching. But will definitely help. Ill keep this bookmarked. I personally don't play on fixed myself.

bluecereal

2019-08-26 21:43:16

rarararep! nice work m8

acow

2019-08-26 22:18:07

Thanks for sharing.

Dan the man

2019-08-27 03:05:07

Thanks guys :)

felparers

2019-08-27 11:23:04

Sweet, thanks!

Jenslilleman

2019-08-31 14:49:10

Error: Access violation please help?

Dan the man

2019-08-31 20:21:51

From: Jenslilleman
Error: Access violation please help?


Need more details. When are you getting this error?

EZ41

2020-07-09 00:43:19

hey Dan, thank you for sharing! havent tried much but it looks promising :)

Some changes needed to make it compatible with newer Simba versions & get it running. Let me know if you'd like me to make a pull request with what I did.

From: Jenslilleman
Error: Access violation please help?


There is other stuff you will need to fix, but to get you started:
open Danlib/Danlib.simba replace

{$loadlib libsimpleocr}


with

{$IFDEF SIMBAMAJOR1200}
{$loadlib SimpleOCR}
{$ELSE}
{$loadlib libsimpleocr}
{$ENDIF}