SRL Archive - Research & Development Lounge

some game tab functions


SKy Scripter

2007-08-06 15:59:31

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

2007-08-06 16:00:52

thanks Sky GJ.

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

n3ss3s

2007-08-06 16:32:48

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

2007-08-07 01:51:02

thanks =) now i can continue making/testing my script

Sp0rky

2007-08-07 07:50:29

I did this within the first 15 mins of the rs update, although a bit differently :p

Tim0suprem0

2007-08-08 02:02:39

Thanks! So simple yet so helpful :)

Hehe and I learned what 'mod' does too

mat_de_b

2007-08-17 18:20:59

what does mod do?

Smartzkid

2007-08-17 18:29:36

Remainder

5 mod 2 equals 1.

TOB

2007-08-18 06:22:13

5 mod 2 equals 1.

The Element

2007-08-18 09:18:34

Someone should write a tut on "mod".

SKy Scripter

2007-08-18 14:45:30

From: The Element
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

2007-08-19 02:57:17

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

2007-08-19 04:18:44

From: TOB
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

2007-08-19 22:30:39

From: lordsaturn
Wtf…


Did you even try to understand it?

mat_de_b

2007-08-21 15:05:33

I got it thanks, he did explain it quite wierdly but i see what hes getting at, basically its just the remainder :D