Sir R. M8gic1an
2009-08-02 23:11:48
Rasta Magician has reported a post.
Reason:
Post: key keeper55 - SRL Member Application
Forum: Appliances
Assigned Moderators: N/A
Posted by: key keeper55
Original Content:
Reason:
Promising newcomer
~RM
Post: key keeper55 - SRL Member Application
Forum: Appliances
Assigned Moderators: N/A
Posted by: key keeper55
Original Content:
How Long have You Played Runescape?
5 Year(s)
Are you affilated in anyway with Jagex LTD?
no
Were you Referred to SRL?
no
What is your general programming knowledge?
java, html, php
Are you a member of any other communities?
no
Tell us about yourself…From: key keeper55
one of my many hobbies is to play with electronic compenents and things like that. i also like building, drawing. i am like most people, if u are nice to me… il be nice to you :P
and i will try to be as active and helpful in the community as much as i can.
Please show us one (or multiple) of your scripts.program PlantPotBuyer;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.scar}
{================Global variables=================}
var
LoopResult: Boolean;
//Antiban variables:
FunnyText, FunnyResponse, RandomSayings, ReqResponse: array of String;
LastRespondTime, LastInteractionTime: Integer;
{================Script Constants=================}
const
{================Do not touch the following constants:=================}
ILoadsI = 0;
ISleepTimeI = 1;
IMoneyI = 2;
ILoadsDoneI = 3;
ISleepsDoneI = 4;
IRandomsHandledI = 5;
IDoorsOpenedI = 6;
IAntiBansI = 7;
{==============================================================)
DeclarePlayers. Should be self-explanatory.
(==============================================================}
Procedure DeclarePlayers;
Begin
NumberOfPlayers( 1 );
CurrentPlayer := StartPlayer;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active := true;
Writeln( IntToStr ( HowManyPlayers ) + ' Players' );
SetPlayerNameTPAs;
End;
procedure IncVar(VarNum: Integer);
begin
Inc(Players[CurrentPlayer].Integers[VarNum]);
end;
procedure IncVarEx(VarNum, IncBy: Integer);
begin
IncEx(Players[CurrentPlayer].Integers[VarNum], IncBy);
end;
{==================Antiban/Random Functions====================}
{==============================================================)
Automatically responds to trade/assist requests, along with words
in the FunnyText array. Returns true if responded, false otherwise.
(==============================================================}
function AutoRespond: Boolean;
var
i, a: Integer;
begin
Result := False;
//If we haven't responded to chat in more than 2 mins...
if(GetTimeRunning>LastRespondTime+120000)then
begin
a := High(FunnyText);
for i:=0 to a do
if(ChatBoxTextExists(FunnyText[a], 'chat'))then
begin
Result := True;
LastRespondTime := GetTimeRunning;
end;
end;
//If we haven't responded to trade/assist requests in more than 5 mins...
if(not Result and (GetTimeRunning>LastInteractionTime+300000))then
if(ChatBoxTextExists('trade', 'you'))then
begin
TypeSend(AddMistakes(reqResponse[Random(Length(reqResponse))], 25));
Result := True;
LastInteractionTime := GetTimeRunning;
end;
if Result then IncVar(IAntiBansI);
end;
{==============================================================)
Says a random thing from RandomSayings. If required is true,
the script says it every time this is called. If required is
false, the script says it randomly when this is called.
(==============================================================}
procedure RandomSpeak(Required: Boolean);
begin
if(Required or (Random(10)=0))then
TypeSend(AddMistakes(RandomSayings[Random(Length(RandomSayings))], 25));
end;
{==============================================================)
Simple, Random antiban. Returns mouse to original position after
each antiban loop.
(==============================================================}
procedure AntiBan;
var
Performed: Boolean;
begin
Performed := True;
if not LoggedIn then Exit;
if(AutoRespond) then Exit; //If we've autoresponded, no need to do more antiban.
case Random(40) of
1: RandomMovement;
2: RandomRClick;
3: HoverSkill(LampSkill, False);
4: BoredHuman;
5: RandomSpeak(False);
else begin
Wait(1000+random(1500));
Performed := False;
end;
end;
if Performed then IncVar(IAntiBansI);
end;
{==============================================================)
Handles randoms that we may encounter.
(==============================================================}
function HandleRandoms: Boolean;
var
dir: Char;
begin
Result := R_SolveNonTalkingRandoms;
if Result then IncVar(IRandomsHandledI);
end;
{================Script operation functions====================}
{==============================================================)
Gets the walking coordinates
(==============================================================}
function GetCoordsList: TPointArray;
begin
Result := [
Point(3033,3287),
Point(3042,3275),
Point(3059,3276),
Point(3076,3268),
Point(3084,3253),
Point(3092,3244)
];
end;
{==============================================================)
Checks to see if we're in the bank
(==============================================================}
function InBank: Boolean;
begin
if Players[CurrentPlayer].loc='Bank' then
Result := true;
end;
{==============================================================)
Check to see if we're in the shop.
(==============================================================}
function InShop: Boolean;
begin
if Players[CurrentPlayer].loc='Shop' then
Result := true;
end;
{*******************************************************************************
function ClickDoor(DoorObj: integer; Dir, Action: string): Boolean;
By: lordsaturn
Description: Clicks a door. (or almost any object inbetween tiles)
Based off of the above SRL function, with a few modifications to fit the script.
*******************************************************************************}
function OpenClosedLMDoor(Dist: Integer; DirOrder: TStringArray): Boolean;
var
Loc, MS: TPoint;
i, MIndex: Integer;
begin
Result := False;
if not FindObjectEx(Loc, 8695, Dist) then Exit;
MIndex := High(DirOrder);
for i:=0 to MIndex do
begin
case LowerCase(DirOrder[i]) of
'n': MS := TileToMSEx(Tile(Loc.x + 0.5, Loc.y + 1.1), 40);
's': MS := TileToMSEx(Tile(Loc.x + 0.5, Loc.y + 0.1), 40);
'w': MS := TileToMSEx(Tile(Loc.x + 0.1, Loc.y + 0.5), 40); //try x-.5, y-.1
'e': MS := TileToMSEx(Tile(Loc.x + 1.1, Loc.y + 0.5), 40);
else writeln('Invalid direction.');
end;
if MS.x = 0 then Exit;
Mouse(MS.x, MS.y, 3, 3, False);
if(R_IsUpTextMulti(['Door', 'oor', 'Doo']))then
Result := R_ChooseOption('Open');
end;
if Result then IncVar(IDoorsOpenedI);
end;
{==============================================================)
Walks to:
Bank: True
Shop: False
(==============================================================}
function WalkTo(Bank: Boolean): Boolean;
var
h, i, d, CDoorx, CDoory, DoorObj: Integer;
WalkArray: TPointArray;
t: String;
dirOrder: array of String;
begin
//If we're already there...
if((Bank and InBank) or ((not Bank) and InShop))then
begin
Result := True;
Exit;
end;
//Loads the coords we're walking to.
WalkArray := GetCoordsList;
if((Bank and InShop) or ((not Bank) and InBank))then
begin
WalkArray := GetCoordsList;
if(Bank)then
begin
h := High(WalkArray);
i := 0;
d := 1;
end else
begin
i := High(WalkArray);
h := 0;
d := -1;
end;
end;
//While we aren't at our destination...
while(i<>h)do
begin
//If we're at the step before the door
if((Bank and (i=High(WalkArray))) or (not Bank and (i=High(WalkArray)-1)))then
begin
//Sets the door ints...
CDoorx := 3034;
CDoory := 3291;
DoorObj := 8695;
if Bank then
dirOrder := ['s', 'e', 'w', 'n']
else
dirOrder := ['n', 'e', 'w', 's'];
end;
//If the door is closed...
//if(GetObjectType(GetObjectAt(CDoorx, CDoory))=DoorObj)then
begin
//Walk near it
WalkToTile(Point(3034, 3291), 3, 1);
wait(RandomRange(500, 1500));
//Open it! If that doesn't work...
if(OpenClosedLMDoor(4, DirOrder))then
writeln('We opened the door! :D')
else
begin
writeln('Couldn''t open the door...');
Exit;
end;
end;
i := i + d;
//Go to the next tile
if not WalkToTile(WalkArray[i], 3, 1) then Exit; //If we couldn't get there...
end;
Result := True;
end;
function BuyPots: Boolean;
var
PointAt: TPoint;
SPoint: TNPC;
begin
Result := False;
if not FindNPC('Sarah', SPoint) then Exit;
writeln('Found Sarah...');
PointAt := TileToMS(SPoint.Tile, 7);
Mouse(PointAt.x, PointAt.y, 4, 4, false);
if not R_ChooseOption('Trade') then Exit;
writeln('Trading her...');
MouseBox(302, 97, 319, 117, 1);
if not R_ChooseOption('Buy X') then Exit;
writeln('Buying pots.');
wait(RandomRange(500, 800));
TypeSend(inttostr(RandomRange(28, 99)));
Result := True;
end;
function DepositPots: Boolean;
var
DepositSlot: Integer;
begin
Result := False;
OpenBankReflection('db');
if not R_BankScreen then Exit;
//Gets the slot that the money is in...
if(Players[CurrentPlayer].Integers[IMoneyI]=1)then
DepositSlot := 2
else
DepositSlot := 1;
Result := R_MouseItem(DepositSlot, 'Deposit-All');
if Result then IncVar(ILoadsDoneI);
end;
procedure Proggy;
begin
writeln('============Key Keeper55''s pot buyer==============');
writeln('Character: '+Players[CurrentPlayer].Name+'.');
writeln('Loads done: '+inttostr(Players[CurrentPlayer].Integers[ILoadsDoneI])+'.');
writeln('Sleeps done: '+inttostr(Players[CurrentPlayer].Integers[ISleepsDoneI])+'.');
writeln('Randoms handled: '+inttostr(Players[CurrentPlayer].Integers[IRandomsHandledI])+'.');
writeln('Doors opened: '+inttostr(Players[CurrentPlayer].Integers[IDoorsOpenedI])+'.');
writeln('Antibans done: '+inttostr(Players[CurrentPlayer].Integers[IAntiBansI])+'.');
writeln('================================================');
end;
procedure GoToNextPlayer(Active: Boolean);
begin
Proggy;
NextPlayer(Active);
end;
{==============Script initialization functions=================}
{==============================================================)
Sets up SMART correctly
(==============================================================}
procedure SetSmart;
begin
Smart_Members := true; //F2P or P2P
Smart_Server := RandomWorld(Smart_Members, false); //Random world
Smart_Signed := true; //Signed or Unsigned
Smart_SuperDetail := False; //Low detail or High detail
end;
{==============================================================)
Sets up a player to begin autoing.
(==============================================================}
function SetUpPlayer: Boolean;
begin
wait(RandomRange(1000, 2000));
if not(InBank or InShop)then
begin
writeln(Players[CurrentPlayer].Name+' isn''t in the bank or in the shop...');
end;
R_SetMultiChats('1', '2', '1', '1', '1');
wait(RandomRange(400, 800));
R_SetAngle(95+Random(6));
R_MakeCompass(IntToStr((350+Random(20)) mod 360));
if(Players[CurrentPlayer].Integers[IMoneyI]=0)then
begin
for Players[CurrentPlayer].Integers[IMoneyI]:=1 to 28 do
if ExistsItem(Players[CurrentPlayer].Integers[IMoneyI]) then
Break;
if(Players[CurrentPlayer].Integers[IMoneyI]=29)then
begin
writeln('Player '+inttostr(CurrentPlayer)+' has no money, apparently.');
Exit;
end;
Result := True;
end;
end;
{==============================================================)
Sets up the script as needed.
(==============================================================}
procedure SetUpScript;
begin
writeln('Setting up script...');
SetSmart;
SetUpSRL;
SetUpReflection;
DeclarePlayers;
loginplayer;
FunnyText := ['lol', 'haha', 'rofl', 'lmao', 'ha'];
FunnyResponse := ['XD', 'Haha!', 'Lol', 'Wow...'];
RandomSayings := ['...', 'I''m a lumberjack and I''m O.K. I sleep all night...', 'Bored... >.<'];
reqResponse := ['Nty', 'No, thanks.', 'Nah.', 'I''m good.', 'No, thanks though.', 'Hm... Nty.'];
writeln('Script set-up complete.');
end;
function MainLoop: Boolean;
var
i: Integer;
begin
Result := False;
if InShop then
if not WalkTo(True) then Exit;
//Walking to and from loop.
for i:=0 to Players[CurrentPlayer].Integers[ILoadsI] do
begin
//Should be in the bank at this point.
if not WalkTo(False) then Exit;
if not BuyPots then Exit;
if not WalkTo(True) then Exit;
if not DepositPots then Exit;
IncVar(ILoadsDoneI);
end;
Result := True;
end;
begin
SetUpScript;
repeat
if not SetUpPlayer then
begin
writeln('couldnt setp the player!');
GoToNextPlayer(False);
Continue;
end;
LoopResult := MainLoop;
Proggy;
GoToNextPlayer(LoopResult);
until(AllPlayersInactive);
end.