SRL Archive - SRL Archives

[Base]SRL Summoning branch


Flight

2011-07-06 02:12:51

I noticed in the 'skill' branch of SRL we don't have anything for Summoning, so thinking of a couple functions that people might find useful I made one. It's nothing major or advanced, but it follows the basic SRL format. I also saved it as a Simba file rather than Scar file.


// * Function UsingFamiliar: Boolean;
// * Function GetSummonPoints: Integer;
// * Function InteractFamiliar: Boolean;
// * procedure SetupSummoning;


//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Summoning routines --//
//-----------------------------------------------------------------//
// * Function UsingFamiliar: Boolean;
// * Function GetSummonPoints: Integer;
// * Function InteractFamiliar: Boolean;
// * procedure SetupSummoning;

{*******************************************************************************
Function UsingFamiliar: Boolean;
By: Flight
Description: Returns if we currently have a Summoning familiar.
*******************************************************************************}
Function UsingFamiliar: Boolean;
Var
X,Y: Integer;
begin
Result := FindColorTolerance(X,Y,11521955,695,130,720,150,20);
end;

{*******************************************************************************
Function GetSummonPoints: Integer;
By: Flight
Description: Returns our current number of Summoning points remaining.
*******************************************************************************}
Function GetSummonPoints: Integer;
Var
Color: String;
begin
Result := Round(GetMMLevels('summon',Color));
end;

{*******************************************************************************
Function InteractFamiliar: Boolean;
By: Flight
Description: Handles all interactions between our familiar,
returns true if successful.
Options:
-'' (nothing) : Will left click on interaction tab
-'Attack','Cast','Interact,'Renew','Take','Dismiss','Call','Details','Select'
*******************************************************************************}
Function InteractFamiliar(Option:String): Boolean;
begin
if (not LoggedIn) then exit;

if UsingFamiliar then
begin
if (Option = '') then
begin
MouseBox(695,140,740,155,1);
Result := True;
end else
begin
MouseBox(695,140,740,155,2);
if ChooseOption(Option) then
Result := True
else
srl_Warn('InteractFamiliar', 'Incorrect option', warn_AllVersions);
end;
end else
srl_Warn('InteractFamiliar', 'No familiar present!', warn_AllVersions);

Wait(100 + Random(50));
end;

{*******************************************************************************
procedure SetupSummoning;
By: SRL
Description: Declares Global Bitmaps.
*******************************************************************************}
procedure SetupSummoning;
begin
end;

Like I said, it's nothing unique, but it's not like we'd be taking a step back by adding this in. We can only progress from it. ;)

masterBB

2011-07-06 04:02:48

Looking good! I have no time to test it but rep+.

Flight

2011-07-06 04:18:08

Heh thanks. :) SRL is starting to get dusty in the development area, so it'd be nice to see some more progress.

I plan to capitalize on this and make this as well as Reflection 2 a requirement for my next script release.

josh81193

2011-07-06 04:27:05

Summoning seems like it would make a short/easy script. Run from Fally East bank to the guy in taverly, make pouches, use fally tab, bank, repeat.

masterBB

2011-07-06 04:30:34

I think he will make a nature runes runner, if I look at his sig. And this isn't useful for pouch making anyway.

Flight

2011-07-06 06:49:35

From: josh81193
Summoning seems like it would make a short/easy script. Run from Fally East bank to the guy in taverly, make pouches, use fally tab, bank, repeat.


Already made an released this script, and it works like a charm. ;) But, it's released in Members+ along with many other premium scripts. Maybe it's incentive for you to shoot for members. :p

TomTuff

2011-07-17 16:25:23

Bump! This is good stuff and should be added.

Coh3n

2011-07-18 09:37:36

I can only see InteractFamilair being added. The majority of one-lined functions are removed for SRL 5 as they're one line, the scripter can very easily just add that one line. The majority of skill files have also been removed simply because most of them are terribly outdated and never used. As long as InteractFamiliar can't easily get outdated (or if it's used), I see no reason why it can't be added.

Flight

2011-07-18 10:01:59

In that case, you could just replace "if UsingFamiliar then" (in InteractFamiliar) with "if FindColorTolerance(X,Y,11521955,695,130,720,150,20) then".

Although I think using color to determine if we're using a familiar or not will always be handy, not just for that function. If that's removed and the user wants to add a checker to see if we're using a familiar, they'll have to make their own FindColorTolerance (or whatever) with their own defined color in their own search area.

Coh3n

2011-07-18 11:17:20

From: Flight
In that case, you could just replace "if UsingFamiliar then" (in InteractFamiliar) with "if FindColorTolerance(X,Y,11521955,695,130,720,150,20) then".

Although I think using color to determine if we're using a familiar or not will always be handy, not just for that function. If that's removed and the user wants to add a checker to see if we're using a familiar, they'll have to make their own FindColorTolerance (or whatever) with their own defined color in their own search area.
Oh yes, you're right. I didn't realize it was used in another function. May want to add a little note in the description about that, so people know it's used in other functions in the include. The GetSummoningPoints isn't really necessary then, in my opinion.

Nava2

2011-07-18 12:57:28

Using Familiar is definitely good, getSummoningPoints, not so much.

Coh3n, the removal of one liners was supposed to be to remove 1 lined "almost identical" wrappers not to remove function calls with lots of parameters, haha! Would you want to waste time getting things like that perfect when someone else already did it? :)

TomTuff

2011-07-18 13:01:39

I think all the functions (except SetupSummoning :p) Should be kept! They all have their uses.

InteractFamiliar should be set to left click if the uptext is found without right clicking.

Flight

2011-07-18 13:42:58

From: TomTuff
I think all the functions (except SetupSummoning :p) Should be kept! They all have their uses.

InteractFamiliar should be set to left click if the uptext is found without right clicking.


I was thinking about that earlier as well, that'd be a good idea.

From: Nava2
Using Familiar is definitely good, getSummoningPoints, not so much.


I would agree, I suppose that was added to give more content to the file itself. But I did find use out of it while making and using Naturez, as when the player recharges their Summoning points at an obelisk we make sure our current summoning points are maxed out, if so then we summon a new familiar, if not then something went wrong with the recharging process…

Coh3n

2011-07-18 16:09:30

From: Nava2
Using Familiar is definitely good, getSummoningPoints, not so much.

Coh3n, the removal of one liners was supposed to be to remove 1 lined "almost identical" wrappers not to remove function calls with lots of parameters, haha! Would you want to waste time getting things like that perfect when someone else already did it? :)
Yeah that makes sense.

From: Flight
I would agree, I suppose that was added to give more content to the file itself. But I did find use out of it while making and using Naturez, as when the player recharges their Summoning points at an obelisk we make sure our current summoning points are maxed out, if so then we summon a new familiar, if not then something went wrong with the recharging process…
Useful yeah, but you can just as easily call GetMMLevels in your script. The point is that the FindColorTolerance in UsingFamiliar requires some color gathering/coordinates and isn't as simple as calling getMMLevels.