SRL Archive - Senior Scripts and Snippets

Another new 'SetChat'


Dark_Sniper

2007-08-06 15:22:25

yes i made a new chatset based on the new interface + fixed SRL gametab stuff……
yes this is redistributable …

here it is:

Procedure ChatSet(ChatBox : Integer; ChatType : String);
var
Option : String; Color : Integer;
begin
Case LowerCase(ChatType) of
'hide' : Option := 'ide';
'off' : Option := 'ff';
'friend' : Option := 'rie';
'on' : Option := 'On';
end;
Case Option of
'ide' : Color := 16776960;
'ff' : Color := 255;
'rie' : Color := 65535;
'On' : Color := 65280;
end;
Case ChatBox of
1: ChatBox:= 145;
2: Chatbox:= 145 + 70;
3: ChatBox:= 145 + (70*2);
4: ChatBox:= 145 + (70*3);
end;
If FindColor(x, y, Color, ChatBox, 484, ChatBox+30, 510) then
Exit;
Mouse(ChatBox, 484, 15, 15, False)
Wait(100+random(100))
ChooseOption(x, y, Option)
end;


Also text pos in chatbox has changed so:

this one checks if it finds spec text in last message using pos.
function GetChat( Chat : String ) : Boolean;
var TempChat : String;
begin
Result:=True;
TempChat:=LowerCase(trim(GetTextAtEx(11, 443, 0, SmallChars, False, False, 0, 0,
0, 50, False, tr_allChars)))
if Pos(chat , TempChat) = 0 then
Result:=False;
end;


this one returns the whole last chat message… in lowercase.

Function ReturnChat : String;
begin
Result:= LowerCase(trim(GetTextAtEx(11, 443, 0, SmallChars, False, False, 0, 0,
0, 50, False, tr_allChars)))
end;


also there is an extra tab along with the new interface update so:

function GetCurrentTab: Integer;
begin
begin
if GetColor(529, 185) = 1581150 then
Result := 1
else if GetColor(568, 173) = 1910385 then
Result := 2
else if GetColor(597, 172) = 1778795 then
Result := 3
else if GetColor(632, 173) = 1976437 then
Result := 4
else if GetColor(666, 172) = 1910385 then
Result := 5
else if GetColor(698, 173) = 1976437 then
Result := 6
else if GetColor(729, 174) = 2107770 then
Result := 7
else if GetColor(528, 472) = 1910385 then
Result := 8
else if GetColor(565, 471) = 1910385 then
Result := 9
else if GetColor(598, 472) = 2107770 then
Result := 10
else if GetColor(629, 470) = 1778795 then
Result := 11
else if GetColor(666, 474) = 1910385 then
Result := 12
else if GetColor(699, 480) = 1647204 then
Result := 13;
if GetColor(730, 470) = 1778795 then
Result := 14;
end;
end;


this extra tab might screw up other functions that rely on the logout being to 10 instead of 11… same goes with other past the tab of 7… tabs 1-6 are the same though.


this is a working TabExists function
function TabExists(TabNumber: Integer): Boolean;
var
Tx, Ty:Integer;
begin
case TabNumber of
1: Result := FindColor(Tx, Ty, 3852287, 530, 186, 554, 197);
//GameTab 1 = Fightmode
2: Result := FindColor(Tx, Ty, 65536, 563, 174, 568, 190);
//GameTab 2 = Statistic
3: Result := FindColor(Tx, Ty, 12842487, 598, 175, 610, 188);
//GameTab 3 = Quest
4: Result := FindColor(Tx, Ty, 65536, 632, 170, 650, 179);
//GameTab 4 = Inventory
5: Result := FindColor(Tx, Ty, 65536, 665, 173, 674, 181);
//GameTab 5 = Wield
6: Result := FindColor(Tx, Ty, 65536, 701, 173, 713, 182);
//GameTab 6 = Prayer
7: Result := FindColor(Tx, Ty, 65536, 729, 183, 743, 198);
//GameTab 7 = Mage
8: Result := FindColor(Tx, Ty, 65536, 535, 469, 543, 477);
//GameTab 8 = Clan Talk
9: Result := FindColor(Tx, Ty, 65536, 566, 471, 575, 479);
//GameTab 9 = Add Friend
10: Result := FindColor(Tx, Ty, 65536, 600, 471, 618, 479);
//GameTab 10 = Del Friend
11: Result := FindColor(Tx, Ty, 65536, 632, 469, 653, 476);
//GameTab 11 = LogOut
12: Result := FindColor(Tx, Ty, 65536, 662, 483, 674, 497);
//GameTab 12 = Tools/Run
13: Result := FindColor(Tx, Ty, 65536, 706, 468, 717, 476);
//GameTab 13 = Emotes
14: Result := FindColor(Tx, Ty, 65536, 729, 473, 744, 496);
//GameTab 14 = Music
end; //case Tab
end;



this is a working Gametab function:
function GameTab(tabnumber: Integer): Boolean;
var
c: Integer;
begin
if GetCurrentTab = tabnumber then
begin
Result := True;
Exit;
end;
if not TabExists(tabnumber) then
begin

