SRL Archive - SRL Archives

RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);


1337_macro

2006-06-27 22:04:51

i kinda made this out of nesesity, because my antirandoms uses the inventory gametab and the RealEatIfNeeded uses the stats gametab… This will check hp, eat if needed, and logout if out of food

[PHP]{*******************************************************************************
RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
By: 1337_Macro
Description: Will check hp, eat if needed, and logout if out of food
*******************************************************************************}


procedure RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
var
RealEatIfNeededMark:integer;
begin
if ((TimeFromMark(RealEatIfNeededMark) / 1000) / 60 >= minutes) then
begin
MarkTime(RealEatIfNeededMark);
Writeln('Checking Hp');
begin
if(GetHp<= EatHp)and(FoodColor>= 0)then
begin
GameTab(4);
wait(10 + random(20));
if(FindColorSpiraltolerance(x, y, foodcolor, 560, 210, 730, 460, 2))then
begin
MMouse(x + 2, y - 2, 6, 5)
if(IsUpText('Eat'))then
begin
GetMousePos(x, y);
mouse(x, y, 3, 2, true);
end;
end
Else
begin
if(FoodLogout)then
begin
logout;
Players[CurrentPlayer].Active:= false;
end;
end;
end;
end;
end;
end;[/PHP]


put this in the main loop before the repeat…
MarkTime(RealEatIfNeededMark);

ub3r |<1||3r*1337*

2006-06-27 22:11:43

[php]procedure RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
var
RealEatIfNeededMark:integer;
begin
if ((TimeFromMark(RealEatIfNeededMark) / 1000) / 60 >= minutes) then
begin
MarkTime(RealEatIfNeededMark);
Writeln('Checking Hp');
begin
if(GetHp<= EatHp)and(FoodColor>= 0)then
begin
GameTab(4);
wait(10 + random(20));
if(FindColorSpiraltolerance(x, y, foodcolor, 560, 210, 730, 460, 2))then
begin
MMouse(x + 2, y - 2, 6, 5)
if(IsUpText('Eat'))then
begin
GetMousePos(x, y);
mouse(x, y, 3, 2, true);
end;
end
Else
begin
if(FoodLogout)then
begin
logout;
Players[CurrentPlayer].Active:= false;
end;
end;
end;
end;
end;
end;[/php]
Use that. It now has standards.

EDIT: :S i'm not sure if it is proper standards

1337_macro

2006-06-27 22:13:02

my bad i forgot to put it in code bracket… i used standereds in it

WhiteShadow

2006-06-27 23:07:35

Looks great. ub3r that's very Dirty coding.

1337_macro

2006-06-28 11:52:11

Thanks for the comment… I just tested it and it works wonderfuly…

Dark_Sniper

2006-06-28 12:08:27

From: WhiteShadow
Looks great. ub3r that's very Dirty coding.


thats how i use standards….unless SRL changed them i think thats how you do it… mabye he screwed up somewhere i didnt see.

ub3r |<1||3r*1337*

2006-06-28 12:39:00

From: WhiteShadow
Looks great. ub3r that's very Dirty coding.


Ok then, how do the 'proper' standards go? if thats not how it is?

Wizzup?

2006-06-28 13:07:11

Hm.. just an idea, try using a foodbitmap instead of foodcolor. :)

1337_macro

2006-06-28 13:32:19

i might try that thanks…

Bebe

2006-06-28 14:59:14

From: ub3r |<1||3r*1337*
Ok then, how do the 'proper' standards go? if thats not how it is?

Here you go:

{*******************************************************************************
RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
By: 1337_Macro
Description: Will check hp, eat if needed, and logout if out of food
*******************************************************************************}
procedure RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
var
RealEatIfNeededMark:integer;
begin
MarkTime(RealEatIfNeededMark);
if((TimeFromMark(RealEatIfNeededMark) / 1000) / 60 >= minutes)then
begin
MarkTime(RealEatIfNeededMark);
Writeln('Checking Hp');
begin
if(GetHp<= EatHp)and(FoodColor>= 0)then
begin
GameTab(4);
wait(10 + random(20));
if(FindColorSpiraltolerance(x, y, foodcolor, 560, 210, 730, 460, 2))then
begin
MMouse(x + 2, y - 2, 6, 5)
if(IsUpText('Eat'))then
begin
GetMousePos(x, y);
mouse(x, y, 3, 2, true);
end;
end Else
begin
if(FoodLogout)then
begin
logout;
Players[CurrentPlayer].Active:= false;
end;
end;
end;
end;
end;
end;

or even better:

