shepdog
2014-11-29 18:49:35
I had a friend of mine make me some OSRS scripts. I stopped using them for almost a year and now they are full of bugs. Is there anyone who would be interested or willing to help me update them?
Regards,
Shepdog
Cause of the crashing:
The first script,
Crashes when someone does, "pc [ITEM]" when the the script runs in a friends chat.
For example… Bot is in the FC^, User2 is in the fc. If User2 says "!pc or pc air rune.
Then bot crashes. or when they do !Stats [Player] or Stats [Player]
The Second Script,
Crashes when you have the bot join a friends chat and it attempts to private message anyone.
P.S - Script to is not for "Annoying GE spam" its for information and Updates to users within FC's.
First Script:
Second script:
Regards,
Shepdog
Cause of the crashing:
The first script,
Crashes when someone does, "pc [ITEM]" when the the script runs in a friends chat.
For example… Bot is in the FC^, User2 is in the fc. If User2 says "!pc or pc air rune.
Then bot crashes. or when they do !Stats [Player] or Stats [Player]
The Second Script,
Crashes when you have the bot join a friends chat and it attempts to private message anyone.
P.S - Script to is not for "Annoying GE spam" its for information and Updates to users within FC's.
First Script:
program Pricechecker;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
var
LastT, LastP, Name: string;
ItemPc, Time: Integer;
const
FcName = ''; //fc to join - won't join if you're already in one
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; //login in name
Pass := ''; //Password
Active := True;
Nick := '';
Players[0].LampSkill := Skill_Slayer;
end;
end;
function CustomGetChatBoxText(Line, TextCol: Integer): string; //taken from the include to modify tolerance
var
P: TPoint;
cArr: TPointArray;
B: TBox;
begin
Result := '';
P := TextCoords(Line);
if (FindColorsTolerance(cArr, TextCol, MCX1, P.y, MCX2, P.y + 13, 0)) then
begin
B := GetTPABounds(cArr);
result := Trim(GetTextAtExWrap(b.x1-1,p.y,B.x2+1,p.y+13,0,5,2,TextCol,0, smallchars07));
end;
end;
procedure Progress;
var
TimeRan, PCHr: Integer;
begin
TimeRan := (GetTimeRunning / 1000);
PCHr := (3600 * (ItemPC)) / ((TimeRan));
ClearDebug;
Writeln('The Killer''s PriceChecker');
Writeln('Time running: ' + TimeRunning);
Writeln('Completed ' + IntToStr(ItemPC) + ' Price Checks');
Writeln('Completing at a rate of ' + IntToStr(PCHr) + ' /Hour');
MarkTime(Time);
end;
procedure JoinFC;
var
JoinChat, x, y: integer;
begin
JoinChat := BitmapFromString(55, 22, 'meJyNV+1OwzAM3Psg9qcUoQHTAD' + //join button
'Ft4hF5WPB6zfXmj7RTNKWOc7nY5zQdj5fD5894vOwPX8PbN9vL8Tq' +
'ebk2N5oaOOcPfHGw6LeagjbPu+hOmGjGd+IpMDursGoYenz8cWkRO' +
'+cTdVZbxdA6WK6KnAUzBSSbGkH2lDVgsYeuWez+dGf9l4n3WZpBGU' +
'heNiaC/ox0ZRrdOMzm5wKaLRnuMKnZNi1ORY2jRQHycKvJg1prkKP' +
'NSigTin3RLwHRpl+4tJGNxOQ4QZKqBDib/l7oWlXZKL41bWviugaQ' +
'7eegf5ZeG2iU9rZRlaMpdnz+h9u8XzsI/hwxk9/unbTXUM6arnbYo' +
'QGhkv4KKOFVOd/gZ/vTbrgcShpwMwfqAgg8w+yThvFp0DjBqBjiul' +
'Jze4EMEdFKS7hiEz5L3tuVUfkpSszaPctGpzW/Dpo15SuBD/2isHo' +
'fikAdVrsKYgAwt3IgmNCZikNpRfwSwkoRuMN4fnDPZOtra0aGUJNd' +
'yE7W4InilTKYpcttIUt+Vul+nAe3cSqzVKTcS8+sIUxUg4CyRZGf7' +
'PMcQt+hPwTduZ81mv1EVWNHuaU4n1jcj7IPUL5wfnl6XApSJCJqWn' +
'vqQpBs1KL0odpqtq572aK1yjscySd7fW65+lK+Y6eVVXbSc1NlHfM' +
'ATW9OjTBPtMNO7bnpxxWG4egdwDLGvQcoB3KL2lpd+e+/wcKsqND5' +
'WF4Z1qtktlAQkNUtzmdW4bSQc75DprPjRpI/8OFL9aAR4dRnal0v6' +
'PbJFD3T+B5+ScsY=');
Gametab(tab_Clan);
if not FindBitmap(JoinChat, x, y) then
begin
Writeln('Could not find the join chat button - we must already be in a clan');
Exit;
end;
Mouse(x + 10, y + 10, 5, 5, 1);
TypeSend(FcName);
end;
procedure TypeSendCustom(Text: string);
var
I: Integer;
begin
for i := 1 to Length(Text) do
begin
{$IFDEF SIMBAMAJOR980}
SendKeys(Text[i], 40 + Random(40));
{$ELSE}
SendKeys(Text[i], 1 + Random(2), 1 + Random(2));
{$ENDIF}
Wait(1 + Random(2));
end;
TypeByte(VK_ENTER);
end;
procedure Kick(name: string);
var
x, y, q, w, Time, addplayer: Integer;
begin
AddPlayer := BitmapFromString(58, 16, 'meJylltFKQzEQRPtPPkofChehaF' + //bitmap for adding players
'GLBfVBv8uv1cEDh2HvpQheQplsdjaTzSbNYVlO53Pa8fTwfLkcliX' +
'g5e01OGDgtHjShXV3PN4/PTqaofivcVrc4txzAa4QI6bnSrcjxEcN' +
'uAUMLMjsKB+euoGJRheFyO5QOg9iGrJV5QKjnDQyu8ob3+735D9Ej' +
'O+fH2hgtIODHQ2IM/bQyVsoa1USSTLb7WiCpB1+SyJAba0k+Obrmy' +
'7TBcTCkvFcC8OZrpmBwiywdB5EcGZBodmzYPKrKiMAYt/tds6S1WF' +
'x1fjYmqtOiK7a0eFsVQeMWSgDDkuG+HXhyoOlXYv144r8xp66X2Mj' +
'FN8YeYhRbRPJKkPBxPdmUBtHLE2LWXJFfcDpEiG/cC2Gdh5Ejhsx6' +
'YbodeHsKsHBzY2Fw9gWjwzZpmFBHl1uDGKigeRYVE1EVc+CKk99z6' +
'UPxkQIVhvVosXNNQ98akBkn1NWQYQuKiwhwk1AZ7EwUGuFyGJPXVq' +
'rtVqwsKf6eIIMSP00kYbmJrqDnS5YfdD09N7YVCvo+rfCR91udkda' +
'xjIHcI3o/H/d+m9iHrymDNh3kXm2TtaZ/EvdUifQqdXGfOw7davFo' +
'pLVRIYgKh7Mh7NEcqIevnXdkiW41l5j0uLF6J973+2D6w3pQ8Lrtw' +
't+k6ikvuL6DzFu1O3mU6HpKhH0e8nr3Ruj/Ts5m48EiD66+u9S2e6' +
'pD4l+VPh0HM8eKsrlKwbcDq3HUFeI1E8r/AGoOmfR');
GameTab(tab_Friends); //so we are on the right tab...
if not FindBitmap(AddPlayer, x, y) then
Writeln('Could not find the add player button'); //a little bit of debug
MarkTime(Time); //so we don't have a risk of infinite loops
repeat
if FindColorTolerance(q, w, 16777215, 553, 208, 715, 312, 10) then //finds names
begin
Mouse(q + 15, w + 5, 15, 15, 2);
ChooseOption('elete');
end else
Break;
until(TimeFromMark(Time) > 45000);//clear friends list
if (Name = '') or (Length(Name) > 20) then
Exit;
Mouse(x + 10, y + 10, 10, 10, 1);
TypeSend(Name);
Wait(2500 + Random(200));
if (not FindColorTolerance(q, w, 65280, 655, 231, 713, 245, 10)) and (not FindColorTolerance(q, w, 65535, 655, 231, 713, 245, 10)) then//Check if online (green stoff?)
Exit;
Mouse(92, 437, 5, 5, 2);
Chooseoption('ick');
//FindColorTolerance(q, w, 16777215, 553, 208, 715, 312, 10);
//Mouse(q + 15, w + 5, 15, 15, 1);
//TypeSend(BeforeName + Name + AfterName);//Send a nice message :)
inc(itempc);
end;
procedure PriceCheck;
var
I, l, hig, lo, aver, alc: integer;
T, average, recentlow, recenthigh, str, alch, search, ot : string;
Expl, Bang : TStringArray;
begin
T := lowercase(CustomGetChatBoxText(8, 128));
Search := T;
Name := LowerCase(CustomGetChatBoxText(8, clMessage));
//Writeln(name);
Writeln(t);
l := Pos('..', Name);
if (l <> 0) then
Delete(Name, l, l);
//Writeln(name);
l := Pos('[', Name);
if (l <> 0) then
Delete(Name, l, l);
l := Pos(']', Name);
if (l <> 0) then
Delete(Name, l, l);
Delete(Name, 1, 1);
//Writeln(name);
// replace(Names[f], '] ', '');
//Writeln(name);
Expl := explode(' ', T);
for I:=0 to high(Expl) do
begin
if (Expl[I] = 'pc') then
begin //so we get the name and not !pc for our search
T := replace(T, 'pc ', '');
T := replace(T, 'of', 'of ');
T := replace(T, 'black', 'black ');
T := replace(T, 'plank', ' plank');
T := replace(T, 'oakplank', 'oak plank');
// T := replace(T, 'black', 'black ');
T := replace(T, 'hcween', 'h''ween');
T := replace(T, 'dark', 'dark ');
T := replace(T, 'guthancs ', 'guthan''s /');
T := replace(T, 'ahrimcs', 'ahrim''s');
T := replace(T, 'magecs', 'mages');
T := replace(T, 'dharokcs', 'dharok''s');
T := replace(T, 'veraccs', 'verac''s');
T := replace(T, 'toragcs', 'torag''s');
T := replace(T, 'karilcs', 'karil''s');
Ot := T;
T := replace(T, ' ', '+');
T := replace(T, ' ', '+');
if not (T = LastT) then
begin
LastT := T;
Wait(10);
writeln(t);
str := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + T);
if (str = '{"error":"No results found."}') or (str = '{"error":"Enter a longer search term."}') then
begin
TypesendCustom('/' + Name + ' I couldn''t find your item');
Wait(100 + Random(10));
Exit;
end;
average := Between('"average":"','"', str);
recentlow := Between('recent_low":"', '"',str);
recenthigh := Between('recent_high":"', '"',str);
alch := Between('high_alch":"', '"',str);
Aver := Round(StrToFloat(Average));
Lo := Round(StrToFloat(recentlow));
Hig := Round(StrToFloat(recenthigh));
alc := Round(StrToFloat(alch));
TypeSendCustom('/[' + Capitalize(ot) + '] Rng:' + IntToStr(Hig) + '-' + IntToStr(lo) + ' Average:' + IntToStr(Aver) + ' Alch:' + IntToStr(alc));
Inc(ItemPC);
Wait(100 + random(10));
Exit;
end;
end;
end;
begin
for I:=0 to high(Expl) do
begin
if (Expl[I] = '!stats') then
begin //so we get the name and not !pc for our search
Search := replace(search, '!stats ', '');
Search := replace(search, '!stats', ''); //to make sure everything goes, was having difficulties
Search := replace(search, 'stats ', '');
Search := replace(search, '!', '');
Search := replace(search, 'stats', '');
ot := Search;
Search := replace(search, ' ', '+');
Search := replace(search, ' ', '+');
if not (Search = LastP) then
begin
Lastp := Search;
Wait(10);
Writeln(search);
Str := GetPage('http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=' + search);
bang := Explode(',', Str);
L := pos('Page', str);
if L <> 0 then
Exit;
Writeln(str);
TypeSendCustom('/' + Capitalize(ot) + '-[Hp:' + Bang[9] + ' At:' + Bang[3] + ' St:' + Bang[7] + ' Df:' + Bang[5] + ' Rn:' + Bang[11] + ' Mg:' + Bang[15] + ' Pr:' + Bang[13] + ']');
Exit;
end;
end;
end;
end;
for I:=0 to high(Expl) do
begin
if (Expl[I] = 'scam') or (Expl[I] = 'scammer') or (Expl[I] = 'home') or (Expl[I] = 'house') or (Expl[I] = 'legit one') or (Expl[I] = 'stand') then
begin //so we get the name and not !pc for our search
SetAllChats('hide','Friends', 'Friends', 'off');
Kick(name);
SetAllChats('hide','Friends', 'on', 'off');
end;
end;
end;
begin
SetUpsrl;
DeclarePlayers;
LoginPlayer;
JoinFc;
MarkTime(Time);
repeat
if TimeFromMark(time) > 10000 then
begin
if not LoggedIn then
begin
LoginPlayer;
joinfc;
end;
CompassMovement(5, 15, false);
Progress;
MarkTime(Time);
end;
PriceCheck;
until(False);
end.Second script:
program PrivateMessager;
{$DEFINE SMART8}
{$I SRL-osr/SRL.simba}
var
Names, NamesGrabbed: array of string;
Time, Time2, AddPlayer, count: Integer;
const
World = 301;
BeforeName = 'Hey ';
AfterName = ', MESSAGE';
FcName = '';
HowLongToWait = 3000000; //how long do we spend grabbing names? (in milliseconds)
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; //login in name
Pass := ''; //Password
Active := True;
Nick := ''; //few letters from your name
Players[0].LampSkill := Skill_Slayer;
end;
end;
procedure JoinFC;
var
JoinChat, x, y: integer;
begin
JoinChat := BitmapFromString(55, 22, 'meJyNV+1OwzAM3Psg9qcUoQHTAD' + //join button
'Ft4hF5WPB6zfXmj7RTNKWOc7nY5zQdj5fD5894vOwPX8PbN9vL8Tq' +
'ebk2N5oaOOcPfHGw6LeagjbPu+hOmGjGd+IpMDursGoYenz8cWkRO' +
'+cTdVZbxdA6WK6KnAUzBSSbGkH2lDVgsYeuWez+dGf9l4n3WZpBGU' +
'heNiaC/ox0ZRrdOMzm5wKaLRnuMKnZNi1ORY2jRQHycKvJg1prkKP' +
'NSigTin3RLwHRpl+4tJGNxOQ4QZKqBDib/l7oWlXZKL41bWviugaQ' +
'7eegf5ZeG2iU9rZRlaMpdnz+h9u8XzsI/hwxk9/unbTXUM6arnbYo' +
'QGhkv4KKOFVOd/gZ/vTbrgcShpwMwfqAgg8w+yThvFp0DjBqBjiul' +
'Jze4EMEdFKS7hiEz5L3tuVUfkpSszaPctGpzW/Dpo15SuBD/2isHo' +
'fikAdVrsKYgAwt3IgmNCZikNpRfwSwkoRuMN4fnDPZOtra0aGUJNd' +
'yE7W4InilTKYpcttIUt+Vul+nAe3cSqzVKTcS8+sIUxUg4CyRZGf7' +
'PMcQt+hPwTduZ81mv1EVWNHuaU4n1jcj7IPUL5wfnl6XApSJCJqWn' +
'vqQpBs1KL0odpqtq572aK1yjscySd7fW65+lK+Y6eVVXbSc1NlHfM' +
'ATW9OjTBPtMNO7bnpxxWG4egdwDLGvQcoB3KL2lpd+e+/wcKsqND5' +
'WF4Z1qtktlAQkNUtzmdW4bSQc75DprPjRpI/8OFL9aAR4dRnal0v6' +
'PbJFD3T+B5+ScsY=');
Gametab(tab_Clan);
if not FindBitmap(JoinChat, x, y) then
begin
Writeln('Could not find the join chat button - we must already be in a clan');
Exit;
end;
Mouse(x + 10, y + 10, 5, 5, 1);
TypeSend(FcName);
end;
procedure GetNames(var names: array of string); //just an editted version of the one from the include
var //so it filters the dots out for 07 and goes from the last line up
l, f: Integer;
begin
Setlength(Names, 9);
for f := 8 downto 1 do
begin
Names[f] := LowerCase(GetChatBoxText(f, clMessage));
Writeln(Names[f]);
l := Pos('..', Names[f]);
if (l <> 0) then
Delete(Names[f], l, l);
Writeln(names[f]);
l := Pos('[', Names[f]);
if (l <> 0) then
Delete(Names[f], l, l);
l := Pos(']', Names[f]);
if (l <> 0) then
Delete(Names[f], l, l);
//Writeln(name);
// replace(Names[f], '] ', '');
Delete(Names[f], 1, 1);
Writeln(names[f]);
end;
end;
procedure SendMessage(name: string);
var
x, y, q, w, Time: Integer;
begin
AddPlayer := BitmapFromString(58, 16, 'meJylltFKQzEQRPtPPkofChehaF' + //bitmap for adding players
'GLBfVBv8uv1cEDh2HvpQheQplsdjaTzSbNYVlO53Pa8fTwfLkcliX' +
'g5e01OGDgtHjShXV3PN4/PTqaofivcVrc4txzAa4QI6bnSrcjxEcN' +
'uAUMLMjsKB+euoGJRheFyO5QOg9iGrJV5QKjnDQyu8ob3+735D9Ej' +
'O+fH2hgtIODHQ2IM/bQyVsoa1USSTLb7WiCpB1+SyJAba0k+Obrmy' +
'7TBcTCkvFcC8OZrpmBwiywdB5EcGZBodmzYPKrKiMAYt/tds6S1WF' +
'x1fjYmqtOiK7a0eFsVQeMWSgDDkuG+HXhyoOlXYv144r8xp66X2Mj' +
'FN8YeYhRbRPJKkPBxPdmUBtHLE2LWXJFfcDpEiG/cC2Gdh5Ejhsx6' +
'YbodeHsKsHBzY2Fw9gWjwzZpmFBHl1uDGKigeRYVE1EVc+CKk99z6' +
'UPxkQIVhvVosXNNQ98akBkn1NWQYQuKiwhwk1AZ7EwUGuFyGJPXVq' +
'rtVqwsKf6eIIMSP00kYbmJrqDnS5YfdD09N7YVCvo+rfCR91udkda' +
'xjIHcI3o/H/d+m9iHrymDNh3kXm2TtaZ/EvdUifQqdXGfOw7davFo' +
'pLVRIYgKh7Mh7NEcqIevnXdkiW41l5j0uLF6J973+2D6w3pQ8Lrtw' +
't+k6ikvuL6DzFu1O3mU6HpKhH0e8nr3Ruj/Ts5m48EiD66+u9S2e6' +
'pD4l+VPh0HM8eKsrlKwbcDq3HUFeI1E8r/AGoOmfR');
GameTab(tab_Friends); //so we are on the right tab...
if not FindBitmap(AddPlayer, x, y) then
Writeln('Could not find the add player button'); //a little bit of debug
MarkTime(Time); //so we don't have a risk of infinite loops
repeat
if FindColorTolerance(q, w, 16777215, 553, 208, 715, 312, 10) then //finds names
begin
Mouse(q + 15, w + 5, 15, 15, 2);
ChooseOption('elete');
end else
Break;
until(TimeFromMark(Time) > 45000);//clear friends list
if (Name = '') or (Length(Name) > 20) then
Exit;
Mouse(x + 10, y + 10, 10, 10, 1);
TypeSend(Name);
Wait(2500 + Random(200));
if (not FindColorTolerance(q, w, 65280, 655, 231, 713, 245, 10)) and (not FindColorTolerance(q, w, 65535, 655, 231, 713, 245, 10)) then//Check if online (green stoff?)
Exit;
FindColorTolerance(q, w, 16777215, 553, 208, 715, 312, 10);
Mouse(q + 15, w + 5, 15, 15, 1);
TypeSend(BeforeName + Name + AfterName);//Send a nice message :)
inc(count);
end;
procedure FreBitmap;
begin
if BitmapExists(AddPlayer) then
FreeBitmap(AddPlayer);
end;
procedure GrabNames;
var
i, h: integer;
begin
GetNames(Names);
for i := 1 to 8 do
begin
if StrInArr(Names[i], NamesGrabbed) then
begin
Continue;//check if in string (pos)
end else
begin
SetLength(NamesGrabbed, Length(NamesGrabbed)+ 1); //if not in then add in
h := High(NamesGrabbed);
NamesGrabbed[h] := Names[i];
SendMessage(Names[i]);
end;
end;
//repeat
//grab more names
end;
procedure Progress;
var
MessagesSent, TimeRan, MessagesHr: Integer;
begin
TimeRan := (GetTimeRunning / 1000);
MessagesSent := Count;
MessagesHr := (3600 * (MessagesSent)) / ((TimeRan));
// ClearDebug;
Writeln('The Killer''s Pmer');
Writeln('Time running: ' + TimeRunning);
Writeln('Sent ' + IntToStr(MessagesSent) + ' messages');
Writeln('Sending at a rate of ' + IntToStr(MessagesHr) + ' /Hour');
Writeln('CopyRight to The Killer - Get your private scripts at := http://www.sythe.org/showthread.php?p=11962530');
end;
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
// ChangeWorld(World);
Writeln('Waiting for runescape to load.');
Wait(1000 + Random(500));
// FindNormalRandoms; Keeps throwing me errors :s
SetAllChats('hide','Friends', 'on', 'off');
AddOnTerminate('FreBitmap');//prevents bitmaps not being free
JoinFc;
MarkTime(Time);
MarkTime(Time2);
repeat
GrabNames;
if TimeFromMark(Time) > 30000 then
begin
Marktime(Time);
Progress;
RandomRClick;
//FindNormalRandoms;
end;
if TimeFromMark(Time2) > howlongtowait then
begin
Setlength(NamesGrabbed, 1);
MarkTime(time2);
end;
if not LoggedIn then
begin
LoginPlayer;
JoinFc;
end;
until(False);
end.