SRL Archive - Help

Multiple Actions in case..of?


Abu

2012-03-19 17:53:52

Hi, I'm trying to update my script and I was wondering if there was any way to do two actions in one case.

For Example

procedure example;
begin
case Random(160) of

1: Action1, Action 2;

2: Action1, Action 3;

3: Action1, Action 4;

4: Action1, Action 5;
end;
end;


For 'Action 1' I simply want to write text on screen(I know how) while performing the action of that case. However, every time I do this it asks me to put the other Action on a separate line. Though I can use the same case for that action, it will always pick the one above it. for example:
begin
case Random(160) of

1: Action 1; // will always do this is case 1 is picked
1: Action 2; // but never this

2: Action 1; // will always do this is case 2 is picked
2: Action 2; // but never this

Try to understand I ONLY want Action 1 performed while doing the other Action , so there's no point putting it at the start of the procedure because if none of the cases are picked, the on-screen text will be useless.


NEVERMIND SOLUTION FOUND. THANKS

Kyle Undefined

2012-03-19 17:58:19

Like this?


procedure example;
begin
case(Random(160))of
1: begin
Action1, Action 2;
end;

2: begin
Action1, Action 3;
end;

3: begin
Action1, Action 4;
end;

4: begin
Action1, Action 5;
end;
end;
end;

Abu

2012-03-19 18:01:52

I'll try that and get back to you

Valithor

2012-03-19 18:11:01

Try to understand I ONLY want Action 1 performed while doing the other Action


Wouldn't another idea be to code something like… ?

procedure example;
begin
case Random(160) of

1: while Action1 do Action 2;

2: while Action1 do Action 3;

3: while Action1 do Action 4;

4: while Action1 do Action 5;
end;
end;

bolshak25

2012-03-19 18:16:13

procedure example;
begin
case Random(160) of

1: begin Action1; Action 2; end;

2: begin Action1; Action 3; end;

3: begin Action1; Action 4; end;

4: begin Action1; Action 5; end;
end;
end;

Abu

2012-03-19 18:22:34

None of those work for me. Here I'll post a program on what I'm trying to do:

program New;
{$DEFINE SMART}
{$i srl\srl.simba}


procedure BreakText;
begin
SMART_DrawText(276,285,UpCharsEx,'Dont Worry, Just Taking A Human-Like Break...',clTeal);
end;


procedure MiniBreak;
begin
case(Random(160))of
1: begin BreakText, Wait(40000 + random(7400)) end

2: begin BreakText, Wait(25500 + random(8550)) end

3: begin BreakText, Wait(60040 + random(6759)) end

4: begin BreakText, Wait(20400 + random(2549)) end
end;
end;
end;


begin
ClearDebug;
SetUpSRL;
MiniBreak;
end.

The procedure 'BreakText' compiles just fine.

Could someone play around with the 'Minibreak procedure' and try to get it to compile?

Yago

2012-03-19 18:24:00

From: abu_jwka
None of those work for me. Here I'll post a program on what I'm trying to do:

program New;
{$DEFINE SMART}
{$i srl\srl.simba}


procedure BreakText;
begin
SMART_DrawText(276,285,UpCharsEx,'Dont Worry, Just Taking A Human-Like Break...',clTeal);
end;


procedure MiniBreak;
begin
case(Random(160))of
1: begin BreakText, Wait(40000 + random(7400)) end

2: begin BreakText, Wait(25500 + random(8550)) end

3: begin BreakText, Wait(60040 + random(6759)) end

4: begin BreakText, Wait(20400 + random(2549)) end
end;
end;
end;


begin
ClearDebug;
SetUpSRL;
MiniBreak;
end.

The procedure 'BreakText' compiles.

Could someone play around with this and try to get it to compile?


You're missing semicolons after breaktext and wait…

and after end;

Abu

2012-03-19 18:26:25

From: Yago
You're missing semicolons after breaktext and wait…

and after end;


My word I love your eyes!

Rep for you and rep for Bolshak!

eska

2012-03-19 18:27:05


procedure example;
begin
case Random(160) of
1:
begin
Action1;
Action 2;
end;

2:
begin
Action1;
Action 3;
end;

3:
begin
Action1;
Action 4;
end;

4:
begin
Action1;
Action 5;
end;
end;
end;

dem standards make it easier to find dem mistake like forgeting or putting too many end;

Abu

2012-03-19 18:29:27

Thanks but I've already figured it out.


Case closed. :norris:

masterBB

2012-03-19 18:30:15

procedure MiniBreak;
begin
case(Random(4))of
1: begin
BreakText;
Wait(40000 + random(7400));
end;

2: begin
BreakText;
Wait(25500 + random(8550));
end;

3: begin
BreakText;
Wait(60040 + random(6759));
end;

4: begin
BreakText;
Wait(20400 + random(2549));
end;
//removed one end;
end;
end;

edit:
ninja'd really hard :) I probably was just slow.

eska

2012-03-19 18:31:42

From: abu_jwka

Case closed. :norris:


It looks like this case is….. Closed.

Had to do it.

Abu

2012-03-19 18:33:51

From: masterBB

ninja'd really hard :) I probably was just slow.


I appreciate the effort :)