SRL Archive - SRL Archives

Notes Functions!


TRiLeZ

2009-09-18 08:29:19


{*******************************************************************************
function HowManyNotes: integer;
By: TRiLeZ
Description: Results the number of notes the user has made.
*******************************************************************************}
function HowManyNotes: integer;
var
I, X, Y: Integer;
begin
if (not (GetCurrentTab = tab_Notes)) then
begin
if GameTab(tab_Notes) then WaitColor(564, 214, 6795405, 1, 500);
end;
if (GetCurrentTab = tab_Notes) then
begin
for I := 0 to 30 do
begin
if FindText(x, y, IntToStr(i), SmallChars, 630, 203, 668, 236) then Result := I;
end;
end;
end;

{*******************************************************************************
function AddNote(Note: string): boolean;
By: TRiLeZ
Description: Adds a note. Results true if successful.
*******************************************************************************}
function AddNote(Note: string): boolean;
var
T: Integer;
begin
if (not (GetCurrentTab = tab_Notes)) then
begin
if GameTab(tab_Notes) then WaitColor(564, 214, 6795405, 1, 500);
end;
if (GetCurrentTab = tab_Notes) then
begin
if (GetColor(564, 214) = 6795405) then
begin
Mouse(565, 217, 4, 4, true);
MarkTime(t);
while (GetColor(236, 485) = 6321792) do
begin
Wait(RandomRange(2, 5));
if (TimeFromMark(t) >= 7500) then Exit;
end;
Wait(RandomRange(1000, 1500));
TypeSend(Note);
Result := True;
end;
end;
end;

{*******************************************************************************
function DeleteAllNotes: boolean;
By: TRiLeZ
Description: Deletes all notes. Results true if successful.
*******************************************************************************}
function DeleteAllNotes: boolean;
var
T: Integer;
begin
if (not (GetCurrentTab = tab_Notes)) then
begin
if GameTab(tab_Notes) then WaitColor(564, 214, 6795405, 1, 500);
end;
if (GetCurrentTab = tab_Notes) then
begin
if (GetColor(722, 453) = 1976367) then
begin
Mouse(722, 453, 4, 4, false);
if WaitOption('Delete all', 2500) then
begin
MarkTime(t);
while (not GetColor(481, 362) = 10264383) do
begin
Wait(RandomRange(2, 5));
if (TimeFromMark(t) >= 7500) then Exit;
end;
Wait(RandomRange(1000, 1500));
Mouse(257, 401, 6, 4, true);
Result := True;
end;
end;
end;
end;

Some functions for notes in RS.

JAD

2009-09-18 08:35:23

Sorry to be such a stickler, but some of that code looked a little ugly to me :p

Modified:


{*******************************************************************************
function HowManyNotes: integer;
By: TRiLeZ
Description: Results the number of notes the user has made.
*******************************************************************************}
function HowManyNotes: integer;
var
I, X, Y: Integer;
begin
if (not (GetCurrentTab = 36)) and GameTab(tab_Notes)then
WaitColor(564, 214, 6795405, 1, 500);
if (GetCurrentTab = 36) then
for I := 0 to 30 do
if FindText(x, y, IntToStr(i), SmallChars, 630, 203, 668, 236) then Result := I;
end;

{*******************************************************************************
function AddNote(Note: string): boolean;
By: TRiLeZ
Description: Adds a note. Results true if successful.
*******************************************************************************}
function AddNote(Note: string): boolean;
var
T: Integer;
begin
if (not (GetCurrentTab = 36)) andGameTab(tab_Notes) then
WaitColor(564, 214, 6795405, 1, 500);
if (GetCurrentTab = 36) and (GetColor(564, 214) = 6795405)then
begin
Mouse(565, 217, 4, 4, true);
MarkTime(t);
while (GetColor(236, 485) = 6321792) do
begin
Wait(RandomRange(2, 5));
if (TimeFromMark(t) >= 7500) then Exit;
end;
Wait(RandomRange(1000, 1500));
TypeSend(Note);
Result := True;
end;
end;

{*******************************************************************************
function DeleteAllNotes: boolean;
By: TRiLeZ
Description: Deletes all notes. Results true if successful.
*******************************************************************************}
function DeleteAllNotes: boolean;
var
T: Integer;
begin
if (not (GetCurrentTab = 36))and GameTab(tab_Notes) then
WaitColor(564, 214, 6795405, 1, 500);
if (GetCurrentTab = 36) and (GetColor(722, 453) = 1976367) then
begin
Mouse(722, 453, 4, 4, false);
if not WaitOption('Delete all', 2500) then Exit;
MarkTime(t);
while (not GetColor(481, 362) = 10264383) do
begin
Wait(RandomRange(2, 5));
if (TimeFromMark(t) >= 7500) then Exit;
end;
Wait(RandomRange(1000, 1500));
Mouse(257, 401, 6, 4, true);
Result := True;
end;
end;

