Results 1 to 8 of 8

Thread: Making Multiple Cases

  1. #1
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default Making Multiple Cases

    Well, I'm making an Al Kharid bar smelter, but I need the script to know the right ammount of each ore to type in, but how would I code it into the script. Would you simple have
    SCAR Code:
    'copper' : Ammount1 = '14', Ammount2 = '14';

    Or would it be one on each line.
    SCAR Code:
    'copper' : Ammount1 = '14';
                Ammount2 = '14';

    Or something else?

    I got lucky on my members app so I don't really know that much about this sort of cases.

    All help grately appreciated

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    cases are pretty much a series of 'if i = n then' in the form of
    SCAR Code:
    case i of
        n: {if i=n then} runN;
        n2: {if i=n2 then} runN2;
        etc.
      end;
    What you can do to use cases in bar smelting is use something like:
    SCAR Code:
    case toSmelt of
        copper: begin
          ore1:= 14;
          ore2:= 14;
        end;
        iron: ore1:= 28;
        etc.
      end;
    If you need to add more than one line, you have to add a begin and end (as you would do in an if()then with more than 1 line of code to do).
    If this isn't clear enough, then there's a couple of good case based tutoirals and most of the beginner tutorials cover cases as well.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    const
      bartomake = 'copper';
    blablabla
    case lowercase(bartomake) of
     'copper' : begin
                      Ammount1 = something;
                      Ammount2 = other;
     'tin' : begin
       blabla


  4. #4
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Kk, thanks guys, btw cazax you missed out the ends

    Anyone noticed my slight name change?

    EDIT: I think that having 2 lots of that sticking out tounge thing and one in my sig is a bit funny looking lol

    Ahh well its fun!

  5. #5
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    No Underscore anymore.
    Jus' Lurkin'

  6. #6
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Dude Richard View Post
    Kk, thanks guys, btw cazax you missed out the ends

    Anyone noticed my slight name change?

    EDIT: I think that having 2 lots of that sticking out tounge thing and one in my sig is a bit funny looking lol

    Ahh well its fun!
    Yes, i missed the ends becouse i made it fast


  7. #7
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Don't worry I'm not stupid enough to miss that error out and then start coming here saying 0mfg m7 5r1pt a1n7 w0rk1n!

    EDIT: Thanks Torrent for noticing!

  8. #8
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    would look prettier and probably take up less lines if you used a record
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Cases - how do I use them?
    By R0b0t1 in forum OSR Help
    Replies: 6
    Last Post: 08-30-2007, 02:37 PM
  2. a question on multiple cases
    By kraft1 in forum OSR Help
    Replies: 6
    Last Post: 08-29-2007, 09:04 PM
  3. Cases
    By inSaner in forum OSR Help
    Replies: 7
    Last Post: 05-06-2007, 04:50 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
  •