SRL Archive - First Scripts

Archery Ticket Trader


bloopa1

2012-06-27 18:30:50

this is a extremely simple script i made cause im to lazy to trade in my archery tickets and thought other people might enjoy it! Prior warining this I am first time scripter so baby sit if u run! ;) All forms of Feedback are very much apriciated!




program TicketMerchant;
{$define SMART}
{$i SRl/srl.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
end;
procedure Login;
begin
ClearDebug;
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;

if not LoggedIn then
begin
repeat
LoginPlayerToLob;
until LobbyScreen;
begin
LogInPlayer;
end;
end;

while not LoggedIn do
wait(250);
end;
Procedure Antiban;
begin
case random(25) of
5:PickUpMouse;
10:RandomRClick;
15:MMouse(MSX1, MSY1, MSX2, MSY2);
20:wait(1000+random(500));
end;
end;
Procedure FindMerchant;
var x, y: integer;
Begin
FindNormalRandoms;
Antiban;
if FindObj( x, y, 'erchant', 1317953, 10) then
Mouse(x, y, 10, 10, False);
wait(250+random(100));
ChooseOption('rade')
wait(500+random(500));
writeln('Found Ticket Merchant')
end;
Procedure BuyTickets;
var x, y: integer;
begin
FindNormalRandoms;
Antiban;
If not LoggedIn then
Exit;
repeat
FindNormalRandoms;
if FindObj(x, y, 'rrow', 7629913, 10) then
Mouse(x, y, 10, 10, False);
ChooseOption('uy');
wait(500+random(500));
Until(not(LoggedIn))
end;

begin
Login;
SetUpSRL;
FindMerchant;
repeat
BuyTickets;
until(not(LoggedIn))
end.

Based Lord

2012-07-02 13:24:39

First off, Congratulations on your first script!

You do need to work on your standards though
Check out this guide or another one in the Tutorials section

Another thing I see is using

if FindObj(x, y, 'rrow', 7629913, 10)
For finding a stationary object, Using DTMs or Bitmaps for this would be a much better option. Check out the Tutorials section or PM me if you need help with them.

Keep up the work, and if you have any questions please ask :)

bloopa1

2012-07-02 13:54:56

From: Based Lord
First off, Congratulations on your first script!

You do need to work on your standards though
Check out this guide or another one in the Tutorials section

Another thing I see is using

if FindObj(x, y, 'rrow', 7629913, 10)
For finding a stationary object, Using DTMs or Bitmaps for this would be a much better option. Check out the Tutorials section or PM me if you need help with them.

Keep up the work, and if you have any questions please ask :)


thank u! I dont know how to use bitmaps, but i tried doing DTMs however i came across the problem of u haveing the same dtm of the arrows being bought as the ones in ur inventory. So i just used FindObj instead :)

Based Lord

2012-07-02 14:02:37

When finding DTMs you can set the X, Y Start and X, Y Finish which specifies where it will look for the DTM
Example:

If FindDTM(YourDTM, X, Y, MIX1, MIY1, MIX2, MIY2) Then
This will search for your DTM starting from the Top left of the Inventory (MIX1,MIY1) to the bottom right of the Inventory (MIX2,MIY2). You could also use MSX1, MSY1, ect to search just the main screen

Let me know if you still need help

bloopa1

2012-07-02 14:05:19

From: Based Lord
When finding DTMs you can set the X, Y Start and X, Y Finish which specifies where it will look for the DTM
Example:

If FindDTM(YourDTM, X, Y, MIX1, MIY1, MIX2, MIY2) Then
This will search for your DTM starting from the Top left of the Inventory (MIX1,MIY1) to the bottom right of the Inventory (MIX2,MIY2). You could also use MSX1, MSY1, ect to search just the main screen

Let me know if you still need help



hahahahahaha i have specificly used this before….idk what i was thinking when i reponded……:duh:

putonajonny

2012-07-02 14:47:22

It is a good idea to keep to SRL standards, this means indenting lines like this, it makes them easier to read:
begin
Login;
SetUpSRL;
FindMerchant;
repeat
BuyTickets;
until(not(LoggedIn))
end.
Here:
if not LoggedIn then
begin
repeat
LoginPlayerToLob;
until LobbyScreen;
begin
LogInPlayer;
end;
end;
You don't actually need that begin and end, so it could just be:
if not LoggedIn then
begin
repeat
LoginPlayerToLob;
until LobbyScreen;
LogInPlayer;
end;
This is a simple script, I haven't tried it out but it is a great first script! well done, maybe you could now extend it to be a whole Range Guild Script, any questions just ask around, and you'll be making amazing scripts in no time!

bloopa1

2012-07-02 17:01:25

From: putonajonny
It is a good idea to keep to SRL standards, this means indenting lines like this, it makes them easier to read:
begin
Login;
SetUpSRL;
FindMerchant;
repeat
BuyTickets;
until(not(LoggedIn))
end.
Here:
if not LoggedIn then
begin
repeat
LoginPlayerToLob;
until LobbyScreen;
begin
LogInPlayer;
end;
end;
You don't actually need that begin and end, so it could just be:
if not LoggedIn then
begin
repeat
LoginPlayerToLob;
until LobbyScreen;
LogInPlayer;
end;
This is a simple script, I haven't tried it out but it is a great first script! well done, maybe you could now extend it to be a whole Range Guild Script, any questions just ask around, and you'll be making amazing scripts in no time!


i tried to message u this but ur inbox was full so I just wanted to say thanks for always looking out for my thread posts i really appreciate it. Hope all is going well with u. Thanks again :)

ISRA3L

2012-07-03 13:04:13

its F2P or P2P?

Rincewind

2012-07-03 13:10:23

From: Mister
its F2P or P2P?


P2P I think

bloopa1

2012-07-03 18:05:16

yes p2p at archery guild in near seers village