Doesn't that look much cleaner?

Great job though :)

Sir R. M8gic1an

2009-09-18 10:39:27

(GetCurrentTab = 36) –> GGGAAARRRHH. There's a reason for the constants.

(GetCurrentTab = Tab_Notes). Numbers change.

Also JAD,
if (not (GetCurrentTab = 36))and GameTab(tab_Notes) then
is useless as GameTab(tab_Notes) already checks for GetCurrentTab.

~RM

TRiLeZ

2009-09-18 10:41:36

From: Rasta Magician
(GetCurrentTab = 36) –> GGGAAARRRHH. There's a reason for the constants.

(GetCurrentTab = Tab_Notes). Numbers change.

Also JAD,
if (not (GetCurrentTab = 36))and GameTab(tab_Notes) then
is useless as GameTab(tab_Notes) already checks for GetCurrentTab.

~RM


I forgot tab_Notes was an int :p I thought about it and thought it wasnt an int… so I used 36… im kinda tired.

Edit: I edited tab_Notes in the first post.

Rich

2009-09-18 11:48:45

http://www.villavu.com/forum/showthread.php?t=47531

Sorry!

TRiLeZ

2009-09-18 11:52:51

From: R1ch
http://www.villavu.com/forum/showthread.php?t=47531

Sorry!


My functions are better :p
And I have one function that you dont have.. note counting :)

YoHoJo

2009-09-18 11:58:32

I hate making my own funcs (like for SRL) because either someones already made them or the devs hate us and dont implement ours and make their own :'[

Rich

2009-09-18 11:59:40

Some of your functions may be better, but I have a function that you don't have :p I have a function which will delete a certain amount. Anyway, when I posted first off, I meant that if mine was to be committed, they could have changed it to make it better, but they didn't…

EDIT: Yoho, happened to me the other day…

Gu3st...

2009-09-18 15:55:58

What is the use?

Sir R. M8gic1an

2009-09-18 16:14:11


{*******************************************************************************
function HowManyNotes: integer;
By: TRiLeZ
Description: Results the number of notes the user has made.
*******************************************************************************}
function HowManyNotes: integer;
var
I, X, Y: Integer;
begin
if (not (GetCurrentTab = 36)) and GameTab(tab_Notes)then
WaitColor(564, 214, 6795405, 1, 500);
if (GetCurrentTab = 36) then
for I := 0 to 30 do
if FindText(x, y, IntToStr(i), SmallChars, 630, 203, 668, 236) then Result := I;
end;

—>

{*******************************************************************************
function HowManyNotes: integer;
By: TRiLeZ
Description: Results the number of notes the user has made.
*******************************************************************************}
function HowManyNotes: integer;
var
I, X, Y: Integer;
begin
if not GameTab(tab_Notes) then exit;

for I := 0 to 30 do
if FindText(x, y, IntToStr(i), SmallChars, 630, 203, 668, 236) then Result := I;
end;

Also, i hate the fact that you use FindText, certainly it can be done with a simple color search? And if so, you can get the lowest pixel of color, and use a formula to calculate how many notes there are?

~RM

Naum

2009-09-18 20:25:25

Function HowManyNotes : Integer;
Begin
If Not GameTab(Tab_Notes) Then Exit;
Result := StrToInt(Trim(GetTextAtEx(646, 212, 0, SmallChars, False, False, 0, 2, 3381759, 2, False, Tr_Digits)));
End;

That's using text grabbing :).

Also, I made a few:

Function HowManyNotes : Integer;
Begin
If Not GameTab(Tab_Notes) Then Exit;
Result := StrToInt(Trim(GetTextAtEx(646, 212, 0, SmallChars, False, False, 0, 2, 3381759, 2, False, Tr_Digits)));
End;

Function NoteCoords(NoteNumber : Integer) : TPoint;
Begin
Result := Point(557, 240 + 15* NoteNumber);
End;

Procedure ClickNote(NoteNumber : Integer; Option : String);
Var TP : TPoint;
Begin
TP := NoteCoords(NoteNumber);
Mouse(TP.x, TP.y, 150, 12, Option = '');
WaitOption(Lowercase(Option), 1500);
End;


Note: NoteNumber starts at Index of '0'. In ClickNote leave 'option' blank if you want to left click :)