PDA

View Full Version : Case/Of Tutorial For Beginners



Ruroken
09-14-2006, 09:49 PM
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
09-15-2006, 11:33 AM
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
09-15-2006, 09:36 PM
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:


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
09-16-2006, 12:20 AM
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
09-16-2006, 06:37 PM
yah that to yoho

masquerader
09-16-2006, 08:50 PM
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
09-29-2006, 06:13 PM
>.< D'OH!!! :duh:

Sumilion
09-29-2006, 09:50 PM
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
08-08-2008, 07:28 PM
Thanx. Helpfull Tutorial! =)

yargo
08-14-2008, 12:17 AM
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
08-22-2008, 01:31 AM
thank you it helped me a lot