{*******************************************************************************
RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
By: 1337_Macro
Description: Will check hp, eat if needed, and logout if out of food
*******************************************************************************}
procedure RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
var
RealEatIfNeededMark:integer;
begin
MarkTime(RealEatIfNeededMark);
if((TimeFromMark(RealEatIfNeededMark) / 1000) / 60 >= minutes)then
begin
MarkTime(RealEatIfNeededMark);
Writeln('Checking Hp');
begin
if(GetHp<= EatHp)and(FoodColor>= 0)then
begin
GameTab(4);
wait(10 + random(20));
if(FindColorSpiraltolerance(x, y, foodcolor, 560, 210, 730, 460, 2))then
begin
MMouse(x + 2, y - 2, 6, 5)
if(IsUpText('Eat'))then
begin
GetMousePos(x, y);
mouse(x, y, 3, 2, true);
end;
end Else
begin
if(FoodLogout)then
begin
logout;
Players[CurrentPlayer].Active:= false;
end;
end;
end;
end;
end;
end;

1337_macro

2006-06-28 15:19:39

Mine is close

Dark_Sniper

2006-06-28 15:22:59

bebe i learned it was double spaces…

were id the guide :D

1337_macro

2006-06-28 16:05:37

gah everyone is posting about the standereds but come on guys post about the code lol….it works wonderfuly

Dankness

2006-06-28 17:05:38

I think about 5 or 6 of those Begin/End statements could be elimated stream-lining this procedure.

WhiteShadow

2006-06-28 17:26:14

From: 1337_macro
gah everyone is posting about the standereds but come on guys post about the code lol….it works wonderfuly


I posted something nice. (: Very useful for all fighters!

Bego

2006-06-30 02:30:31

[php]{*******************************************************************************
RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
By: 1337_Macro
Description: Will check hp, eat if needed, and logout if out of food
*******************************************************************************}
procedure RealEatIfNeededTime(foodcolor, Eathp, minutes: Integer; foodlogout: boolean);
var
RealEatIfNeededMark:integer;
begin
if ((TimeFromMark(RealEatIfNeededMark) / 1000) / 60 >= minutes) then
begin
MarkTime(RealEatIfNeededMark);
Writeln('Checking Hp');
begin
if(GetHp<= EatHp)and(FoodColor>= 0)then
begin
GameTab(4);
wait(10 + random(20));
if(FindColorSpiraltolerance(x, y, foodcolor, 560, 210, 730, 460, 2))then
begin
MMouse(x + 2, y - 2, 6, 5)
if(IsUpText('Eat'))then
begin
GetMousePos(x, y);
mouse(x, y, 3, 2, true);
end;
end else
begin
if(FoodLogout)then
begin
logout;
Players[CurrentPlayer].Active:= false;
end;
end;
end;
end;
end;
end;[/php]

I know 100% scripting standards and that is it, and thats a fact.

EDIT: I once made a tutorial for 100% standards… here it is:

[php]//////100% Standard Scripting Tutorial////
////// BY BEGO ////

program TestPlease; {All BOLD printed words must be lower case and titles with multiple words will be CamelCapped for readability.}

var {You will space out your script and when writing variables you will hit enter and hit space twice and type your variables.}
TestVar, TestVar2 : string; {When using mathamatical, and other specific signs (+, -, *comma*, :, =) you will have a space before and after them.}
{When declaring global variables, you are supposed to mark them by going GBL*variable name*, but its really not necessary.}
procedure FindColors;
var
x, y : integer;
begin
if(findcolor(x, y, 298398, 887, 989, 985, 983))and
(findcolor(x, y, 294989, 549, 943, 489, 989))then {If there is multiple things like here for neatness stack them like this.}
begin
exit;
end;
end;

procedure randomize;
var
RandNum : integer; {Variables will be used in procedures, global variables aren't good practice, but are acceptable if needed.}
begin
RandNum := Random(2);
case (randnum) of {You will use parenthesis to surround the object of the procedure}
0 : TestVar2 := 'Test';
1 : TestVar2 := 'Test.'; {You shall NOT write multiple procedures on one line, each procedure and command will be on a seperate line.}
end;
end;

procedure TestProc;
begin {With every begin, there will be two spaces added to the indent of the code, then with every end, there will be an indent decreased to match up.}
if(TestVar2 = TestVar)then {If the constant, procedure, function, or variable is CamelCapped, the declaration of it will be too.}
begin
Writeln('They are equal!'); {With every procedure or function you will put a semicolon at the end.}
end else
begin
Writeln('They are not equal!');
end;
end;

begin
TestVar := 'Test.';
randomize;
TestProc;
end.[/php]