PDA

View Full Version : some game tab functions



SKy Scripter
08-06-2007, 07:59 PM
hmmm i think i fixed gametab...

i dont know if LoggedIn is broken... i just asumed...

nothing special.. just thought it could be helpful...




function LoggedIn : Boolean;
begin
Result := (GetColor(427, 486) = 16777215);
end;

function GetCurrentTab: Integer;
var
i, xx, yy : Integer;
begin
yy := 169;
for i := 0 to 13 do
begin
xx := 526 + (33 * (i mod 7));
if (i = 7) then yy := yy + 300;
if (FindColor(x, y, 1778795, xx, yy, xx + 32, yy + 32)) then
begin
Result := i + 1;
Exit;
end;
end;
end;



function TabExists(Tab : Integer ) : Boolean;
var
xx, yy : Integer;
begin
Tab := Tab -1
yy := 175;
xx := 530 + (35 * (Tab mod 7));
if (Tab > 6) then yy := yy + 300;
Result := (FindColor(x, y, 65536, xx, yy, xx + 10, yy + 10)) or
(FindColor(x, y, 986896, xx, yy, xx + 10, yy + 10)) or
(FindColor(x, y, 10996182, xx, yy, xx + 10, yy + 10));
end;

function GameTab(Tab: Integer): Boolean;
var
xx, yy, c : Integer;
begin
yy := 175;
xx := 530 + (35 * ((Tab-1) mod 7));
if ((Tab-1) > 6) then yy := yy + 300;
while (TabExists(Tab)) and
(Tab <> GetCurrentTab) and (LoggedIn) and
(C < 5) do
begin
C := C + 1;
Mouse(xx, yy, 10, 10, True);
end;
Result := (Tab = GetCurrentTab)
end;

Hugolord
08-06-2007, 08:00 PM
thanks Sky GJ.

I'm glad you didn't post this on free members section ;p

n3ss3s
08-06-2007, 08:32 PM
I can not use that since I think it would be considered as cheating in the scripting competition. They update SRL Soon enough and my script is about ready...

zenma
08-07-2007, 05:51 AM
thanks =) now i can continue making/testing my script

Sp0rky
08-07-2007, 11:50 AM
I did this within the first 15 mins of the rs update, although a bit differently :p

Tim0suprem0
08-08-2007, 06:02 AM
Thanks! So simple yet so helpful :)

Hehe and I learned what 'mod' does too

mat_de_b
08-17-2007, 10:20 PM
what does mod do?

Smartzkid
08-17-2007, 10:29 PM
Remainder

5 mod 2 equals 1.

TOB
08-18-2007, 10:22 AM
5 mod 2 equals 1.

The Element
08-18-2007, 01:18 PM
Someone should write a tut on "mod".

SKy Scripter
08-18-2007, 06:45 PM
Someone should write a tut on "mod".

agh but its so simple..

0 mod 5 = 0
1 mod 5 = 1
2 mod 5 = 2
3 mod 5 = 3
4 mod 5 = 4
5 mod 5 = 0
6 mod 5 = 1
7 mod 5 = 2
8 mod 5 = 3
9 mod 5 = 4
10 mod 5 = 0

see the pattern?

TOB
08-19-2007, 06:57 AM
Say you had 9/5 that equals 1.8 what modulus does is trim off the integer so that it can work with the decimal then it multiplies decimal times 5.

That was a difficult example for small minds.

73 divided by 5 is 14.6.

14 multiplied by 5 is 70.

0.6 multiplied by 5 is 3.

70 added to 3 is 73.

So 73 modulus 5 would be 3 because it is the remainder of 73 when what you have divided by can not make the answer a whole integer (an integer is a whole number, as 14.3 is not an integer and 5 multiplied by 15 is greater than 73.

lordsaturn
08-19-2007, 08:18 AM
Say you had 9/5 that equals 1.8 what modulus does is trim off the integer so that it can work with the decimal then it multiplies decimal times 5.

That was a difficult example for small minds.

73 divided by 5 is 14.6.

14 multiplied by 5 is 70.

0.6 multiplied by 5 is 3.

70 added to 3 is 73.

So 73 modulus 5 would be 3 because it is the remainder of 73 when what you have divided by can not make the answer a whole integer (an integer is a whole number, as 14.3 is not an integer and 5 multiplied by 15 is greater than 73.


Wtf...

Jason2gs
08-20-2007, 02:30 AM
Wtf...

Did you even try to understand it?

mat_de_b
08-21-2007, 07:05 PM
I got it thanks, he did explain it quite wierdly but i see what hes getting at, basically its just the remainder :D