Log in

View Full Version : Scripting Help



ffcfoo
07-02-2010, 08:08 AM
Hello, I need a little help with some stuff I have here. Here is the Procedure I have:

Procedure Clicking;
begin
OpenBankFast('veb'); // Opens Bank
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
ChooseOption('All'); // Chooses The 'All' Button
CloseBank; // Closes Bank
InvMouse(1,1); // Clicks the first inventory slot '1' and clicks it '1'
InvMouse(2,2);
ChooseOption('se Kni');
MouseBox(264, 408, 274, 419, 2);
ChooseOption('X');
GetColor(245,403);
wait(Random(100));
TypeSend(ToStr(27 + Random(72)));
end;

This goes way to fast! I think I need to add a wait some where. But my friend said not to use wait(2000) but wait(Random(100)); is not working correctly. Can someone hear help me with this procedure. It is for my Fletcher.

Frement
07-02-2010, 08:20 AM
Wait(300+Random(300));

Like:
Procedure Clicking;
begin
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300+Random(300));
ChooseOption('All'); // Chooses The 'All' Button
Wait(300+Random(300));
CloseBank; // Closes Bank
Wait(300+Random(300));
InvMouse(1,1); // Clicks the first inventory slot '1' and clicks it '1'
Wait(300+Random(300));
InvMouse(2,2);
Wait(300+Random(300));
ChooseOption('se Kni');
MouseBox(264, 408, 274, 419, 2);
Wait(300+Random(300));
ChooseOption('X');
GetColor(245,403);
Wait(300+Random(300));
TypeSend(ToStr(27 + Random(72)));
end;

ffcfoo
07-02-2010, 08:50 AM
Wait(300+Random(300));

Like:
Procedure Clicking;
begin
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300+Random(300));
ChooseOption('All'); // Chooses The 'All' Button
Wait(300+Random(300));
CloseBank; // Closes Bank
Wait(300+Random(300));
InvMouse(1,1); // Clicks the first inventory slot '1' and clicks it '1'
Wait(300+Random(300));
InvMouse(2,2);
Wait(300+Random(300));
ChooseOption('se Kni');
MouseBox(264, 408, 274, 419, 2);
Wait(300+Random(300));
ChooseOption('X');
GetColor(245,403);
Wait(300+Random(300));
TypeSend(ToStr(27 + Random(72)));
end;

Alright thanks. Also I want this to repeat when the inventory is empty. So should I do this:

Procedure Clicking;
begin
Wait(900+Random(900));
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300+Random(300));
ChooseOption('All'); // Chooses The 'All' Button
Wait(300+Random(300));
CloseBank; // Closes Bank
Wait(300+Random(300));
InvMouse(1,1); // Clicks the first inventory slot '1' and clicks it '1'
Wait(300+Random(300));
InvMouse(2,2);
Wait(300+Random(300));
ChooseOption('se Kni');
Wait(300+Random(300));
MouseBox(264, 408, 274, 419, 2);
Wait(800+Random(800));
ChooseOption('X');
GetColor(245,403);
Wait(300+Random(300));
TypeSend(ToStr(27 + Random(72)));
Wait(700+Random(700));
InvEmpty;
Repeat(False);
end;

Frement
07-02-2010, 08:53 AM
Procedure Clicking;
begin
repeat
Wait(900+Random(900));
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300+Random(300));
ChooseOption('All'); // Chooses The 'All' Button
Wait(300+Random(300));
CloseBank; // Closes Bank
Wait(300+Random(300));
InvMouse(1,1); // Clicks the first inventory slot '1' and clicks it '1'
Wait(300+Random(300));
InvMouse(2,2);
Wait(300+Random(300));
ChooseOption('se Kni');
Wait(300+Random(300));
MouseBox(264, 408, 274, 419, 2);
Wait(800+Random(800));
ChooseOption('X');
GetColor(245,403);
Wait(300+Random(300));
TypeSend(ToStr(27 + Random(72)));
Wait(700+Random(700));
until(InvEmpty);
end;

But the knife is still there :)?

