SRL Archive - RS3 Help

summoning include help


footballjds

2013-12-12 13:32:17

Hey guys, if you don't have anything nice to say than PLEASE COMMENT HERE :)

I'm trying to make an include for srl-6 summoning. I want you to critique my work.
Tell me what to change and improve, tell me what to add, etc.
//this creates a type to store information about the familiar
type
_familiar = record
name: string;
timer, timer_length, points_needed: integer;
end;

var
_fam_option_point: TPoint;

//starts the timer for the familiar summoned
procedure _familiar.setTimer;
begin
self.timer := getSystemTime;
end;

{This function checks to see how much time our familiar has left}
function _familiar.getRemaining(): integer;
begin
result := self.timer + self.timer_length - getSystemTime;
end;

//This function checks to see if we have a familiar
function _familiar.isSummoned(closeOut, check: boolean; minTime: integer = 60000): boolean;
begin
//if we don't want to check we'll go by the timer
if not(check) then exit(self.getRemaining > minTime);
mouseCircle(_fam_option_point.x, _fam_option_point.y, 10, MOUSE_RIGHT);
if chooseOption.isOpen(randomRange(1000, 3000)) then
result := chooseOption.optionsExist(['Dismiss']);
if closeOut then chooseOption.close;
end;

//Estimates number of summoing points
function _familiar.getPoints: integer;
begin
if players[currentPlayer].skillLevel[SKILL_SUMMONING] < 1 then
begin
writeln('Set current players summoning level!');
exit;
end;
result := round((players[currentPlayer].skillLevel[SKILL_SUMMONING]*actionBar.getSummoningPercent)/100);
end;

{This function will dismiss any familiar that may be summoned}
function _familiar.dismiss: boolean;
begin
if self.isSummoned(false, true) then
result := chooseOption.select(['Dismiss'], randomRange(1000, 3000)) else
begin
result := true;
chooseOption.close;
end;
end;

{This funciton will attempt to summong a familiar
The optional paramater will simply renew if it is able to}
function _familiar.summon(slot: integer; renew: boolean = false): boolean;
begin
if self.getPoints < self.points_needed then
begin
writeln('We do not have the required points to summon a familiar.');
exit;
end;
if renew and inRange(self.getRemaining, 1000, 130000) then
begin
mouseCircle(_fam_option_point.x, _fam_option_point.y, 10, MOUSE_RIGHT);
result := chooseOption.select(['Renew'], randomRange(1000, 3000));
end;
if (not result) and (tabBackpack.isItemInSlot(slot)) and (self.getRemaining < 130000)then
begin
tabBackpack.mouseSlot(slot, MOUSE_LEFT);
result := true;
end;
if result then self.setTimer;
end;

begin
_fam_option_point := [445, 325];
end;

Hoodz

2013-12-12 14:23:13

things to add (?): open the screen of BoB (like a packyak)

edit: not sure how that works, haven't logged in on rs2/3 since 20 nov 2012


and good job!

Ashaman88

2013-12-12 14:40:40

Also add getting time remaining of familiar if you already have one summoned when the script starts. I had something written for it in RS2. Maybe add a use special ability function?

footballjds

2013-12-12 15:14:20

From: hoodz
things to add (?): open the screen of BoB (like a packyak)

edit: not sure how that works, haven't logged in on rs2/3 since 20 nov 2012


and good job!


all you gotta do is right-click and hit open.

From: Ashaman88
Also add getting time remaining of familiar if you already have one summoned when the script starts. I had something written for it in RS2. Maybe add a use special ability function?


It looks like the char colors are static for time remaining in the summoning interface so that should be easy enough. I'll mod the getRemaining to have an optional boolean that checks the interface tab .

Ashaman88

2013-12-12 15:20:07

From: footballjds
all you gotta do is right-click and hit open.



It looks like the char colors are static for time remaining in the summoning interface so that should be easy enough. I'll mod the getRemaining to have an optional boolean that checks the interface tab .


Or just edit the settimer to check it and edit it that once so you don't have to continue going back to that tab (if i understand the code correctly, haven't looked in depth)

Coh3n

2013-12-13 00:02:51

I don't know anything about Summoning, so I'll just comment on your standards (which are fine for the most part).

  • Types should be named with a "TRS" prefix. Also, is there a reason you have the _familiar type internal (with a '_')?
  • All SRL files disable Lape's "auto-invoke" feature, so you'll need to add () after all your procedure calls.
  • You should use white space in your code. Makes it neater and much easier to read/follow.
  • SRL-6 functions use the print() function (no writeln's), but that can be changed later.

I'm pretty picky with standards, so I point out everything. Everything else is great though and I'm glad to see you working on some SRL-6 development. :)

footballjds

2013-12-13 11:19:08

From: Coh3n
I don't know anything about Summoning, so I'll just comment on your standards (which are fine for the most part).

  • Types should be named with a "TRS" prefix. Also, is there a reason you have the _familiar type internal (with a '_')?
  • All SRL files disable Lape's "auto-invoke" feature, so you'll need to add () after all your procedure calls.
  • You should use white space in your code. Makes it neater and much easier to read/follow.
  • SRL-6 functions use the print() function (no writeln's), but that can be changed later.

I'm pretty picky with standards, so I point out everything. Everything else is great though and I'm glad to see you working on some SRL-6 development. :)


thanks, i'll work on that