Results 1 to 3 of 3

Thread: Need help with "else"

  1. #1
    Join Date
    Mar 2007
    Location
    England
    Posts
    274
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need help with "else"

    please can someone help with the else command.
    here is where im trying to use please can someone tell me where im going wrong.

    SCAR Code:
    procedure EnoughRunes;
    begin
      if FindBlackChatMessage('unes') then
      begin
        writeln('Not enough runes for the selected spell');
        Runes := False
      end;
      if FindBlackChatMessage('igh') then
      begin
        writeln('Your Magic level is not high enough for selected spell');
        Runes := False
      end else; // here i get Line 224: [Error] (17235:1): Semicolon (';') expected in script
      EnoughRunes := True
    end;

    and here

    SCAR Code:
    procedure Attack;
    begin
      if not LoggedIn then Exit;
      Status('ATTACKING!!!');
      repeat
        if not Players[CurrentPlayer].Booleans[0] = True then
        begin
          gametab(7);
          CastOn(Spell, 'esser', DemonColor1, 5);
          Wait(1000 + Random(1500))
          EnoughRunes;
          if Runes = False then
          begin
            TerminateScript;
          end else // here i get error Line 231: [Error] (17242:1): Identifier expected in script
          SpellsDone := SpellsDone + 1;

  2. #2
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure EnoughRunes;
    begin
      if FindBlackChatMessage('unes') then
      begin
        writeln('Not enough runes for the selected spell');
        Runes := False
      end;
      if FindBlackChatMessage('igh') then
      begin
        writeln('Your Magic level is not high enough for selected spell');
        Runes := False;
      end else
      EnoughRunes := True;
    end;

    SCAR Code:
    procedure Attack;
    begin
      if not LoggedIn then Exit;
      Status('ATTACKING!!!');
      repeat
        if not Players[CurrentPlayer].Booleans[0] = True then
        begin
          gametab(7);
          CastOn(Spell, 'esser', DemonColor1, 5);
          Wait(1000 + Random(1500))
          EnoughRunes;
          if not Runes then
            TerminateScript
          else SpellsDone := SpellsDone + 1;

    if you have "begin end;" in the first part of your else, you need to add those ";"
    SCAR Code:
    If Cookies Then
    Begin
      eat;
      cleantable;
    End Else
      Cry;
    When you only have 1 option then you need to remove your ";"
    SCAR Code:
    If Cookies Then
      Eat
    Else
    Begin
      Cry;
      WriteLn('you has no cookies');
    End;

    or you'll have the other case:
    SCAR Code:
    If Cookie Then
      Eat
    Else
      Cry;

    hope this helped you

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Try This:
    SCAR Code:
    procedure EnoughRunes;
    begin
      if FindBlackChatMessage('unes') then
      begin
        writeln('Not enough runes for the selected spell');
        Runes := False
      end;
      if FindBlackChatMessage('igh') then
      begin
        writeln('Your Magic level is not high enough for selected spell');
        Runes := False
      end else // here i get Line 224: [Error] (17235:1): Semicolon (';') expected in script
      EnoughRunes := True
    end;


    ...and this:
    SCAR Code:
    procedure Attack;
    begin
      if not LoggedIn then Exit;
      Status('ATTACKING!!!');
      repeat
        if not Players[CurrentPlayer].Booleans[0] = True then
        begin
          gametab(7);
          CastOn(Spell, 'esser', DemonColor1, 5);
          Wait(1000 + Random(1500))
          EnoughRunes;
          if Runes = False then
          begin
            TerminateScript
          end else // here i get error Line 231: [Error] (17242:1): Identifier expected in script
          SpellsDone := SpellsDone + 1;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 05-17-2008, 12:48 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. 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
  •