footballjds
12-12-2013, 06:32 PM
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;
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;