Log in

View Full Version : Massively confused making my first script



Nig
07-16-2012, 08:37 PM
I am working on my first script as I would love to learn how to make my own custom bots and also contribute to the forums.

The first script should be fairly simple but I am having an awful time with it. What I want the script to do is simply stand there. When traded, I want the script to accept the trade offer, wait until something is placed in the trade screen, and then accept the trade on both trade windows.

The bot will then continue to stand there until it gets another trade offer.

I'll start off by saying I have read a few guides, and I have found that some are outdated which makes this a huge pain to find information. I have also found a script similar to what i am trying to make but it also is a few years outdated so I can't really learn anything form it.

Here is what I have so far...


program New;
{$DEFINE SMART}
{$i srl/srl.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure Trade;
var
x, y : Integer;
Begin
repeat
if(FindColorTolerance(x, y, 8388736, 0, 0, 790, 560, 4))then
begin
Mouse(x, y, 0, 0, true);
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
end.


At the point all I am trying to do is get the script to click on the trade offer and bring up the trade window, and I can't even do that. I have two accounts for testing. I can't even get this to compile and I'v spent hours reading guides. If anyone could help me get past this first part of making the script I'd sure appreciate it as i am very frustrated at this point.

Element17
07-16-2012, 08:55 PM
program New;
{$DEFINE SMART}
{$i srl/srl.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

procedure Trade;
var
x, y : Integer;
Begin
repeat //You have a repeat but no until
if(FindColorTolerance(x, y, 8388736, 0, 0, 790, 560, 4))then
begin
Mouse(x, y, 0, 0, true);
end;
End;

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
Trade; //You also never call your function/procedure ever so it would never do anything
end.

That compiles without the repeat.

Also try looking in the chat box...there are built in functions for that.

Getdropped
07-16-2012, 09:26 PM
program New;
{$DEFINE SMART}
{$i srl/srl.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

procedure Trade;
var
x, y : Integer;
Begin
repeat //You have a repeat but no until
if(FindColorTolerance(x, y, 8388736, 0, 0, 790, 560, 4))then
begin
Mouse(x, y, 0, 0, true);
end;
End;

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
Trade; //You also never call your function/procedure ever so it would never do anything
end.

That compiles without the repeat.

Also try looking in the chat box...there are built in functions for that.

Lower case b and lowercase e

]program New;
{$DEFINE SMART}
{$i srl/srl.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

procedure Trade;
var
x, y : Integer;
begin//here
repeat //You have a repeat but no until
if(FindColorTolerance(x, y, 8388736, 0, 0, 790, 560, 4))then
begin
Mouse(x, y, 0, 0, true);
end;
until(find what ever you want to repeat until)
end;//here

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
Trade; //You also never call your function/procedure ever so it would never do anything
end.

also if you are using smart declare it after "begin" and before "SetUpSRL"

Hope that helps ;)

Element17
07-17-2012, 12:04 AM
Lower case b and lowercase e

]program New;
{$DEFINE SMART}
{$i srl/srl.simba}

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

procedure Trade;
var
x, y : Integer;
begin//here
repeat //You have a repeat but no until
if(FindColorTolerance(x, y, 8388736, 0, 0, 790, 560, 4))then
begin
Mouse(x, y, 0, 0, true);
end;
until(find what ever you want to repeat until)
end;//here

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
Trade; //You also never call your function/procedure ever so it would never do anything
end.

also if you are using smart declare it after "begin" and before "SetUpSRL"

Hope that helps ;)

You don't have to have a lowercase b or e...that is just the way I like to script and I didn't feel changing everything....