Results 1 to 8 of 8

Thread: Variable Expected? Never had this error before.

  1. #1
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Variable Expected? Never had this error before.

    SCAR Code:
    {.include srl/srl.scar}
    {.include srl/srl/misc/QuickChat.scar}

    Const
     StartPersonality='angry';

    Var
     Respond1, I : Array Of String;
     Personality : String;
     N : Integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := ''; // 3-4 letters of username
      Players[0].Active := True;   // Is the player active?

      {Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := ''; // 3-4 letters of username
      Players[1].Active := True;   // Is the player active?

      Players[2].Name := '';
      Players[2].Pass := '';
      Players[2].Nick := ''; // 3-4 letters of username
      Players[2].Active := True;   // Is the player active?}

    end;

    function InChatMulti(text: TStringArray): boolean;
    var
      i : integer;
      s: string;
    begin
      for i:=0 to high(text) do
      begin
        if (not (GetLastChatText(s))) then
          LastChatter(s);
          Result := (Pos(Text[i], s) > 0);
      end;
    end;

    Procedure Responding;
    Begin
      SetupSrl;
      DeclarePlayers;
      Personality:=StartPersonality;
      If Not FindBlackChatMessage(Players[currentplayer].name) and InChatMulti(['lvl', 'level', 'lv', 'lev', 'leve', 'hi', 'hello', 'sup', 'yo']) Then
        Begin
          I:=['oodcutting', 'oodcut', 'ishing', 'ish', 'ine', 'ining', 'hi', 'hello', 'sup', 'yo'];
          For N:=0 To GetArrayLength(I) Do
            Case InChat(I[N]) Of
              True : Begin
                       Case I[N] Of
                         1, 2 : Begin
                                  Case Personality Of
                                    'laid back' : Respond1:=['Tis ', 'Yo, my wc lvl is ', ''];
                                    'polite' : Respond1:=['Thanks for asking', 'It is ', ''];
                                    'bored' : Respond1:=['Lolz, it''s ', 'dood! My wc level is ', ''];
                                    'angry' : Respond1:=['What''s it matter? If you must know it''s ', 'Bah. ', ''];
                                  End;
                                  Case Random(4) Of
                                    1, 2, 3 : TypeSend(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('woodcutting', True)));
                                    4 : QCSayLevel('woodcutting');
                                  End;
                                End;
                         3, 4 : Begin
                                  Case Personality Of
                                    'laid back' : Respond1:=['Tis ', 'Yo, my fishing lvl is ', 'It''s ', ''];
                                    'polite' : Respond1:=['Thanks for asking', 'It is ', ''];
                                    'bored' : Respond1:=['Lolz, it''s ', 'dood! My fishing level is ', ''];
                                    'angry' : Respond1:=['What''s it matter? If you must know it''s ', 'Bah. ', ''];
                                  End;
                                  Case Random(4) Of
                                    1, 2, 3 : TypeSend(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('woodcutting', True)));
                                    4 : QCSayLevel('woodcutting');
                                  End;
                                End;
                         5,6 : Begin
                                  Case Personality Of
                                    'laid back' : Respond1:=['Tis ', 'Yo, my mining lvl is ', ''];
                                    'polite' : Respond1:=['Thanks for asking', 'It is ', ''];
                                    'bored' : Respond1:=['Lolz, it''s ', 'dood! My mining level is ', ''];
                                    'angry' : Respond1:=['What''s it matter? If you must know it''s ', 'Bah. ', ''];
                                  End;
                                  Case Random(4) Of
                                    1, 2, 3 : TypeSend(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('woodcutting', True)));
                                    4 : QCSayLevel('woodcutting');
                                  End;
                               End;
                         7, 8, 9, 10 : Begin
                                         Case Personality Of
                                           'laid back' : Respond1:=['Yo!', 'Sup?', 'Sup man?'];
                                           'polite' : Respond1:=['Hello.', 'Good day to you.'];
                                           'bored' : Respond1:=['Ohaider!', 'Hi.'];
                                           'angry' : Respond1:=['What?', 'Leave me alone!', 'Go away!'];
                                       End;
                                       Case Random(4) Of
                                         0, 1, 2 : TypeSend(Respond1[Random(GetArrayLength(Respond1))] + IntToStr(GetSkillInfo('woodcutting', True)));
                                         3 : TypeSend('GH' + IntToStr(Random(5)));
                                       End;
                                       End;
                                End;
                       End;
                       End;
              False : WriteLn('Didn''t find anything'); //This line has the error!
             End;
          wait(10);
        End;
    End.

    Error is near the end of the script.

    SCAR Code:
    Line 110: [Error] (16482:1): Variable Expected in script C:\Program Files\SCAR 3.15\Scripts\Responde.scar

    That's the error. :/. I don't think it's from lack of/to many ends/begins, as I've counted three or four times.

  2. #2
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you forgot to uncomment the rest of the script

  3. #3
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh, I forgot the } when I copied and pasted it. That isn't causing the error.

  4. #4
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Wow, this is really confusing. I can't figure this out for the life of me. I have tried everything that I know but still no avail. I tried making the procedure into a function and and changing it to work around it. I'm still going to work on it.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  5. #5
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Delete the end; before the line that's causing the error. That's where your problem is. Also, you have an end. at the end of your Responding procedure, which will also cause errors. Change the period to a semicolon.
    :-)

  6. #6
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It was working before, which is why I didn't try that. I'll try it now .

    Thanks Method, it worked!

  7. #7
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Any chance of me making a question and the 4 personality replys?
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  8. #8
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Feel free to pm me as many questions/replies as you feel should be in it .

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Variable Expected error
    By Nava2 in forum OSR Help
    Replies: 3
    Last Post: 04-29-2008, 09:33 PM
  2. Replies: 3
    Last Post: 02-07-2008, 02:15 AM
  3. Line 0: [Error] (0:1): Variable Expected in script
    By cathering_ in forum OSR Help
    Replies: 15
    Last Post: 09-09-2007, 11:40 AM
  4. Line 1: [Error] Variable Expected in script
    By Fearlesssss in forum OSR Help
    Replies: 7
    Last Post: 05-26-2007, 10:12 PM
  5. Variable Expected
    By NinjaTerrorist in forum OSR Help
    Replies: 20
    Last Post: 02-24-2007, 11:43 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
  •