Result := False;
Exit;
end;
case tabnumber of
1: if (not (GetColor(527, 185) = 1580634)) then
begin
repeat Mouse(529, 176, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
2: if (not (GetColor(568, 173) = 1910385)) then
begin
repeat Mouse(568, 173, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
3: if (not (GetColor(597, 172) = 1778795)) then
begin
repeat Mouse(597, 172, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
4: if (not (GetColor(632, 173) = 1976437)) then
begin
repeat Mouse(632, 173, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
5: if (not (GetColor(666, 172) = 1910385)) then
begin
repeat Mouse(666, 172, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
6: if (not (GetColor(698, 173) = 1976437)) then
begin
repeat Mouse(698, 173, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
7: if (not (GetColor(729, 174) = 2107770)) then
begin
repeat Mouse(729, 174, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
8: if (not (GetColor(528, 472) = 1910385)) then
begin
repeat Mouse(528, 472, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
9: if (not (GetColor(565, 471) = 1910385)) then
begin
repeat Mouse(565, 471, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
10: if (not (GetColor(598, 472) = 2107770)) then
begin
repeat Mouse(598, 472, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
11: if (not (GetColor(629, 470) = 1778795)) then
begin
repeat Mouse(629, 470, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
12: if (not (GetColor(666, 474) = 1910385)) then
begin
repeat Mouse(666, 474, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
13: if (not (GetColor(699, 480) = 1647204)) then
begin
repeat Mouse(699, 480, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
14: if (not (GetColor(730, 470) = 1778795)) then
begin
repeat Mouse(730, 470, 8, 8, True);
c := c + 1;
until (GetCurrentTab = tabnumber) or (c >= 3)
end;
end;
if (c < 3) then
begin
Result := True;
Wait(10);
// Wait(300 + Random(300)); //DON'T CHANGE THIS.
end;
end;

SetfightMode Still works



Get Combat lvl is fixed:

function GetCombatLevel: Integer;
var
Lvl: string;
begin
Gametab(1);
Wait(100 + Random(100));
Lvl := Trim(GetTextAtEx(604, 230, 100, StatChars, True, True, 0, 1, -1, 40, True, tr_AlphaNumericChars));
if (Copy(Lvl, 1, 5) = 'ombat') then
Delete(Lvl, 1, 11);
Lvl := Trim(Lvl);
try
Result := StrToInt(Lvl);
except
Writeln('Could Not Get Combat Level');
end
end;


Updated Skill Coords( DOES NOT ACC FIND RC LVL?):
function SkillCoords(row, column: Integer): TPoint;
begin
case Column of
1: Result.x := 582;
2: Result.x := 643;
3: Result.x := 708;
end;
case row of
1: Result.y := 210;
2: Result.y := 241;
3: Result.y := 272;
4: Result.y := 303;
5: Result.y := 334;
6: Result.y := 365;
7: Result.y := 396;
8: Result.y := 429;
end;
end;






Rs_monkey took this code and arrayed it :

function GetCurrentTab: Integer;
var
x, y, color : array of integer;
i : integer;
begin//tab1, 2, 3, 4, 5, 6, 7,etc..
x := [529, 568, 597, 632, 666, 698, 729, 528, 565, 598, 629, 666, 699, 730];
y := [185, 173, 172, 173, 172, 173, 174, 472, 471, 472, 470, 474, 480, 470];
color := [1581150, 1910385, 1778795, 1976437, 1910385, 1976437, 2107770,
1910385, 1910385, 2107770, 1778795, 1910385, 1647204, 1778795];
for i := 1 to 14 do
if GetColor(x[i-1], y[i-1]) = color[i-1] then
begin
Result := i;
Exit; //exit from loop, if none found, will result result := -1;
end;
Result := -1;
end;

function TabExists(TabNumber: Integer): Boolean;
var
Tx, Ty, i : Integer;
x1, y1, x2, y2, color : array of integer;
begin
x1 := [530, 563, 598, 632, 665, 701, 729, 535, 566, 600, 632, 662, 706, 729];
y1 := [186, 174, 175, 170, 173, 173, 183, 469, 471, 471, 469, 483, 468, 473];
x2 := [554, 568, 610, 650, 674, 713, 743, 543, 575, 618, 653, 674, 717, 744];
y2 := [197, 190, 188, 179, 181, 182, 198, 477, 479, 479, 476, 497, 476, 496];
color := [3852287, 65536, 12842487, 65536, 65536, 65536, 65536, 65536, 65536,
65536, 65536, 65536, 65536, 65536];
Result := FindColor(Tx, Ty, color[TabNumber-1], x1[TabNumber-1], y1[TabNumber-1], x2[TabNumber-1], y2[TabNumber-1]);
end;

shaunthasheep

2007-08-06 17:41:48

heres GetCurrentTab, TabExists, and GameTab, say, almost 4 times shorter.
:)
Eitherway, still, goodjob, whatidid.boring * 10
idk if they work neither.

function GetCurrentTab: Integer;
var
x, y, color : array of integer;
i : integer;
begin//tab1, 2, 3, 4, 5, 6, 7,etc..
x := [529, 568, 597, 632, 666, 698, 729, 528, 565, 598, 629, 666, 699, 730];
y := [185, 173, 172, 173, 172, 173, 174, 472, 471, 472, 470, 474, 480, 470];
color := [1581150, 1910385, 1778795, 1976437, 1910385, 1976437, 2107770,
1910385, 1910385, 2107770, 1778795, 1910385, 1647204, 1778795];
for i := 1 to 14 do
if GetColor(x[i-1], y[i-1]) = color[i-1] then
begin
Result := i;
Exit; //exit from loop, if none found, will result result := -1;
end;
Result := -1;
end;

function TabExists(TabNumber: Integer): Boolean;
var
Tx, Ty, i : Integer;
x1, y1, x2, y2, color : array of integer;
begin
x1 := [530, 563, 598, 632, 665, 701, 729, 535, 566, 600, 632, 662, 706, 729];
y1 := [186, 174, 175, 170, 173, 173, 183, 469, 471, 471, 469, 483, 468, 473];
x2 := [554, 568, 610, 650, 674, 713, 743, 543, 575, 618, 653, 674, 717, 744];
y2 := [197, 190, 188, 179, 181, 182, 198, 477, 479, 479, 476, 497, 476, 496];
color := [3852287, 65536, 12842487, 65536, 65536, 65536, 65536, 65536, 65536,
65536, 65536, 65536, 65536, 65536];
Result := FindColor(Tx, Ty, color[TabNumber-1], x1[TabNumber-1], y1[TabNumber-1], x2[TabNumber-1], y2[TabNumber-1]);
end;

function GameTab(tabnumber: Integer): Boolean;
var
c : Integer;
x, y : array of integer;
begin
x := [529, 568, 597, 632, 666, 698, 729, 528, 565, 598, 629, 666, 699, 730];
y := [176, 173, 172, 173, 172, 173, 174, 472, 471, 472, 470, 474, 480, 470];
if not TabExists(tabnumber) then
while GetCurrentTab <> tabnumber do
begin
Mouse(x[tabnumber-1], y[tabnumber-1], 8, 8, True);
c := c + 1;
if c = 3 then Break;
end;
if GetCurrentTab = tabnumber then result := True;
end;

Dark_Sniper

2007-08-06 17:45:47

I still do not understand why they did not make it that way in the first place…

shaunthasheep

2007-08-06 18:02:56

probally so Devs don't get confused while updating >.<

Wizzup?

2007-08-06 18:04:08

Thanks for posting, too bad we need to tweak SRL a bit more before we can open the SvN, since I've fixed it a few hours ago in the SvN. :p

Dark_Sniper

2007-08-06 18:24:34

lol thats to bad i posted that a few hours ago :p

and from what i see there is a lot broken… you fixed almost all?

also wizzy i got this translation from a friend who read this i loled at it :



hidden ident says:
Translation: "Thanks for posting dumbass, but we don't want your credits in srl.:f: "



opps i forgot to use quote tags :

From: TheRsMonkey

Translation: "Thanks for posting dumbass, but we don't want your credits in srl.:f: "


XD opps forgot to edit his name out XD


EDIT:

he wants me to edit:
From: The_Rs_Monkey
The_Rs_Monkey says:
put, but it was just a joke, or somin
The_Rs_Monkey says:
the last thing i want, is for him to think i really meant that

Wizzup?

2007-08-07 04:20:49

From: Dark_Sniper
lol thats to bad i posted that a few hours ago :p

and from what i see there is a lot broken… you fixed almost all?

also wizzy i got this translation from a friend who read this i loled at it :



hidden ident says:
Translation: "Thanks for posting dumbass, but we don't want your credits in srl.:f: "



opps i forgot to use quote tags :



XD opps forgot to edit his name out XD


EDIT:

he wants me to edit:


I actually put your combat level and skillcoords in srl, with credits.. ;)

Dark_Sniper

2007-08-07 14:13:04

i do believe something is wrong with my skill coords lol…

rc lvl : 46
skill reuturned.. 6…

but thats the only one i have troubles with?

every other skill returns right like wtf….

plus i already had something in SRL no need for creds as im already secretly in there with one elite function :p

PickUpMouse;
which is one of the few that lived though the clean out of anti ban!!!!



i think its still funnny to see this kind of stuff in SRL:

// * by Dankness extended by Cheesehunk and fixed by Ron

( always ~ fixed by Ron ( Ron for super Dev anyone XD )

Cheesehunk

2007-08-13 19:12:11

From: Dark_Sniper

i think its still funnny to see this kind of stuff in SRL:

// * by Dankness extended by Cheesehunk and fixed by Ron

( always ~ fixed by Ron ( Ron for super Dev anyone XD )

That's because Ron adds himself to the credits for little things such as spell-checking functions.

Jk Ron.:p

Dark_Sniper

2007-08-14 00:04:46

nah ron just goes though and adds ron to the end of all functions he likes :p

Starblaster100

2007-08-14 04:07:57

lol, Ron makes functions more efficient.

He is 1 of the few devs who thinks about efficiency …:rolleyes:

Dark_Sniper

2007-08-14 13:12:49

heh ya we are just messin with him XD.