SRL Archive - OSR Help

Shop Buyer Pin Support Help Needed


VastlySuperior

2012-07-03 15:11:44

Hi

I`m trying to add Pin Support for a script that buys items from a shop. But all attempts by me to do so has failed thus far.

Here is the code I`m currently using:

In Constants I declare it like this:
BankPin           = ''; // Leave blank if the player doesn't have a bank pin 


In the Loop for the buying of the items I Call it like this:

    Mouse(44, 90, 10, 10, mouse_Right);
Wait(RandomRange(600 * SPEED, 800 * SPEED));
ChooseOption('All');
If PinScreen then
Writeln('Attempted to Input Bank Pin');
InPin(BankPin);
Wait(500 + Random(200));
Exit;


No Matter how I try, it just continues with the script without Inputting the Bank Pin

Can someone give me some advice on this.

Thanks

Recursive

2012-07-03 15:21:19

Try adding it like this:

BankPin         := '';

Then in your code, do this:

 If PinScreen then
begin
Writeln('Attempted to Input Bank Pin');
InPin(BankPin);
Wait(500 + Random(200));
end;

Hopefully that works

King

2012-07-03 18:00:15

Do you have the pin declared as an integer? Also you can also ad it in your players like this.


  Players[0].Name := 'Username';            // Username
Players[0].Pass := 'Password'; // Password
Players[0].Pin := '1234';

Then call it like this

 if PinScreen then
InPin(Players[CurrentPlayer].Pin);

I would also use it like this for the pin

Procedure Bank;
Begin
if AtBank then
Begin
If Not ( BankScreen or PinScreen) Then
begin
OpenBankNPC;
repeat
wait(50)
until(BankScreen or PinScreen)
end;
Begin
If PinScreen Then
InPin(Players[0].Pin);
If BankScreen Then
Begin
DepositAll;
wait(50 + Random(250));
Withdraw( 0, 0, Food);
Wait(50 + Random(250));
If FindBlackChatMessage('ou use your amulets last charge.') then
Deposit( 1, 1, True);
Deposit( 2, 28, True);
Wait(50 + Random(250));
Proggy;
CloseBank;
wait(400+random(50));
End;
End;
End;
end;

Use conditions and such. I think the problem is that it might be checking before the pin screen appears, using it like I have in the bank function will have it check more often than just once.

Hope it helped (:

P1ng

2012-07-03 21:08:18

Do you have the pin declared as an integer? Also you can also ad it in your players like this


It's a constant so he doesn't have to declare whether it's a string, boolean or integer. However for the use of InPin it would need to be a string.

But yes, the one you posted in the beginning simply requires the begin and end to be added in like chig suggested and that should work fine.

I like to loop my banking and shop opening procedures so in case it fails it will try again a couple of times. Here's an example of mine from my air runecrafter..

procedure POpenBank;
var
Counter: integer;
begin
while IsMoving do //If the player needs to move to the banker the script will wait
Wait(RandomRange(500,800)); //until it has done so.
repeat //Will repeat the section below up to 5 times
Inc(Counter); //this is what increases so the script knows when to stop trying
FFlag(0); //Another check for if we are walking to the banker
if (not(LoggedIn)) or FindNormalRandoms or BankScreen then
Break; //If we arent logged in/in a random/already in the bank we dont need to openbank
if PinScreen then
InPin(Players[CurrentPlayer].Pin); //if pinscreen then enter pin
OpenBank('vwb',true,true); //time to try and open the bank
until(Counter > 5); //this tells us when to stop trying and give up
end;

VastlySuperior

2012-07-04 03:29:22

Can I put a loop like this?

If PinScreen then
Repeat
Writeln('Attempted to Input Bank Pin');
InPin(BankPin);
Wait(500 + Random(200));
Until (not (PinScreen))

Will this also do a loop until the PinScreen do not appear?

Edit: PinScreen Still Not Working after Changes.

Ok, I have made some changes, First, I have Removed the BankPin From the Constants and have declared it under DeclarePlayers as I think it should have been in the first place.

Here is the code as it looks now:

procedure DeclarePlayers;
begin
HowManyPlayers := NumbOfPlayers;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;

with Players[0] do
begin
Name := 'UserName'; // Username
Pass := 'Password'; // Password
Pin := ''; // Leave Blank If No Bank Pin Number
Active := True; // Set to true if you want to use Player 0
Integers[2] := 0;
end;
end;

Should I declare it in any other way under DeclarePlayers,
Should I convert it to a string maybe as mentioned or is that unnecessary?


The Shop Function I have changed like this.

      Mouse(44, 90, 10, 10, mouse_Right);
Wait(RandomRange(600 * SPEED, 800 * SPEED));
ChooseOption('500');
If PinScreen then
Begin
Writeln('Attempted to Input Bank Pin');
InPin(Players[0].Pin);
Wait(500 + Random(200));
End;


I`ll wait for some more response otherwise I will just isolate these two functions in a script in its simplest form and try to make it happen. Also create a bank procedure where it use PinScreen and compare the two. Does a PinScreen work different in a shop from a bank?

If it works in a bank then it is supposed to work in a shop in the same way?

Thanks for the response guys. Appreciate it.

P1ng

2012-07-04 03:58:39

theoretically that would work but you'd need to add a begin and end to that so -
if PinScreen then
begin
repeat
Writeln('Attempted to Input Bank Pin');
InPin(BankPin);
Wait(500 + Random(200));
until (not PinScreen);
end;

VastlySuperior

2012-07-04 05:39:01

Hey Guys

I figured it out. Thanks for all your help. I Had the PinScreen at the wrong place.:duh: It was not in the right place for the sequence of events that had to take place so it never saw the PinScreen to complete it.

Rookie mistake. But thank you for all your advice. I ended up implementing some of it and now the script runs smoother.