Results 1 to 14 of 14

Thread: A nicer way to do a "case"

  1. #1
    Join Date
    Aug 2007
    Location
    Finland
    Posts
    268
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default A nicer way to do a "case"

    How can I make this look nicer? I read about this somewhere but now I cant find it.

    SCAR Code:
    procedure AntiBan;//Normal Anti-Ban
    begin
      case (random(50)) of
        0: HoverSkill(Random, False);
        1: AntiBanTalks;
        2: BoredHuman;
        3: PickUpTheMouse;
        4: AlmostLogOut;
        5: Exit;
        6: Exit;
        7: Exit;
        8: Exit;
        9: Exit;
        10: Exit;
        11: Exit;
        12: Exit;
        13: Exit;
        14: Exit;
        15: Exit;
        16: Exit;
        17: Exit;
        18: Exit;
        19: Exit;
        20: Exit;
        21: Exit;
        22: Exit;
        23: Exit;
        24: Exit;
        25: Exit;
        26: Exit;
        27: Exit;
        28: Exit;
        29: Exit;
        30: Exit;
        31: Exit;
        32: Exit;
        33: Exit;
        34: Exit;
        35: Exit;
        36: Exit;
        37: Exit;
        38: Exit;
        39: Exit;
        40: Exit;
        41: Exit;
        42: Exit;
        43: Exit;
        44: Exit;
        45: Exit;
        46: Exit;
        47: Exit;
        48: Exit;
        49: RandomRClick;
    end;

  2. #2
    Join Date
    Jul 2007
    Location
    America
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by cheetahnub View Post
    How can I make this look nicer? I read about this somewhere but now I cant find it.

    SCAR Code:
    procedure AntiBan;//Normal Anti-Ban
    begin
      case (random(50)) of
        0: HoverSkill(Random, False);
        1: AntiBanTalks;
        2: BoredHuman;
        3: PickUpTheMouse;
        4: AlmostLogOut;
        5: RandomRClick;
    end;
    If it's between 6 - 50 then it will automatically do nothing, or break. No need for the exits.
    I dunno, those asians are pretty difficult to out-auto, legend has it they don't need sleep or food...~tim0suprem0
    Activity is on the decline - school's got me
    Check out my tutorial[s] on Color Finding!||Procedures and Functions!

  3. #3
    Join Date
    Aug 2007
    Location
    Finland
    Posts
    268
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oh, then the problem can't be that, because i'm still getting this:

    Line 251: [Error] (15668:21): Invalid number of parameters in script C:\Documents and Settings\Administrator\Desktop\gamaa\gama\-[The Ultimate Army Mover]- By Cheetahnub.scar

  4. #4
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Add my MSN- I am good at fixing errors like this


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  5. #5
    Join Date
    Jul 2007
    Location
    America
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Do you have an 'end;' at the end of your case? It works for me. Run this and tell me what you get.
    SCAR Code:
    program new;

    begin
      case random(5) of
      1: writeln('hello there');
      2: writeln('hi');
      3: writeln('hi again');
      end;
    end.
    I dunno, those asians are pretty difficult to out-auto, legend has it they don't need sleep or food...~tim0suprem0
    Activity is on the decline - school's got me
    Check out my tutorial[s] on Color Finding!||Procedures and Functions!

  6. #6
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    just for future referance you dont have to list every number like that you can do it like this.
    SCAR Code:
    case random(10) of
      1,2,3,4,5,6:blah
      7,8,9: blah
    end;

  7. #7
    Join Date
    Feb 2006
    Location
    Helsinki, Finland
    Posts
    1,395
    Mentioned
    30 Post(s)
    Quoted
    107 Post(s)

    Default

    Like this:

    Code:
    procedure AntiBan;
    begin
      case Random(50) of
        0: HoverSkill(Random, False);
        1: AntiBanTalks;
        2: BoredHuman;
        3: PickUpTheMouse;
        4: AlmostLogOut;
        49: RandomRClick;
      else
        Exit;
      end
    end;
    ?

  8. #8
    Join Date
    Sep 2007
    Location
    Australia
    Posts
    143
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    1 exit??
    [IMG]file:///C:/Documents%20and%20Settings/damn/My%20Documents/My%20Pictures/Vluv.html[/IMG]

  9. #9
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yes 1 exit, there is no reason to put 40 exit; in there because 1 exit will ehh... exit? the whole script.

    [22:20] <[-jesus-]> freddy, go uninstall yourself

  10. #10
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    If the random number of the case is not any number the case responds to then the script will automatically run the last of the procedure (Which is nothing). Therefore, there is no actual use for "Exit" in that case.

    -Knives

  11. #11
    Join Date
    Apr 2007
    Posts
    102
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by jhildy View Post
    just for future referance you dont have to list every number like that you can do it like this.
    SCAR Code:
    case random(10) of
      1,2,3,4,5,6:blah
      7,8,9: blah
    end;
    Just for completeness I believe that you can probably do something like

    case random(10) of
    1 thru 6:blah
    7 thru 9: blah
    end;

    Having looked up the syntax :-

    Looking at the following web page
    http://courses.cs.vt.edu/~cs3304/Fre...00000000000000

    they show the following example. The syntax seems to be .. (double dot between the higher and lower specifier)

    Case Number of
    1..10 : WriteLn ('Small number');
    11..100 : WriteLn ('Normal, medium number');
    else
    WriteLn ('HUGE number');
    end;

  12. #12
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    I already helped him


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  13. #13
    Join Date
    Sep 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey im very new to this stuff but this looks basically like pascal, am i right or is it just similar?

  14. #14
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need Help With Using "Case" and "Of"
    By Tootoot222 in forum OSR Help
    Replies: 2
    Last Post: 08-12-2007, 06:51 PM
  2. action="www.site.com" method="post"
    By Jason2gs in forum General
    Replies: 4
    Last Post: 05-17-2007, 11:50 PM
  3. Replies: 3
    Last Post: 04-19-2007, 03:44 AM
  4. Noob "case" Q.
    By Junior in forum OSR Help
    Replies: 3
    Last Post: 03-25-2007, 04:56 PM
  5. Replies: 5
    Last Post: 10-26-2006, 11:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •