SRL Archive - OSR Help

How Do I Use Else?


Hexless

2013-03-22 16:53:47

Okay so in a few of my scripts i've been needing to use else but i dont know how if anyone could tell me that would be great
here's abit of code that i need it for!
[PHP]Procedure mRock;
Begin
If FindColorSpiralTolerance(X,Y,Copper,MSX1,MSY1,MSX2,MSY2,15) Then
Mouse(X,Y,5,5,false);
P07_ChooseOptionMulti(['ine']);
Begin
If FindColorSpiralTolerance(X,Y,Tin,MSX1,MSY1,MSX2,MSY2,15) Then
Mouse(X,Y,5,5,false);
P07_ChooseOptionMulti(['ine']);
End;
End; [/PHP]
The Else will make it use the tin if tin is typed into the Const and make it use copper if copper is typed into the const

The Killer

2013-03-22 17:03:00

1) Use the Simba tags to post code :P
2) Else is used like this
if Condition then
DOStuff;
else
DoOtherStuff;

or

if Condition then
begin
DOStuff;
Result := True;
end else
begin //begin is ALWAYS on its own line :P
DoOtherStuff;
Result := False;
end;

Hexless

2013-03-22 19:58:30

From: The Killer
1) Use the Simba tags to post code :P
2) Else is used like this
if Condition then
DOStuff;
else
DoOtherStuff;

or

if Condition then
begin
DOStuff;
Result := True;
end else
begin //begin is ALWAYS on its own line :P
DoOtherStuff;
Result := False;
end;

Thanks so much ;D
Must of misclicked when i clicked the PHP brackets :P