SRL Archive - Help and Support

Break;


maxzzz

2006-05-23 02:50:20

I wonder if you use break, does it stop the script like TerminateScript.. Or does it ends the procedure which is running and then go to the next one?

By example if I have this:


procedure SmeltWait;
begin
case OreYpe of
"Bronze" :=
begin
repeat
LeaveScreenEvery(1);
wait(500+random(1300));
Randoms;
if(IsChatMessage('You have run out of'))then
Break;
until(FindBitmapTol(TX, TY, BronzeBar, x1, y1, x2, y2))or(IsChatMessage('You have run out of')); // 14 inv slot coords from bar
end;
"Iron" :=
begin
repeat
LeaveScreenEvery(1);
wait(500+random(1300));
Randoms;
if(IsChatMessage('You have run out of'))then
Break;
until(not(FindBitMapTol(TX, TY, IronOre, x1, y1, x2, y2))or(IsChatMessage('You have run out of')); // 28 inv slot coords iron ore
end;
"Steel" :=
begin
repeat
LeaveScreenEvery(1);
wait(500+random(1300));
Randoms;
if(IsChatMessage('You have run out of'))then
Break;
until(FindBitmapTol(TX, TY, SteelBar, x1, y1, x2, y2))or(IsChatMessage('You have run out of')); // 9 inv slot coords steel bar
end;
"Mith" :=
begin
repeat
LeaveScreenEvery(1);
wait(100+random(700));
Randoms;
if(IsChatMessage('You have run out of'))then
Break;
until(FindBitmapTol(TX, TY, MithrilBar, x1, y1, x2, y2))or(IsChatMessage('You have run out of')); // 5 inv slot coords mith bar
end;
"Addy" :=
begin
repeat
LeaveScreenEvery(1);
wait(500+random(1300));
Randoms;
if(IsChatMessage('You have run out of'))then
Break;
until(FindBitmapTol(TX, TY, AdamantBar, x1, y1, x2, y2))or(IsChatMessage('You have run out of')); // 4 inv slot coords addy bar
end;
"Rune" :=
begin
repeat
LeaveScreenEvery(1);
wait(500+random(1300));
Randoms;
if(IsChatMessage('You have run out of'))then
Break;
until(FindBitmapTol(TX, TY, RuneBar, x1, y1, x2, y2))or(IsChatMessage('You have run out of')); // 3 inv slot coords rune bar
end;
end;
Will the break stop the whole script or will it just stop the running procedure to go on with other procedures?

Another question I want to ask, and since I'm not at home (and I can't look into drigers Scar Tut), I want to know if I use the cases correct.
I'm not about this:

"Rune" := // Not sure of this, is := the right way or : ?
begin
repeat
LeaveScreenEvery(1);
wait(500+random(1300));
Randoms;
if(IsChatMessage('You have run out of'))then
Break;
until(FindBitmapTol(TX, TY, RuneBar, x1, y1, x2, y2))or(IsChatMessage('You have run out of')); // 3 inv slot coords rune bar
end;
Also if you have comments on this little piece of code, please post them.
Thanks
~ Maxzzz

Krazy_Meerkat

2006-05-23 03:33:02

Break; will break out of a loop, Exit; will end a procedure I think :/ Don't quote me on that..
You have used it correctly.

WhiteShadow

2006-05-23 03:39:46

You should know it very well Krazy_Meerkat. ;) , you're correct.

XxKanexX

2006-05-23 03:40:27

Break exits the current loop it's in..


repeat
if(i = 100) then break;
i:= i + 1;
until(false);
Then it just goes onto to the next peice of coding. It dosn't terminate the script nor exit a function or procedure. Exit will exit a function or procedure. :)

maxzzz

2006-05-23 03:45:08

Wiew thanks, that's what I need to know for a piece of code for the ring of forging code within the Iron case :D.
I'll post it :).

Did I used the cases correct?:D

WhiteShadow

2006-05-23 03:58:08

:= is for storing value purposes.

So you should change it to :

Which means it's just going to "do the procedure"

XxKanexX

2006-05-23 03:58:31

Close. It's:

'Bronze':
not

"Bronze":=
hehe :)

Example:

var s: string;
begin
s:= 'Hello';
case s of
'Bye': Writeln('Nothing...');
'Hello': begin
Writeln('HI!');
Writeln('Now, Bye.');
end;
end;
end.

WhiteShadow

2006-05-23 04:00:24

I didn't even notice, them ". I thought I saw, ' Lol you have good eye. xD

XxKanexX

2006-05-23 04:01:51

It's the first thing i saw. I didn't notice the, ":=" until i saw you post about it ;) That's when i wrote the example. :p