PDA

View Full Version : Rune Buyer - In Store



purple37
04-08-2007, 02:42 AM
The may be my first script but i think it is pretty good for a first
What: buys runes at any store (at least the free world ones)

Elemental (Fire, Water, Earth, Air)
Mind
Body
Chaos
Death

Version: 1.69 (about)
Where: Any shop that has runes in the same positions as the ones in the free world
Special: This part took me a long time until i figured out what i needed to do - you enter your max price in the constants and it wont buy until the price is down to your max price or lower

I hope you like it (its my first script so remember that)

Request for the 'First Script' forum: please make a sticky that people shouldn't post 'First Script' or something to that effect in their title because it is the FIRST SCRIPT forum (its really bugging me - sorry)

{ MADE BY: Purple37
Name: Store Rune Buyer <><><><><><> My FIRST script
Description: Buys Runes in stores
Version: 1.68
Script ID: 102
Compiles: YES ~ LOLZ

<> <a href="http://www.villavu.com/forum/showthread.php?t=8196?p=87955" target="_blank">http://www.srl-forums.com/forum/rune...3.html?p=87955</a> <>

<><><><><><><><><> Detailed Description <><><><><><><><><><><><><><><><><>

-My first script
-WAY longer than it could be
-No anti-randoms
-I'M LEARNING

-Start with trade box open

-Buys runes from stores
-Fire, Water, Air, Earth, Mind, Body, Chaos, Death
-Elemental (Fire, Water, Air, Earth)
-Highest it will buy is __ gp (you choose)
-Mind
-Highest price it will buy at is __ gp (you choose)
-Body
-Highest price it will buy at is __ gp (you choose)
-Chaos
-Always Buys
-Death
-Always Buys
-Stops when certain number of runes is bought

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}


program RuneBuyer;
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/Amount.scar}

Var
Runes,ElementalPrice,BodyPrice,MindPrice,PriceIs,P layersLeft: Integer;

Const //Caps count for rune kind (first letter is cap)
RuneKind ='Water'; //Fire, Water, Air, Earth, Mind, Body, Chaos, Death
RunesAmount = 500; //number of runes you would like to buy (doest work for chaos or death)
//multiples of 10 only (for now)
{<><><><><><><><><><><><><> Shop <><><><><><><><><><><><>}
Shop = 'Betty'; //Aubury or Betty (watch caps)

{<><><><><><><> What price would you like to stop buying at? <><><><><><><><><><><><><><>}
ElementalRunePrice = 12; //MAX price would like to buy the runes at
BodyRunePrice = 5;
MindRunePrice = 13;
{Always buys Death and Chaos runes}

{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}
{<><><><><><><><><><><><><><> SCRIPT STARTS <><><><><><><><><><><><><>}
{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}
Procedure DeclarePlayers;
Begin
HowManyPlayers:=4; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=0;

Players[0].Name :='Purple37'; //username
Players[0].Pass :='STOPSTEALINGACCOUNTS'; //password
Players[0].Nick :='urp'; // 3-4 sequencial lower case letters in you name
Players[0].Active:=True; // use this account or not? True = yes | False = no

Players[1].Name :='Purple37';
Players[1].Pass :='STOPSTEALINGACCOUNTS';
Players[1].Nick :='urpl';
Players[1].Active:=True;

Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Active:=False;

Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Active:=False;
End;

function DoAntiBan: Boolean; //from JAD's tut edited to fit this script
begin //lost my 100% mine but i will make my own
AntiBan;
wait(50 + random(50));
BoredEvery(3 + random(3));
wait(100 + random(100))
RotateEvery(2 + random(2));
wait(700 + random(200));
LeaveScreenEvery(4 + random(3));
wait(200 + random(350));
end;

Procedure MyAntiBans; //I'll probably make my own after i study them a bit more
Begin
DoAntiBan;
End;