ffcfoo
07-02-2010, 05:24 PM
Procedure Clicking;
begin
repeat
Wait(900+Random(900));
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300+Random(300));
ChooseOption('All'); // Chooses The 'All' Button
Wait(300+Random(300));
CloseBank; // Closes Bank
Wait(300+Random(300));
InvMouse(1,1); // Clicks the first inventory slot '1' and clicks it '1'
Wait(300+Random(300));
InvMouse(2,2);
Wait(300+Random(300));
ChooseOption('se Kni');
Wait(300+Random(300));
MouseBox(264, 408, 274, 419, 2);
Wait(800+Random(800));
ChooseOption('X');
GetColor(245,403);
Wait(300+Random(300));
TypeSend(ToStr(27 + Random(72)));
Wait(700+Random(700));
until(InvEmpty);
end;

But the knife is still there :)?

Wait Im retarded xD Now I just want this to wait until it is done cutting then add the OpenBank; command.

Frement
07-02-2010, 09:24 PM
Make a DTM of the logs outline, then search that and click it after using knife. Then wait until(not FindDTM(LogDTM,-...));

ffcfoo
07-02-2010, 11:36 PM
Make a DTM of the logs outline, then search that and click it after using knife. Then wait until(not FindDTM(LogDTM,-...));

I'm not really following you. Could you show me? Here is the DTM I did for the logs: DTM := DTMFromString('78DA63CC636660C8626440068E56220CFC4 01' +
'A26CA580B545382AA86818109220753930C549349404D3A50 4D0D' +
'0135E54035A9F8D5000038480519');

Frement
07-02-2010, 11:46 PM
Something like this:
program new;
{$I SRL/SRL.scar}

var LogDTM: Integer;

procedure LoadDTMs;
begin
LogDTM := DTMFromString('78DA63CC636660C8626440068E56220CFC4 01' +
'A26CA580B545382AA86818109220753930C549349404D3A50 4D0D' +
'0135E54035A9F8D5000038480519');
end;

procedure FreeDTMs;
begin
FreeDTM(LogDTM);
end;

