Code:
program New;
{.Include SRL\SRL.scar}
{.Include SRL\SRL\core\Login.scar}
{.Include SRL\SRL\core\Bank.scar}
var
result :integer;
begin
LoggedIn
If(result=true) Then
OpenBank3
Withdraw(3,1,15)
CloseBank;
end.
Well I haven't used SRL at all yet but I'm guessing LoggedIn is a function that checks if you are logged in. So just putting LoggedIn on it's own line will do nothing except check if you are logged in and result true. So instead of:
Code:
LoggedIn
If(result=true)Then
You would want to put
I didn't even have to put if(LoggedIn = true)then because in an if statement it will automatically check if it is true, if you wanted to check if it was false then you would have to put if(LoggedIn=false)then.
Also you have result declared as an integer. An integer is any negative or positive whole number, &or 0. You wanted to see if result was True in your if statement and that would mean it would have to be a declared as a boolean. However in this script you would not have to declare anything.
Code:
If(result=true) Then
OpenBank3
Withdraw(3,1,15)
CloseBank;
Aside from your if statement being wrong, right now, it will do OpenBank3 if the if statement is true. Withdraw and CloseBank it will do regardless of whether the if statement is true or not. You would want to code it like this:
Code:
If(LoggedIn)Then
begin
OpenBank3;
Withdraw(3,1,15);
CloseBank;
end;
By enclosing your bank process in a begin and end it's saying if loggedin, then, and it sees everything in the being to end instead of just the OpenBank.
Also notice how the end has a semi-colon after it, all ends have semi-colons after them except for the main routine statement of your script, the very last begin-end statement of the script which is the one that executes will have an end with a period after it to mark the end of the script.
Finally it should look like this if I've got everything correct:
Code:
program New;
{.Include SRL\SRL.scar}
{.Include SRL\SRL\core\Login.scar}
{.Include SRL\SRL\core\Bank.scar}
begin
If (loggedin) Then
begin
OpenBank3;
Withdraw(3,1,15);
CloseBank;
end;
end.