SRL Archive - OSR Help

Withdraw-X Problem


VastlySuperior

2012-08-09 08:30:21

Hi

I`m trying to withdraw a dtm item, It finds the item end open the options screen and choose the X amount, but after that nothing gets send. Any advice with this

Thanks

    If FindDTM(DTM_Flour, x, y, MSX1, MSY1, MSX2, MSY2) then
Begin
WriteLn('We Have Found The Flour');
Mouse(x, y, 3, 3, mouse_right);
WaitOption('X', 1000);
TypeSendEx(IntToStr(14),True);
Wait(randomrange(700, 200));
FreeDTM(DTM_Flour);
End else
Begin
WriteLn('We couldnt find the Flour! Check your DTM, or make sure the flour is visible');
FreeDTM(DTM_Flour);
// GlobalFailsafe('We couldnt find the Flour! Check your DTM, or make sure the flour is visible');
End;
End else
Begin
WriteLn('The inventory isnt full yet.');
FreeDTM(DTM_Flour);
Exit;
End;

riwu

2012-08-09 08:35:51

The text box for you to key in won't appear immediately after u choose the option, so your TypeSend missed it. Use CountColor or something to detect the presence of the text box before calling TypeSend.

NCDS

2012-08-09 08:36:19


If FindDTM(DTM_Flour, x, y, MSX1, MSY1, MSX2, MSY2) then
Begin
WriteLn('We Have Found The Flour');
Mouse(x, y, 3, 3, mouse_right);
WaitOption('X', 1000);
Wait(randomrange(200, 700)); //You want to wait before typing the value, not after.
TypeSendEx('14',True); //intToStr(is not necesarry if you can just input a string to begin with ;)
FreeDTM(DTM_Flour);
End else

See how that works I guess.

Footy

2012-08-09 08:40:20

I think theres an SRL function that withdraws a specified amount, much less code then all that.

riwu

2012-08-09 08:43:56

From: Footy
I think theres an SRL function that withdraws a specified amount, much less code then all that.

He is using DTMs rather than bank coordinates to withdraw. It can be done though using BankPointToBankIndex.
Edit: there is already a function that does this for you: WithdrawItem.

VastlySuperior

2012-08-09 08:49:24

From: NCDS

If FindDTM(DTM_Flour, x, y, MSX1, MSY1, MSX2, MSY2) then
Begin
WriteLn('We Have Found The Flour');
Mouse(x, y, 3, 3, mouse_right);
WaitOption('X', 1000);
Wait(randomrange(200, 700)); //You want to wait before typing the value, not after.
TypeSendEx('14',True); //intToStr(is not necesarry if you can just input a string to begin with ;)
FreeDTM(DTM_Flour);
End else

See how that works I guess.


Thanks,it works beautifully. If I had only used my brain hey.

Thanks riwu, I will look into your suggestion as well.

Footy

2012-08-09 09:14:32

use this
Withdraw(column - 1, row - 1, 14);
then make constants for column and row of your item. DTM also works, this is just another sugestion.

Caotom

2012-08-09 09:48:43

From: Footy
use this
Withdraw(column - 1, row - 1, 14);
then make constants for column and row of your item. DTM also works, this is just another sugestion.


This is a faster, easier and more reliable method however it is rather basic, relies on the user to set it up correctly and ignores the possibility that the item will run out. You could always check the number of items left before withdrawing I guess, but if it is a script where the function is not primarily to bank (eg. A mine and bank vs a superheater) I sometimes prefer to use dtms or bitmaps.

~Caotom

P1ng

2012-08-09 09:57:19

This is how I withdraw bowstrings in my AIO stringer script. Very basic and requires the user to set up the bank correctly, but it will check if there's not enough of the item and it will withdraw the correct number every time.

procedure WithdBS;
var
amt: Integer;
begin
Status('WithdBS');
if not LoggedIn then
NextPlayer(False);
if WaitFunc(@BankScreen,10 + random(25),2000 + random(500)) then
begin
amt := GetBankItemAmount(0,0);
if (amt >= 15) then
Withdraw(0,0,14) else
begin
WriteLn('Not enough BS left @WithdBS');
NextPlayer(False);
end;
end else
WriteLn('Not in Bankscreen @WithdBS');
end;

VastlySuperior

2012-08-09 13:22:56

Thanks for all the feedback guys, you really helped me a lot.