Results 1 to 12 of 12

Thread: Same Line Coding

  1. #1
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Same Line Coding

    Thank you in advance for any help given or attempted.

    Simba Code:
    begin
      case (I) of
        0 : Color := 0; HMod := 0.0; SMod := 0.0;
        1 :
          begin
            Color := 0;
            HMod := 0.0;
            SMod := 0.0;
          end;
      end;
    end;

    I want to make it to where I only have to use one line for adjusting variables or just doing functions and such, like I did on the first one. But that does not work and only the second one works. Is there a way to make it work that I am just missing or something?

    Thank you again.
    Last edited by RISK; 01-06-2011 at 02:29 AM.

  2. #2
    Join Date
    Dec 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    0: begin Color := 0; HMod := 0.0; SMod := 0.0; end;
    ???

  3. #3
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by RISK View Post
    Thank you in advance for any help given or attempted.

    Simba Code:
    begin
      case (I) of
        0 : Color := 0; HMod := 0.0; SMod := 0.0;
        1 :
          begin
            Color := 0;
            HMod := 0.0;
            SMod := 0.0;
          end;
      end;
    end;

    I want to make it to where I only have to use one line for adjusting variables or just doing functions and such, like I did on the first one. But that does not work and only the second one works. Is there a way to make it work that I am just missing or something?

    Thank you again.
    The first way does not work because the semicolon signifies the end of a statement. If you want more than one thing to be done you have to put them between a begin and an end, like you did in your second method

  4. #4
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    @ Kong : Thank you for helping.

    @ Train : I feel like an idiot for not thinking of doing that. Thank you for helping.

  5. #5
    Join Date
    Dec 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by RISK View Post
    @ Kong : Thank you for helping.

    @ Train : I feel like an idiot for not thinking of doing that. Thank you for helping.
    <3.

  6. #6
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Im bored xD here is something you MAY use...
    Simba Code:
    function SetColor(ColorX, HModX, SModX : integer) : boolean;
    Begin
       If Color := ColorX then
          If HMod := HModX then
             If SMod := SModX then
                Result := True;
    End;

    I just looked back at your original function and realised i dont think this it what you wanted... Haha.
    Oh well anyone use as they please

    -Boom

  7. #7
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    terrible standards, risk!

  8. #8
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    What. Really? I thought my standards were fine. What's wrong with them?!

    Quote Originally Posted by TomTuff View Post
    terrible standards, risk!

  9. #9
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    having all those statements on one line.

  10. #10
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    But it saves coding space than spending about 5+ lines of coding just to set the variables to find where the character is at.

    I feel.. Dirty for using apparent bad standards. I don't know why.

    Quote Originally Posted by TomTuff View Post
    having all those statements on one line.
    E: I'll just do the proper way of doing it, even if it does take up more space than it should.
    Thank you to everyone for helping.
    Last edited by RISK; 01-06-2011 at 09:14 AM.

  11. #11
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by RISK View Post
    But it saves coding space than spending about 5+ lines of coding just to set the variables to find where the character is at.

    I feel.. Dirty for using apparent bad standards. I don't know why.
    I usually don't put multiple lines of code on one line, but it's not really bad standards. It is a little tougher to read through the code though, say in an app .

    I'm perfectly fine with having some words this way, for example:

    Simba Code:
    end else begin
    ***Stuff
    end;

    looks perfectly okay for me.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  12. #12
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Your standards are just fine

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

Thread Information

Users Browsing this Thread

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

Posting Permissions

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