Results 1 to 8 of 8

Thread: if and else

  1. #1
    Join Date
    Dec 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default if and else

    Hey people , i haven't been on villavu for a while, and am finally back- but i came upon a problem when using 'else'. My goal is to say 'if find this dtm, click, else, if find this other dtm, click'.. but I don't quite know how to use 'else' :'(

    as in:
    Simba Code:
    if FindDTM(wai1, x, y, MMX1, MMY1, MMX2, MMY2) then
    Mouse (x, y, 0, 0, true);
    else if FindDTM(wai2, x, y, MMX1, MMY1, MMX2, MMY2 then
    Mouse (x, y, 0, 0, true);

    thanks in advance

  2. #2
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    use this as a template

    Code:
    program new;
    const
      a=1;
    
    begin
      if (a=1) then
      begin
        writeln('1');
      end else if (a=2) then
      begin
        writeln('2');
      end else
      begin
        writeln('3');
      end;
    end.

  3. #3
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Nah, he's just missing a parentheses.

  4. #4
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    What parenthesis ?

    Simba Code:
    if FindDTM(wai1, x, y, MMX1, MMY1, MMX2, MMY2) then
    Mouse (x, y, 0, 0, true)
    else if FindDTM(wai2, x, y, MMX1, MMY1, MMX2, MMY2 then
    Mouse (x, y, 0, 0, true);
    Working on: Tithe Farmer

  5. #5
    Join Date
    Nov 2011
    Location
    MA
    Posts
    545
    Mentioned
    3 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    What parenthesis ?

    Simba Code:
    else if FindDTM(wai2, x, y, MMX1, MMY1, MMX2, MMY2 then
    To end the second FindDTM

  6. #6
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    The parentheses after MMY2

    ^^He said it first

    But yeah just add the parentheses and it should work.

  7. #7
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Then this one needed two fixes

    Simba Code:
    if FindDTM(wai1, x, y, MMX1, MMY1, MMX2, MMY2) then
    Mouse (x, y, 0, 0, true)  //removed ;
    else if FindDTM(wai2, x, y, MMX1, MMY1, MMX2, MMY2) then  //added )
    Mouse (x, y, 0, 0, true);
    Working on: Tithe Farmer

  8. #8
    Join Date
    Dec 2011
    Posts
    57
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks just needed to get rid of the ';' after mouse xD

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
  •