PDA

View Full Version : Reporting functions



Rich
10-27-2011, 06:03 PM
{************************************************* ******************************
function ToggleRCReport(HaveOn : Boolean) : Boolean;
by: Rich
Description: Toggles the right click reporting option in the tools tab
************************************************** *****************************}
function ToggleRCReport(HaveOn : Boolean) : Boolean;
begin
GameTab(tab_Options); //Opens options tab
Result:= ((GetColor(709, 444) = 1579035) xor (HaveOn)); //Checks for result - colour of toggle button when off
if Result then
Exit; //Exits is result
Mouse(700, 436, 15, 15, True); //Clicks on toggle button
Wait(300 + Random(300));
MMouse(0, 0, 680, 400); //Moves mouse to remove hover-over text to check colour
Result:= ((GetColor(709, 444) = 1579035) xor (HaveOn)); //Checks for result
if (not Result) then
SRL_Warn('ToggleRCReport', 'Could not toggle right-click report option', warn_AllVersions);
end;

{************************************************* ******************************
function ReportScreen : Boolean;
by: Rich
Description: Returns true if the report offense screen is open
************************************************** *****************************}
function ReportScreen : Boolean;
begin
Result:= (GetColor(47, 128) = 1780607); //Colour of crown in the top left of screen
end;

{************************************************* ******************************
function ReportOffense(Offense : Integer; Ignore : Boolean) : Boolean;
by: Rich
Description: Handles the report offense screen. The offense is chosen by an
integer. 1 - trading accounts, 2 - encouraging rule breaking, 3 - staff
impersonation, 4 - botting, 5 - scamming, 6 - exploiting a bug, 7 - offensive
language, 8 - solicitation, 9 - disruptive behaviour, 10 - offensive name,
11 - threatening, 12 - asking for info, 13 - real laws, 14 - advertising
Ignore is whether or not to ignore the user afterwards
************************************************** *****************************}
function ReportOffense(Offense : Integer; Ignore : Boolean) : Boolean;
var
C, I : Integer;
begin
if (not ReportScreen) then //Checks if report screen is open
begin
SRL_Warn('ReportOffense', 'No report screen found', warn_AllVersions)
Exit;
end;
C:= 1; //Inital offense column setting of 1
I:= Offense;
if (Offense > 11) then
begin
C:= 3
I:= I - 11;
end;
if (Offense > 6) then
begin
C:= 2;
I:= I - 6;
end; // ^^^ Sets offense column (columns in which offense show in report screen)
Mouse(-135 + (C * 159), 115 + (I * 29), 135, 27, True); //Clicks on chosen offense
Wait(500 + Random(300));
if (ReportScreen) then //If the screen is still open, returns false, exits
begin
SRL_Warn('ReportOffense', 'Could not file report', warn_AllVersions)
Exit;
end;
Wait(200 + Random(250));
if Ignore then
Mouse(179, 154, 160, 16, True) //Clicks to ignore user if set True
else
begin //If ignore was false
if (Random(6) = 3) then
Mouse(372, 109, 15, 15, True) //1 in 6 chance of clicking on the close button (X)
else
Mouse(179, 175, 160, 16, True); //5 in 6 chance of clicking on the "Do not ignore" button
end;
Result:= (not GetColor(164, 118) = 4106994); // Result = no ignore option box open - colour of yellow text
end;
Got bored. Decided to open up Simba and make some shiz.
I haven't written anything code wise for well over a few months, so go easy on meh!
I've tested them all and they work fine. Only problem I've got is that ToggleRCReport is slow on choosing the tab, but that is down to GameTab.

Oh, and hey!

Jakkle
10-27-2011, 06:24 PM
Nice functions :thumbsup: thing is tho we would only be reporting us :p
Been a while mate, nice to see you around :)

Rich
10-27-2011, 06:29 PM
Cheers :)

I didn't really think of that, but making them passed some time :p

Nava2
10-27-2011, 06:49 PM
Comments! Insert them. :>

Rich
10-27-2011, 07:44 PM
Comments! Insert them. :>As in commenting the code to say what does what?

EDIT: Done that.

NCDS
10-27-2011, 07:47 PM
Commenting the colors used and the clicks/movements is always useful, especially if you expect others to read/maintain your code at some point.

Nava2
10-27-2011, 07:51 PM
As in commenting the code to say what does what?

Yup, as NCDS said. Commenting the code is the big one, and the removal of magic numbers into Constants or Variables would be excellent, too!

Rich
10-27-2011, 08:37 PM
Sure. Let me finish watching Educating Essex and I'll get that done :)

Coh3n
01-04-2012, 06:15 AM
Do these all still work? :)