function OutOfLogs: Boolean;
var x, y: Integer;
begin
if (not FindDtm(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Result := True;
end else begin
Result := False;
end;
end;

procedure Cutting;
var x, y: Integer;
begin
InvMouse(1,1);
Wait(300+Random(100));
if (FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Mouse(x, y, 3, 3, False);
Wait(300+Random(100));
ChooseOption('se Kni');
Wait(300+Random(100));
MouseBox(264, 408, 274, 419, 2);
Wait(800+Random(800));
ChooseOption('X');
Wait(300+Random(300));
TypeSend(IntToStr(RandomRange(27, 99)));
Wait(700+Random(700));
end;
repeat
Wait(300+Random(300));
FindNormalRandoms;
until(OutOfLogs);
end;

begin
SetupSRL;
LoadDTMs;

//OpenBank functions and withdraw stuff here

repeat

Cutting;

//Deposit old and take new stuff here

until(False);

FreeDTMs;
end.

ffcfoo
07-03-2010, 12:32 AM
Something like this:
program new;
{$I SRL/SRL.scar}

var LogDTM: Integer;

procedure LoadDTMs;
begin
LogDTM := DTMFromString('78DA63CC636660C8626440068E56220CFC4 01' +
'A26CA580B545382AA86818109220753930C549349404D3A50 4D0D' +
'0135E54035A9F8D5000038480519');
end;

procedure FreeDTMs;
begin
FreeDTM(LogDTM);
end;

function OutOfLogs: Boolean;
var x, y: Integer;
begin
if (not FindDtm(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Result := True;
end else begin
Result := False;
end;
end;

procedure Cutting;
var x, y: Integer;
begin
InvMouse(1,1);
Wait(300+Random(100));
if (FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Mouse(x, y, 3, 3, False);
Wait(300+Random(100));
ChooseOption('se Kni');
Wait(300+Random(100));
MouseBox(264, 408, 274, 419, 2);
Wait(800+Random(800));
ChooseOption('X');
Wait(300+Random(300));
TypeSend(IntToStr(RandomRange(27, 99)));
Wait(700+Random(700));
end;
repeat
Wait(300+Random(300));
FindNormalRandoms;
until(OutOfLogs);
end;

begin
SetupSRL;
LoadDTMs;

//OpenBank functions and withdraw stuff here

repeat

Cutting;

//Deposit old and take new stuff here

until(False);

FreeDTMs;
end.

I think I did something wrong :\ Here can you tell me what I did wrong and how I can fix it :redface:

program foozyfletcher;
{$Define SMART}
{$i SRL/SRL.scar}

var LogDTM: Integer;

const
SMART_WORLD = 152; // World to load
SMART_MEMBERS_WORLD = True; // True = Members world

procedure DeclarePlayers;
begin
NumberOfPlayers(1);

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
end;

procedure LoadDTMs;
begin
LogDTM := DTMFromString('78DA63CC636660C8626440068E56220CFC4 01' +
'A26CA580B545382AA86818109220753930C549349404D3A50 4D0D' +
'0135E54035A9F8D5000038480519');
end;

procedure FreeDTMs;
begin
FreeDTM(LogDTM);
end;


function OutOfLogs: Boolean;
var x, y: Integer;
begin
if (not FindDtm(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Result := True;
end else begin
Result := False;
end;
end;

procedure Cutting;
var x, y: Integer;
begin
InvMouse(1,1);
Wait(300+Random(100));
if (FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Mouse(x, y, 3, 3, False);
Wait(300+Random(100));
ChooseOption('se Kni');
Wait(300+Random(100));
MouseBox(264, 408, 274, 419, 2);
Wait(800+Random(800));
ChooseOption('X');
Wait(300+Random(300));
TypeSend(IntToStr(RandomRange(27, 99)));
Wait(700+Random(700));
end;
repeat
Wait(300+Random(300));
FindNormalRandoms;
until(OutOfLogs);
end;

procedure Banking;
begin
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300+Random(300));
CloseBank; // Closes Bank
end;

procedure PutInBank;
begin;
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(816, 468, 822, 462, 1); // Clicks "Deposit All" Button
Wait(300+Random(300));
CloseBank; // Closes Bank
Wait(300+Random(300));
end;

begin
Smart_Server := SMART_WORLD;
Smart_Members := SMART_MEMBERS_WORLD;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LogInPlayer;
LoadDTMs;
Banking;
repeat
Cutting;
PutInBank;
until(False);
FreeDTMs;
end.

i luffs yeww
07-03-2010, 12:40 AM
NICE PASS, BROTATO CHIP. a

:)


procedure Banking;
begin
OpenBankFast('veb'); // Opens Bank
Wait(300 + Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300 + Random(300));//You never ChooseOption('All');
CloseBank; // Closes Bank
end;


Also, MouseBox(816, 468, 822, 462, 1);, you forgot about the knife.. You have to right click one of the unstrung bows and ChooseOption('All');.

ffcfoo
07-03-2010, 12:44 AM
NICE PASS, BROTATO CHIP. a

:)


procedure Banking;
begin
OpenBankFast('veb'); // Opens Bank
Wait(300 + Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300 + Random(300));//You never ChooseOption('All');
CloseBank; // Closes Bank
end;


Also, MouseBox(816, 468, 822, 462, 1);, you forgot about the knife.. You have to right click one of the unstrung bows and ChooseOption('All');.

Just fixed the script xD Also :O My pass -_- Now I gotta change it for the 3rd time :|

EDIT: Sometimes when:"TypeSend(IntToStr(RandomRange(27, 99)));" Types in a random number it goes to fast it sometimes going to pick 27 or something like that and it will be 2 because it goes to fast. How do I fix this?

Frement
07-03-2010, 01:07 AM
That shouldn't happen, hmmph, I can't think of any reason why that would be happening.

ffcfoo
07-03-2010, 01:09 AM
That shouldn't happen, hmmph, I can't think of any reason why that would be happening.

Me neither. It only happened once so let me run it again. Oh and when smart initializes the mouse comes up when it is loading and trys to login while loading. How do I fix that instead of having to run and stop the script.

Frement
07-03-2010, 01:19 AM
You sure you have the latest SRL?

ffcfoo
07-03-2010, 02:06 AM
You sure you have the latest SRL?

Simba auto updates SRL so yeh I have the current version. Plus I think it is working now...

i luffs yeww
07-03-2010, 02:23 AM
Dude. :p This is exactly what I was talking about.


while not(GetColor(x, y) = 1245622) do
Wait(Random(100));
TypeSend(ToStr(27 + Random(72)));


Where x and y are a coordinate of a black pixel of the text when it asks you how many you want to cut (or deposit, etc.; it's all the same idea), and 1245622 is the actual color of that point.

ffcfoo
07-03-2010, 05:06 PM
Dude. :p This is exactly what I was talking about.


while not(GetColor(x, y) = 1245622) do
Wait(Random(100));
TypeSend(ToStr(27 + Random(72)));


Where x and y are a coordinate of a black pixel of the text when it asks you how many you want to cut (or deposit, etc.; it's all the same idea), and 1245622 is the actual color of that point.

This script is pretty hard for me xD Also when it puts my knife in as well as my bows. I only want it to put in bows? But for some reason it puts everything in my inventory in the bank? Here is the full script:

program foozyfletcher;
{$Define SMART}
{$i SRL/SRL.scar}

var LogDTM, LongBowDTM: Integer;

const
SMART_WORLD = 152; // World to load
SMART_MEMBERS_WORLD = True; // True = Members world

procedure DeclarePlayers;
begin
NumberOfPlayers(1);

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
end;

procedure LoadDTMs;
begin
LogDTM := DTMFromString('78DA63CC636660C8626440068E56220CFC4 01' +
'A26CA580B545382AA86818109220753930C549349404D3A50 4D0D' +
'0135E54035A9F8D5000038480519');

LongBowDTM := DTMFromString('78DA6394606160C861644006B326E833F00 36' +
'990E87F20605406AAA94655C3C0C0042661A28C5C40358904 D488' +
'01D5A4E157030024440790');
end;

procedure FreeDTMs;
begin
FreeDTM(LogDTM);
FreeDTM(LongBowDTM);
end;


function OutOfLogs: Boolean;
var x, y: Integer;
begin
if (not FindDtm(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Result := True;
end else begin
Result := False;
end;
end;

function OutOfLogs2: Boolean;
var x, y: Integer;
begin
if (not FindDtm(LongBowDTM, x, y, MIX1, MIY1, MIX2, MIY2))then begin
Result := True;
end else begin
Result := False;
end;
end;

procedure Banking;
begin
OpenBankFast('veb'); // Opens Bank
Wait(300+Random(300));
MouseBox(55, 103, 47, 115, 2); // Clicks Logs
Wait(300+Random(300));
ChooseOption('All');
Wait(300+Random(300));
CloseBank;
end;

procedure Cutting;
var x, y: Integer;
begin
InvMouse(1,1);
Wait(300+Random(100));
if (FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then begin
Mouse(x, y, 3, 3, False);
Wait(300+Random(100));
ChooseOption('se Kni');
Wait(900+Random(900));
MouseBox(264, 408, 274, 419, 2);
Wait(800+Random(800));
ChooseOption('X');
Wait(300+Random(300));
TypeSend(IntToStr(RandomRange(27, 99)));
Wait(700+Random(700));
end;
repeat
Wait(300+Random(300));
FindNormalRandoms;
until(OutOfLogs);
end;

procedure PutInBank;
var x, y: Integer;
begin
OpenBankFast('veb');
Wait(300+Random(300));
if (FindDTM(LongBowDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
Mouse(x, y, 3, 3, False);
ChooseOption('All');
end;

begin
Smart_Server := SMART_WORLD;
Smart_Members := SMART_MEMBERS_WORLD;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LogInPlayer;
LoadDTMs;
repeat
Banking;
Cutting;
PutInBank;
until(False);
FreeDTMs;
end.

masterBB
07-03-2010, 05:32 PM
Would deposit(2,28) work?
Also there should be a wait for about 50-100 ms before the chooseOption('all') function

ffcfoo
07-03-2010, 05:41 PM
Would deposit(2,28) work?
Also there should be a wait for about 50-100 ms before the chooseOption('all') function

Nahh I fixed it.

i luffs yeww
07-03-2010, 07:26 PM
I posted why by the way.

"Also, MouseBox(816, 468, 822, 462, 1);, you forgot about the knife.. You have to right click one of the unstrung bows and ChooseOption('All');."