SRL Archive - OSR Outdated Tutorials

Case/Of Tutorial For Beginners


Ruroken

2006-09-14 17:49:56

This is just a short Tut on how to use the Case/Of commands. First of all here is an example of what a Case/Of command is…..

procedure ProcedureNameHere;
begin
begin
DefineAge := Random (6)
Case DefineAge of
0 : thing2
1 : thing2
2 : thing3
3 : thing4
4 : thing5
5 : thing6
end;
end;


The Case/Of command is useful when you want SCAR to do one(or two or whatever number) of things from a list you have provided. For this Tut we will only be covering doing one random thing. We will be making a anti - ban procedrue.

Step 1 : Open the Anti Ban file in the SRL include (there are many examples of Case/Of commands in this include)

Step 2: Make a list of anti ban procedures you want for your anti ban procedure (ex. LeaveScreenEvery, or HoverSkill)

Step 3: Oncle you have chosen your procedures/functions you can start making your own anti ban function (you should have 10+ well banlenced functions in your script)

Step 4: Open SCAR to begin wrinting your function (include SRL)

Step 5: Writing the proedure

NOTE: In scar the numbers start at 0 so if you have 6 procedures it'll go 0,1,2,3,4,5

procedure //ProcedureNameHere;
var
random : integer;//define variables here (thanks for the heads up LaBo! =P)
begin
case random() of //put number of procedures fom the include you'll be using in between()
0: //Antiban thing one
1://Antiban thing two
2://Antiban thing three ect.
end;

AND YOUR DONE!!! CONGRATZ! YOU CAN USE Case/Of COMMANDS!!!:spot:

heres a example by LaBo!

procedure ProcedureNameHere;
var
DefineAge: integer;
begin
ClearDebug;
DefineAge := Random (6)
Case DefineAge of
0 : writeln('Case number 0(zero).');
1 : writeln('Case number 1(one).');
2 : writeln('Case number 2(two).');
3 : writeln('Case number 3(three).');
4 : writeln('Case number 4(four).');
5 : writeln('Case number 5(five).');
end;
end;


Need any more help just read my Siggy :(h):

If i need to add more just post it or PM me and i'll add to it….I kinda rushed this:duh:

Janilabo

2006-09-15 07:33:15

You didn't end cases in your examples. =) So newbies might get confused. But, I am sure you made this for people who already know more than just basics, right? ;)

Anyways, good job with the tutorial, man. It's really good you made this tutorial! I am sure it will help out some people. Just fix the bugs and it will be great. :bart:

Edit: You didn't declare the variable.. In your first example.

Maybe you should put there some examples that really do something whenever they are used?

This could be the first Example:
procedure ProcedureNameHere;
var
DefineAge: integer;
begin
ClearDebug;
DefineAge := Random (6)
Case DefineAge of
0 : writeln('Case number 0(zero).');
1 : writeln('Case number 1(one).');
2 : writeln('Case number 2(two).');
3 : writeln('Case number 3(three).');
4 : writeln('Case number 4(four).');
5 : writeln('Case number 5(five).');
end;
end;

-Janilabo

Ruroken

2006-09-15 17:36:38

From: LaBo
You didn't end cases in your examples. =) So newbies might get confused. But, I am sure you made this for people who already know more than just basics, right? ;)


yep I did. I would have mde it more simple if i thought SCAR noobs had a use for this kinda thing :rolleyes: but i mught in the future.

Anyways, good job with the tutorial, man. It's really good you made this tutorial! I am sure it will help out some people. Just fix the bugs and it will be great. :bart:

From: LaBo
You didn't declare the variable.. In your first example.


ouch, and thats why you dont write tuts when you are tired! Thanks for the example. I will use!:spot:

YoHoJo

2006-09-15 20:20:09

Its also good for random talking stuff like this:

Case Random(6)+1 of // the +1 makes the random start at 1 instead of 0.
1: TypeSend('asdf')
2 : TypeSend('asdf')
3 : TypeSend('asdf')
4 : TypeSend('asdf')
5 : TypeSend('asdf')
6 : TypeSend('asdf')
end;

idk just another way to use it =):f:

Ruroken

2006-09-16 14:37:07

yah that to yoho

masquerader

2006-09-16 16:50:57

you forgot else

you can put else at the end to trigger if it didnt fall into any other catergories

ex

program aweso;
var
rand: integer;
begin
rand := Random (2)
Case rand of
0 : writeln('zero');
else writeln('not a 0, must be a 1')
end;
end.

Ruroken

2006-09-29 14:13:37

>.< D'OH!!! :duh:

Sumilion

2006-09-29 17:50:04

From: yohojo8
Its also good for random talking stuff like this:

Case Random(6)+1 of // the +1 makes the random start at 1 instead of 0.
1: TypeSend('asdf')
2 : TypeSend('asdf')
3 : TypeSend('asdf')
4 : TypeSend('asdf')
5 : TypeSend('asdf')
6 : TypeSend('asdf')
end;

idk just another way to use it =):f:


Then it could end at 7 ;)

0wn 4 skill

2008-08-08 15:28:10

Thanx. Helpfull Tutorial! =)

yargo

2008-08-13 20:17:28

Helpful Programming Connection

In other programming languages, these 'case' statements are called 'switch statements'. Switch statements are common to most major programming languages including but not limited to:
C
C++
C#
Java


P.S. This is a great tutorial(set). Everybody should know how to do this.

rbk_nightmare77

2008-08-21 21:31:48

thank you it helped me a lot