SRL Archive - Test corner

Comments or Suggestions?


skilld u

2008-04-08 21:31:43

I made this for a friend and I need some feedback, it tells people to trade for PC world and then if their combat level is high enough than it puts up the amount of money that is equal to the world number. I know it doesn't compile, I can't figure that one procedure out and I don't have SRL on this computer so I can't find out what is wrong :( Here it is!

program PCWorldAdvertiser;
{$DEFINE SMART}
{.include SRL/SRL/Misc/smart.scar}
{.include SRL/SRL.scar}

var
x, y : integer;

{******************************************************************************}
{***************** ______ _ _ _ _______ _ _ ____ _ ********}
{*****************| ____(_) | | |__ __| | (_) / __ \ | |********}
{*****************| |__ _| | | | | | |__ _ ___ | | | |_ _| |_*******}
{*****************| __| | | | | | | | '_ \| / __| | | | | | | | __|******}
{*****************| | | | | | | | | | | | \__ \ | |__| | |_| | |_*******}
{*****************|_| |_|_|_| |_| |_| |_|_|___/ \____/ \__,_|\__|******}
{******************************************************************************}

const
Level = 90; //What Level Do They Have To Be?

HowManyMore = 20; //How Many Levels Greater Can The PLayer Be?

CharsToAccept = 10; //How Many Characters Should Be Accepted?

WorldNumber = 69; //What World Is Your PC World?

YourSRLId = ''; //Stats User Name

YourSRLPassword = ''; //Stats Password

World = 50; //S.M.A.R.T World Number.

procedure DeclineTrade; forward;

procedure Advertise;
begin
case random(6) of
0: TypeSend('Trade for ' + Level + '+ PC World');
1: TypeSend('trade me for ' + Level + '+ Pc WOrld!!');
2: TypeSend('green: trade me for an awesome ' + Level + '+ PC W0rld!!');
3: TypeSend(Level + '+ PC world, trade for more info!!');
4: TypeSend('trade for ownage ' + Level + '+ PC world.');
5: TypeSend('tr4d3 f0r ub3r 1337 ' + Level + '+ PC world');
end;
end;

procedure AcceptedTradeTalk;
begin
case random(21) of
0: TypeSend('Thanks, now go help them.');
1: TypeSend('Thanks, have fun.');
2, 15, 16, 17: TypeSend('Goodluck!');
3: TypeSend('Thank You, good luck.');
4, 9, 10, 11: TypeSend('good luck.');
5, 12, 13, 14: TypeSend('thanks.');
6: TypeSend('have fun.');
7: TypeSend('go get some xp.');
8: TypeSend('go help the void knight.');
18: TypeSend('go pwn some pests :p');
19: TypeSend(':p');
20: TypeSend('thnx.');
end;
end;

procedure DeniedTradeTalk;
begin
case random(21) of
0: TypeSend('nub');
1: TypeSend('your not high enough level, sorry.');
2, 15, 16, 17: TypeSend('your too nub.');
3: TypeSend('sorry, not high enough');
4, 9, 10, 11: TypeSend('sorry');
5, 12, 13, 14: TypeSend('your dont meet requirements, sorry.');
6: TypeSend('come back later maybe?, when you are high enough lvl.');
7: TypeSend('sorry, maybe later when you are higher lvl?');
8: TypeSend('perhaps if you lvl up some I can tell you the world.');
18: TypeSend('sorry, not good enough');
19: TypeSend('later maybe, when you are higher lvl.');
20: TypeSend('not now, too low of lvl.');
end;
end;

procedure GetCharLevels(var Levels: TIntegerArray; CharName: string); //mixster
var
myClient: Integer;
page: string;
A, S, D, R, M, p : integer;
begin
myClient := InitializeHTTPClient(True,True);
ClearPostData(myclient);
AddPostVariable(myclient,'user1',CharName);
page:= PostHTTPPageEx(myclient,'http://hiscore.runescape.com/hiscorepersonal.ws');

p := Pos('Attack', page);
p := PosEx('Attack', page, p + 1);
Delete(Page, 1, p + 6);
A := [StrToInt(Between('<td align="right">', '</td>', page))];
Delete(Page, 1, Pos('bold;">', Page) + 7);
WriteLn('Attack is: ' + IntToStr(A));

p := Pos('Strength', page);
p := PosEx('Strength', page, p + 1);
Delete(Page, 1, p + 6);
S := [StrToInt(Between('<td align="right">', '</td>', page))];
Delete(Page, 1, Pos('bold;">', Page) + 7);
WriteLn('Strength is: ' + IntToStr(S));

p := Pos('Defence', page);
p := PosEx('Defence', page, p + 1);
Delete(Page, 1, p + 6);
D := [StrToInt(Between('<td align="right">', '</td>', page))];
Delete(Page, 1, Pos('bold;">', Page) + 7);
WriteLn('Defence is: ' + IntToStr(D));

p := Pos('Range', page);
p := PosEx('Range', page, p + 1);
Delete(Page, 1, p + 6);
R := [StrToInt(Between('<td align="right">', '</td>', page))];
Delete(Page, 1, Pos('bold;">', Page) + 7);
WriteLn('Range is: ' + IntToStr(R));

p := Pos('Mage', page);
p := PosEx('Mage', page, p + 1);
Delete(Page, 1, p + 6);
M := [StrToInt(Between('<td align="right">', '</td>', page))];
Delete(Page, 1, Pos('bold;">', Page) + 7);
WriteLn('Mage is: ' + IntToStr(M));

FreeHTTPClient(myClient);
end;

procedure W;
begin
Wait(500);
end;

function AreTheyRightLevel(whatlevel: integer): boolean;
begin
if CombatLvl <= Level + HowManyMore then
begin
Result := True;
WriteLn('They Are the Correct Level, About to show World #');
end else
begin
Result := False;
WriteLn('Not High enough level, nub.');
end;
end;

function AcceptTrade: boolean;
begin
if not FindColor(x, y, 8388736, MCX1, MCY1, MCX2, MCY2) then
begin
exit;
end;
if FindTextTpa(8388736, 5, MCX1, MCY1, MCX2, MCY2, 'trade', UpChars, ClickLeft) then
begin
WriteLn('Someone Traded, Acccepting.');
Result := True;
end else
Result := False;
end;

procedure PutUpWorld;
var
OneCoin, TwoCoins, ThreeCoins, FourCoins, FiveCoins, FiftyCoins, OneHundredCoins : integer;
begin
if World = 1 then
begin
OneCoin := DTMFromString('78DA6354636660B8CCC8800C36F48B8269982' +
'8A336A61A982C5C8D0650CD79026A14806A2E1250A30454738D80' +
'1A55C26A00DBD00750');
if FindDTM(OneCoin, x, y, MIX1, MIY2, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, false);
W;
ChooseOption('all');
Wait(2500 + random(1000));
DeclineTrade;
end;
FreeDTM(OneCoin);
end;
if World = 2 then
begin
TwoCoins := DTMFromString('78DA63D4626660B8C2C8800CA2BDB819B8803' +
'448F43F10301A03D55C45550391859140DA00A8E61201359A4035' +
'E709A85125428D02117681D45C24A04605A8E61A116E26E07700A' +
'3500DC4');
if FindDTM(TwoCoins, x, y, MIX1, MIY2, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, false);
W;
ChooseOption('all');
DeclineTrade;
Wait(2500 + random(1000));
end;
FreeDTM(TwoCoins);
end;
if World = 3 then
begin
ThreeCoins := DTMFromString('78DA63D4676660B8CAC8800C364E1063E002D' +
'220D1FF40C0680E54730E550D441646026903A09A0B04D46811A1' +
'469908350A40359709A8D100AAB946849B6F1050638A193E186AA' +
'C806A2EE1570300A7350FA8');
if FindDTM(ThreeCoins, x, y, MIX1, MIY2, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, false);
W;
ChooseOption('all');
Wait(2500 + random(1000));
DeclineTrade;
end;
FreeDTM(ThreeCoins);
end;
if World = 4 then
begin
FourCoins := DTMFromString('78DA63D4636660B8C2C8800C364E1063E002D' +
'220D1FF40C06805547309550D441646026923A09AF304D46810A1' +
'4601A8E622116A2E13506300547303BF1A0090F40C80');
if FindDTM(FourCoins, x, y, MIX1, MIY2, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, false);
W;
ChooseOption('all');
Wait(2500 + random(1000));
DeclineTrade;
end;
FreeDTM(FourCoins);
end;
if World >= 5 then
begin
FiveCoins := DTMFromString('78DA63D4656660B8C4C8800CEE6E9166E002D' +
'220D1FF40C06805547311550D441646026933A09AAB04D46801D5' +
'DC20A04619A8E63A01350A986EC650A30954739E801A43A09A73F' +
'8D50000D80E0DE4');
if FindDTM(FiveCoins, x, y, MIX1, MIY2, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, false);
W;
ChooseOption('x');
W;
TypeSend(IntToStr(World));
Wait(2500 + random(1000));
DeclineTrade;
end;
FreeDTM(FiveCoins);
end;
if World >= 50 then
begin
FiftyCoins := DTMFromString('78DA6334646660B8C8C8800C364E1063E002D' +
'220D1FF40C06809547315550D441646026953A09A3304D4E802D5' +
'9C24A0468308731488708F1650CD0D026A407EBF895F0D0077160' +
'D91');
if FindDTM(FiftyCoins, x, y, MIX1, MIY2, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, false);
W;
ChooseOption('x');
W;
TypeSend(IntToStr(World));
Wait(2500 + random(1000));
DeclineTrade;
end;
FreeDTM(FiftyCoins);
end;
if World >= 100 then
begin
OneHundredCoins := DTMFromString('78DA63D463666038CBC8800C7E5F0E62E002D' +
'220D1FF40C0680E54731C550D441646026913A09A2304D4A801D5' +
'9C26A04601A8E61C01358A4035D709A8D106AAB9490535207F5D2' +
'3A0C612A8E6027E35008B3B104F');
if FindDTM(OneHundredCoins, x, y, MIX1, MIY2, MIX2, MIY2) then
begin
Mouse(x, y, 3, 3, false);
W;
ChooseOption('x');
W;
TypeSend(IntToStr(World));
Wait(2500 + random(1000));
DeclineTrade;
end;
FreeDTM(OneHundredCoins);
end;
end;

procedure DeclineTrade;
var
Decline : integer;
begin
Decline := BitmapFromString(41, 13, 'beNq1lF0OgkAMhHsm8VXik' +
'9FbczQ3TpyM0/1hUUlDmrLtR8vQdXlcz7N2XxfY7XIy46M9VkptEb' +
'ApLtAl6xga1Uo6riHduECH0I+h6bdYZv9Ah9A7UENj8r9CUwOawmD' +
'uOl4nt/e9lWgyy2hMnhpgOhAhzdJRRHEsERENdtAhiQaygfMMnWpQ' +
'q/XROqJZtFFytWHXOtsv0XrllcLvazLTvVGV2RCdG6fI9ZX0t8qNm' +
'8w4PTisxiIhkq423lpceUtX1+bOBfhhT7zRSHc=');
if FindBitmap(Decline, x, y) then
begin
W;
Mouse(x, y, 3, 3, true);
end;
end;

procedure Report;
begin
SRLRandomReport;
ClearReport;
AddToReport('[----Skilld PC Advertiser----]');
AddToReport('[----------------------------]');
AddToReport('[---------Accepted: ' + IntToStr(CharsAccepted) + '---------]');
AddToReport('[----------------------------]');
AddToReport('[---------Denied: ' + IntToStr(CharsDenied) + '----------]');
AddToReport('[----------------------------]');
AddToReport('[---------Ran For: ' + IntToStr(TimeRunning) + '---------]');
AddToReport('[----------------------------]');
end;

begin
SetupSRL;
{$IFDEF SMART}
SmartSetupEx(World, false, true);
wait(10000+random(5000));
SetTargetDC(SmartGetDC);
repeat
wait(100);
until(SmartGetColor(253, 233)<>1118604);
{$ENDIF}
ScriptID := '772';
SRLId := YourSRLId;
SRLPassword := YourSRLPassword;
repeat
repeat
Advertise;
until AcceptTrade;
if AreTheyRightLevel(Level) or (A = 99) or (S = 99) or (D = 99) or (R = 99) or (M = 99) then
begin
W;
PutUpWorld;
CharsAccepted := CharsAccepted + 1;
SRLReportVars[1] := SRLReportVars[1] + 1;
AcceptedTradeTalk;
end else
begin
SRLReportVars[2] := SRLReportVars[2] + 1;
CharsDenied := CharsDenied + 1;
DeniedTradeTalk;
end;
Report;
until CharsAccepted = CharsToAccept
end.

drizzt

2008-04-08 21:42:32

well idk about it not compiling, but won't this accept anyone under level + Howmanymore?

if CombatLvl <= Level + HowManyMore then

if i am right, i think this'll work

if (CombatLvl >= Level) and (CombatLvl <= Level + HowManyMore)

or…

if (CombatLvl >= Level) then
if (CombatLvl <= Level + HowManyMore) then

if that's your style :p

skilld u

2008-04-08 21:52:25

oh, thanks, that is what I wanted, didn't spend enough time on it :p. any ideas on the combat level part?

drizzt

2008-04-09 17:24:53

also…for the page on the levels part, i think you want this instead of what you did..it still doesn't work though :\

page:= PostHTTPPageEx(myclient,'http://hiscore.runescape.com/hiscorepersonal.ws?user1=' + charname);

skilld u

2008-04-09 17:27:11

i found a better way to do it :p I'm using jhildy's skill lvl getter. way easier to understand.

Timothegreat

2008-04-09 20:33:19

really cool looking… as i am making a pest controller maybe :)