SRL Archive - OSR Help

Withdrawing issue


Nebula

2011-12-25 23:57:52

Hello I'm working on a script that requires the withdrawal of items. Everything works fine, however once the bank opens up it does not withdraw the items as I would like it to. could someone please read-over my script and help me? Thanks :)

program NebulaPastries;
{$I SRL/SRL.scar}
var
a, b, count:integer;

procedure Banking;
begin
wait(50+random(100));
SetAngle(true);
writeln('banking');
repeat
inc(count);
a :=MSCX
b :=MSCY
FindColorSpiralTolerance(a, b, 6898000, MSX1, MSY1, MSX2, MSY2, 12);
Mouse(a, b, 2, 2, false);
until
(ChooseOption('nk Ba')) or (count>8);
if (count>8) then
begin
writeln('couldnt find the banker, ending');
TerminateScript;
end else
if PinScreen then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin)
else
begin
writeln('No pin entered');
TerminateScript;
end;
wait(750+random(500));
withdraw(10, 4, 14);
wait(400+random(300));
withdraw(10, 5, 14);
end;


begin
SetupSRL;
ActivateClient;
Banking;
end.

kevin33

2011-12-26 00:00:47

From: Nebula
Hello I'm working on a script that requires the withdrawal of items. Everything works fine, however once the bank opens up it does not withdraw the items as I would like it to. could someone please read-over my script and help me? Thanks :)

program NebulaPastries;
{$I SRL/SRL.scar}
var
a, b, count:integer;

procedure Banking;
begin
wait(50+random(100));
SetAngle(true);
writeln('banking');
repeat
inc(count);
a :=MSCX
b :=MSCY
FindColorSpiralTolerance(a, b, 6898000, MSX1, MSY1, MSX2, MSY2, 12);
Mouse(a, b, 2, 2, false);
until
(ChooseOption('nk Ba')) or (count>8);
if (count>8) then
begin
writeln('couldnt find the banker, ending');
TerminateScript;
end else
if PinScreen then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin)
else
begin
writeln('No pin entered');
TerminateScript;
end;
wait(750+random(500));
withdraw(10, 4, 14);
wait(400+random(300));
withdraw(10, 5, 14);
end;


begin
SetupSRL;
ActivateClient;
Banking;
end.


What does it say in debug about it like why does it not withdraw?

Nebula

2011-12-26 00:06:18

It just right clicks randomly around the bank screen. I could code it to say anything in the debug box, the debug box isn't much help me in this case.

kevin33

2011-12-26 00:08:42

From: Nebula
It just right clicks randomly around the bank screen. I could code it to say anything in the debug box, the debug box isn't much help me in this case.


Ok I was just clarifying. Only thing I could think of atm is that the client cant find the banker colour to click. If its all over the colour is similar all over. My first guess probably not right though.

Claymore

2011-12-26 00:13:15


repeat
inc(count);
a :=MSCX
b :=MSCY
FindColorSpiralTolerance(a, b, 6898000, MSX1, MSY1, MSX2, MSY2, 12);
Mouse(a, b, 2, 2, false);
until
(ChooseOption('nk Ba')) or (count>8);

The problem here lies within the code. Simply put, the client doesnt react fast enough for the script to detect the bank option. So you need to put a wait procedure in between.

Also, ChooseOption does not support SPACES BETWEEN OPTIONS. Ergo, you just type one word or partial to it. So type


ChooseOption('Use');

//OR if you want to pick more than one word

ChooseOptionMulti(['Use', 'Bank']);

your loop function needs work. Ill introduce you to the Break; procedure


repeat
if FindColor... then
begin
Mouse...
Wait(500); //This gives the client some time to load so the script can follow.
if ChooseOptionMulti(['Bank', 'Banker']) then
Break; //This states that the script will break from the repeat!
end;
until (False); //False means it will go on FOREVER;

Make sure your color is correct, and thats my story for you. Reply if any questions.

Nebula

2011-12-26 00:13:35

From: kevin33
Ok I was just clarifying. Only thing I could think of atm is that the client cant find the banker colour to click. If its all over the colour is similar all over. My first guess probably not right though.


I already said It finds the banker and opens the bank perfectly, but has trouble withdrawing the items. Since I don't think you even slightly know how to script, I'm going to ask you not to post on this thread again. Thanks.

kevin33

2011-12-26 00:18:44

From: Nebula
I already said It finds the banker and opens the bank perfectly, but has trouble withdrawing the items. Since I don't think you even slightly know how to script, I'm going to ask you not to post on this thread again. Thanks.


Im tired and Ive been up all day renewing a script I had saved on my computer that just got fixed today for Christmas. Sorry if I cant be much help. I dont appreciate being called out for just trying to help. Im quite new also and Ive never heard of this problem yet so I cant really help but I figured I might as well try.

Nebula

2011-12-26 00:19:18

@deathscyte

My ChooseOption procedure works fine. Everything works find besides the withdrawing of the items. Also I know about the break procedure but I decided to script it my way :) lol.

Just move your character to a booth in the varrock west bank, start the script, and you'll see my issue.

Claymore

2011-12-26 00:24:46

FixBank;

add this before withdrawing i guess.

Nebula

2011-12-26 00:36:00

Didn't work.

DemiseScythe

2011-12-26 01:44:54

If you are just withdrawing an item, why not try using a DTM.

They are in my opinion extremely good at finding items in your inventory.

then you can do:

if FindDTM(DTMnamehere, x, y, MSX1, MSY1, MSX2, MSY2) then
Mouse(x, y, 4, 4, True);

it finds the item in the bank and withdraws it by left clicking on it. You just need to make a decent DTM for the item, load it and free it afterwards.

Nebula

2011-12-26 02:08:49

Because the Withdraw procedure is so much more effective. It's like 25 less lines of code.

Withdraw(ItemColumn, ItemRow, AmountOfItem). In my case the item will be in the 10th column, 4th row, and I want to withdraw 14 of the item.

legoace

2011-12-26 02:18:11

Instead of
until (ChooseOption('Bank')) do
use
until (WaitOption('Bank', 500)) do

Claymore

2011-12-26 03:10:11

Did you count from 0?

the first column is called 0 and the next is 1 and so forth, same rules apply for rows.

So it would be


Withdraw(9, 3, 14);
Wait(600);
....

Nebula

2011-12-26 03:52:15

From: Deathscytex
Did you count from 0?

the first column is called 0 and the next is 1 and so forth, same rules apply for rows.

So it would be


Withdraw(9, 3, 14);
Wait(600);
....


Thank you SO MUCH!! rep++++

Kyle Undefined

2011-12-26 11:21:48

Nebula, I'm glad your issue is fixed. However, in the future, please don't talk down on other members who are only trying to help.

Thanks :)