Procedure MyAntiRandoms;
Begin
FindNormalRandoms; //i've also seen 'FindFastRandoms' but i don't know the difference
MakeCompass('N');
End;

Function IsText(TextB: String) : boolean; //THANK YOU JUKKA
var cx,cy : integer;
begin
if FindText(cx,cy,TextB,smallchars,19, 415, 240, 431)then
result:= True;
end;
{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}
procedure SetUp; // is this procedure correct?
begin
SetUpSRL;
ScriptID:='102';
DeclarePlayers;
If(not(LoggedIn))Then
LoginPlayer;
End;
{<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>}
Procedure ElementalCheck;
Begin
If Not LoggedIn then Exit;
Wait(500 + Random(500));
For ElementalPrice := ElementalRunePrice + 1 to ElementalRunePrice + 20 do
If IsText('costs ' + IntToStr(ElementalPrice))then
Begin
PriceIs := ElementalPrice;
WriteLn('The price is ' + IntToStr(PriceIs) + ' coins - you wanted ' + IntToStr(ElementalRunePrice) + ' gp max');
Wait(15000 + Random(10000));
End
Else
Wait(250 + random(250));
End;

Procedure MindCheck;
Begin
If Not LoggedIn then Exit;
Wait(500 + Random(500));
For MindPrice := MindRunePrice + 1 to MindRunePrice + 20 do
If IsText('costs ' + IntToStr(MindPrice))then
Begin
PriceIs := MindPrice;
WriteLn('The price is ' + IntToStr(PriceIs) + ' coins - you wanted ' + IntToStr(MindRunePrice) + ' gp max');
Wait(15000 + Random(10000));
End
end;

Procedure BodyCheck;
begin
If Not LoggedIn then Exit;
Wait(500 + Random(500));
For BodyPrice := BodyRunePrice + 1 to BodyRunePrice + 20 do
If IsText('costs ' + IntToStr(BodyPrice))then
Begin
PriceIs := BodyPrice;
WriteLn('The price is ' + IntToStr(PriceIs) + ' coins - you wanted ' + IntToStr(BodyRunePrice) + ' gp max');
Wait(15000 + Random(10000));
End
end;

Procedure TradeNPC; //its coming
Begin
If Not LoggedIn then Exit;
If Shop = 'Betty' then
Begin
If FindColor(x,y,6752360,0,0,517,340)then
Begin
Mouse(x,y,0,0,false);
Wait(100 + Random(100));
ChooseOption(x,y,'Trade');
Wait(250 + Random(500));
End
End

If Shop = 'Aubury' then
Begin
If FindColor(x,y,1954801,0,0,517,340)then
Begin
Mouse(x,y,0,0,false);
Wait(100 + Random(100));
ChooseOption(x,y,'Trade');
Wait(250 + Random(500));
End
End
End;

Procedure Coins;
Begin
If Not LoggedIn then Exit;
PlayersLeft := 0
Begin
If(InChat('enough coins'))then;
Begin
PlayersLeft := PlayersLeft + 1;
WriteLn('Out of money!!!!')
WriteLn('You have been logged out!')
Wait(1000 + Random(500));
MouseBox(480,33,406,49,1);
Wait(1000 + Random(500));
Logout;
If PlayersLeft = HowManyPlayers Then
Begin
TerminateScript;
End
Else
NextPLayer(False);
If Not PlayersLeft = HowManyPlayers Then
Begin
Wait(250 + random(50));
End
End
End
End;

Procedure AllRunes;
Begin
If Not LoggedIn then Exit;
If Runes >= RunesAmount then
Begin
WriteLn('You have bought ' + IntToStr(RunesAmount)+ ' ' + RuneKind + ' runes!')
WriteLn('You have been logged out!')
Wait(1000 + Random(500));
MouseBox(480,33,406,49,1);
Wait(1000 + Random(500));
Logout;
TerminateScript;
End
If Not Runes >= RunesAmount then
Begin
Wait(250 + random(50));
End
End;

