Results 1 to 12 of 12

Thread: Question on Case/Of

  1. #1
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Question on Case/Of

    It pains me to ask such a nooby question, but...

    When you do case/of statements, is it possible to do

    SCAR Code:
    case Random(5) of
      0: blah;
      1-4:blah;
      5:asdasd;
    end;

    will the 1-4 thing work? If not how would I do that.

    Don't tell me "Just do 1, 2, 3, 4, 5" because in the script i need to do something like 45-100.

  2. #2
    Join Date
    Jul 2007
    Location
    Ottawa, Canada
    Posts
    930
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    case Random(5) of
      0: blah;
      1 to 4:blah;
      5:asdasd;
    end;
    I believe that will work
    ~ Metagen

  3. #3
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well, you better be right. You waste my time, you die.

    lol, TY, ill test it

    Edit: Lock your doors, Im coming for you. (didn't work)

  4. #4
    Join Date
    Jul 2007
    Location
    Ottawa, Canada
    Posts
    930
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    /me cries
    ~ Metagen

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

    Default

    me cries for you. Enjoy the last few moments of your life.

    I wonder if 1..5 will work (like in arrays)

    Edit: I win *does happy dance*

    Edit: how would i do all the numbers greater than 5 (5..infinity)

  6. #6
    Join Date
    Jul 2007
    Location
    Ottawa, Canada
    Posts
    930
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    AHA I HAVE IT

    SCAR Code:
    program New;
    {.Include Srl/Srl.scar}


    Begin
    SetupSRL;

      case random(200) of
           0: Writeln('0');
           1..200: Writeln('1..4');
      end;
    end.

    oh u got it first...
    ~ Metagen

  7. #7
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lols, now i need to know how to do 1..Infinity

    NM, i can just use else

  8. #8
    Join Date
    Jul 2007
    Location
    Ottawa, Canada
    Posts
    930
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now you better lock your door... or u no... just maake a script with me this weekend.
    ~ Metagen

  9. #9
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    U sound like me when I ask a girl to dance...

    may I ask why?

    Maybe after I finish my current project.

  10. #10
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    If you still care about that 1..Infinity thing, since SCAR lacks "MaxInt", you could just do this:
    SCAR Code:
    1..High(0):
    High(0) will just return the maximum value an integer can hold.

  11. #11
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    coundn't i just use else?

  12. #12
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Of course. I was just letting you know how to do it in case you were still curious.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Case help
    By Aser in forum OSR Help
    Replies: 3
    Last Post: 11-22-2008, 05:21 AM
  2. case question
    By Heysus in forum OSR Help
    Replies: 4
    Last Post: 10-03-2008, 01:51 AM
  3. Case..Of Help
    By Drew_Dawg in forum OSR Help
    Replies: 7
    Last Post: 02-02-2008, 11:47 PM
  4. Case OF
    By Jagex_Fagex in forum News and General
    Replies: 3
    Last Post: 10-25-2006, 08:45 AM

Posting Permissions

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