Procedure BuyRunes;
Begin
If Not LoggedIn then Exit;
Runes:=0
TradeNPC;

If(RuneKind = 'Fire') then
Begin
Runes := 0
Repeat
Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10; //SRL report
Repeat
MouseBox(85,78,104,93,1);
Wait(50)
ElementalCheck;
Wait(300 + random(200));
Until Not IsText('costs ' + IntToStr(ElementalPrice))
If Runes = 100 or 200 or 300 or 400 or 500 or 600 or 700 or 800 or 900 or 1000 or 1100 or 1200 or 1300 or 1400 or 1500 or 1600 or 1700 or 1800 or 1900 or 2000 or 2100 or 2200 or 2300 or 2400 or 2500 or 2600 or 2700 or 2800 or 2900 or 3000 or 3100 then
Begin {Maybe there is something simpler for the idea/part}
WriteLn('100 runes have been bought');
End
Wait(250 + Random(50));
MouseBox(85,78,104,93,2);
Wait(500 + Random(500));
ChooseOption(x,y,'10');
Until(Runes >= RunesAmount) or (InChat('enough coins'));
Coins;
AllRunes;
End;

If(Runekind = 'Water') then
Begin
Runes:=0
Repeat
Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10;
Repeat
MouseBox(133,78,152,93,1);
Wait(50)
ElementalCheck;
Wait(300 + random(15));
Until Not IsText('costs ' + IntToStr(ElementalPrice))
If Runes = 100 or 200 or 300 or 400 or 500 or 600 or 700 or 800 or 900 or 1000 or 1100 or 1200 or 1300 or 1400 or 1500 or 1600 or 1700 or 1800 or 1900 or 2000 or 2100 or 2200 or 2300 or 2400 or 2500 or 2600 or 2700 or 2800 or 2900 or 3000 or 3100 then
Begin
WriteLn('100 runes have been bought');
End
MouseBox(133,78,152,93,2);
Wait(250 + Random(50));
ChooseOption(x,y,'10');
Wait(250 + Random(250));
Until(Runes >= RunesAmount) or (InChat('enough coins'));
Coins;
AllRunes;
End;

If(Runekind = 'Air') then
Begin
Runes:=0
Repeat
Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10;
Repeat
MouseBox(181,78,200,93,1);
Wait(50)
ElementalCheck;
Wait(300 + random(200));
Until Not IsText('costs ' + IntToStr(ElementalPrice))
If Runes = 100 or 200 or 300 or 400 or 500 or 600 or 700 or 800 or 900 or 1000 or 1100 or 1200 or 1300 or 1400 or 1500 or 1600 or 1700 or 1800 or 1900 or 2000 or 2100 or 2200 or 2300 or 2400 or 2500 or 2600 or 2700 or 2800 or 2900 or 3000 or 3100 then
Begin
WriteLn('100 runes have been bought');
End
MouseBox(181,78,200,93,2);
Wait(500 + Random(500));
ChooseOption(x,y,'10');
Until(Runes >= RunesAmount) or (InChat('enough coins'));
Coins;
AllRunes;
End;

If(Runekind = 'Earth') then
Begin
Runes:=0
Repeat
Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10;
Repeat
MouseBox(224,79,245,93,1);
Wait(50)
ElementalCheck;
Wait(300 + random(200));
Until Not IsText('costs ' + IntToStr(ElementalPrice))
If Runes = 100 or 200 or 300 or 400 or 500 or 600 or 700 or 800 or 900 or 1000 or 1100 or 1200 or 1300 or 1400 or 1500 or 1600 or 1700 or 1800 or 1900 or 2000 or 2100 or 2200 or 2300 or 2400 or 2500 or 2600 or 2700 or 2800 or 2900 or 3000 or 3100 then
Begin
WriteLn('100 runes have been bought');
End
MouseBox(224,79,245,93,2);
Wait(500 + Random(500));
ChooseOption(x,y,'10');
Until(Runes >= RunesAmount) or (InChat('enough coins'));
Coins;
AllRunes;
End;

If(Runekind = 'Mind') then
Begin
Runes:=0
Repeat
Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10;
Repeat
MouseBox(270,79,295,93,1);
Wait(50)
MindCheck;
Wait(300 + random(200));
Until Not IsText('costs ' + IntToStr(MindPrice))
If Runes = 100 or 200 or 300 or 400 or 500 or 600 or 700 or 800 or 900 or 1000 or 1100 or 1200 or 1300 or 1400 or 1500 or 1600 or 1700 or 1800 or 1900 or 2000 or 2100 or 2200 or 2300 or 2400 or 2500 or 2600 or 2700 or 2800 or 2900 or 3000 or 3100 then
Begin
WriteLn('100 more runes have been bought');
End
MouseBox(270,79,295,93,2);
Wait(500 + Random(500));
ChooseOption(x,y,'10');
Until(Runes >= RunesAmount) or (InChat('enough coins'));
Coins;
AllRunes;
End;

If(Runekind = 'Body') then
Begin
Runes:=0
Repeat
Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10;
Repeat
MouseBox(318,79,340,93,1);
Wait(50)
BodyCheck;
Wait(300 + random(200));
Until Not IsText('costs ' + IntToStr(BodyPrice))
If Runes = 100 or 200 or 300 or 400 or 500 or 600 or 700 or 800 or 900 or 1000 or 1100 or 1200 or 1300 or 1400 or 1500 or 1600 or 1700 or 1800 or 1900 or 2000 or 2100 or 2200 or 2300 or 2400 or 2500 or 2600 or 2700 or 2800 or 2900 or 3000 or 3100 then
Begin
WriteLn('100 runes have been bought');
End
MouseBox(318,79,340,93,2);
Wait(500 + Random(500));
ChooseOption(x,y,'10');
Until(Runes >= RunesAmount) or (InChat('enough coins'));
Coins;
AllRunes;
End;

If(Runekind = 'Chaos') then
Begin
Runes:=0
Repeat
{Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10;}
MouseBox(367,79,384,93,2);
Wait(500 + Random(500));
ChooseOption(x,y,'10');
Wait(500 + random(500));
If(InChat('out of stock'))then
Begin
Wait(2500 + Random(1000));
End
If Not InChat('out of stock')then
Wait(50 + Random(50));
Until{(Runes >= RunesAmount) or }(InChat('enough coins'));
Coins;
End;

If(Runekind = 'Death') then
Begin
Runes:=0
Repeat
{Runes:=Runes + 10;
ReportVars[0] := ReportVars[0] + 10;}
MouseBox(416,79,433,93,2);
Wait(50 + Random(50));
ChooseOption(x,y,'10');
Wait(50 + random(50));
If(InChat('out of stock'))then
Begin
Wait(2500 + Random(1000));
End
If Not InChat('out of stock')then
Wait(50 + Random(50));
Until{(Runes >= RunesAmount) or }(InChat('enough coins'));
Coins;
End;
End;

{<><><><><><><><><> MAIN LOOP <><><><><><><><><><>}
Begin //I like this part simple
Wait(1500);
Setup;
If Not LoggedIn then
NextPlayer(False);
MyAntiBans;
MyAntiRandoms;
BuyRunes;
End.

bloodargon
04-10-2007, 06:48 PM
Looks very nice, but, looking over it, and from what you said, you should probably use small bitmaps. Of course Im a bit of a noob at scripting, so, who knows...

Also, thanks for the example of the settings, like, choosing rune kind, I can use for mine now, thanks a BUNCH!

purple37
04-14-2007, 10:58 PM
o lol what you called exapmle settings were what i probably used last
and im still working on the trade with the npc so for now start in the tradebox and dont use multiple players - lol