Results 1 to 7 of 7

Thread: Help With Script.

  1. #1
    Join Date
    Feb 2007
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help With Script.

    Well, my script is not related to RuneScape, but hopefully, it'll still serve its intentions. I'm working on a script that puts out numbers for one to remember. Then it takes the numbers out of view and asks you to enter them. After that, Scar reads the input and hopefully will be able to determine whether the input was right or wrong. This is my script so far. (I received major help from JAD.)
    Code:
    program Memorization;
    
    const
    Message1=('Please remember these numbers:');
    
    Procedure Whatever;
    var
      a,b,c,d,e,f,g,h: Integer;
      s:String;
    begin
        a:= 0;
        b:= 8;
        c:= 2;
        d:= 9;
        e:= 0;
        f:= 5;
        Cleardebug;
        Writeln(Message1 +IntToStr(b) +IntToStr(c) +IntToStr(d) +IntToStr(e) +IntToStr(f) );
        Wait(3000);
       repeat
        a:= a + 1;
        Writeln('|');
       until(a >=10);
        Wait(3000);
        s:=readln('Enter Previous Number Here:');
        Writeln('The Correct Answer Was:' +IntToStr(b) +IntToStr(c) +IntToStr(d) +IntToStr(e) +IntToStr(f) );
    end;
    procedure WhatEverA;
    var s:Integer;
    begin
        if
         s=82905
        then
         Writeln('You Have Entered The Correct Answer!')
        else
         Writeln('You Have Entered An Incorrect Answer!');
        Wait(7000);
    end;
    procedure WhatEverB;
    var a,b,c,d,e,f,g,h: Integer;
    begin
        a:= 0;
        b:= 2;
        c:= 7;
        d:= 4;
        e:= 0;
        f:= 1;
        g:= 8;
        h:= 3;
        Cleardebug;
        Writeln(Message1 +IntToStr(b) +IntToStr(c) +IntToStr(d) +IntToStr(e) +IntToStr(f) +IntToStr(g) +IntToStr(h) );
        Wait(3000);
       repeat
        a:= a + 1;
        Writeln('|');
       until(a >=10);
    end;
    begin
        Whatever;
        WhateverA;
        WhateverB;
    end.
    I'm having trouble with the 'if', 'then', 'else' part. Even if I enter the correct number, 82905, the message that Scar chooses to type is 'You Have Entered An Incorrect Answer!' It seems like it only chooses the 'else' part and ignores the 'then' part. I was thinking maybe it's because I've used 's' as a string and a variable, but I don't know how to have it read an input unless it is a string.

    I hope some one will be able to help me. Thanks to all the people that have answered my questions earlier, and thanks to the people that will answer questions in the future.
    If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly. - put this in your signature!

  2. #2
    Join Date
    Oct 2006
    Location
    I'm a figment of your imagination
    Posts
    422
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You did everything correct, there are no errors with the else. Your problem is that the variable s isn't a global variable. IT MUST BE GLOBAL. SCAR deletes all variables that are created in a procedure after the procedure finished. Only Global variables will stay.

    so, add this to the way top (below program memorization :

    SCAR Code:
    var
      s : integer;

    and in procedure whateverA, remove

    SCAR Code:
    var
      s : integer;

    It's been a while... but I'm BACK!!!

  3. #3
    Join Date
    Feb 2007
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I tried that. If I do that, the 's:=readln('Enter Previous Number Here:');' line says that there is a mismatch. I think the problem is that 's' is declared as a variable and a string, so it might be confusing Scar.
    If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly. - put this in your signature!

  4. #4
    Join Date
    Feb 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    uh i dont get anything email me at jonah12171@hotmail.com and u canhelp me learn how to script its sort of confusing

  5. #5
    Join Date
    Feb 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    where do i get free autominers or choppers or fishers

  6. #6
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    Hmm, it seems alot more logical if you would randomize the numbers so th²at you don't have to make a new function for each number...
    Here I made a small example...
    SCAR Code:
    program Memorization;

    var
      Numbers: array[1..6] of Integer;
      s, nmb: string;

    const
      Msg = 'Please remember these numbers: ';

    procedure GenerateNumbers;
    var
      i: Integer;
    begin
      for i := 1 to 6 do
        Numbers[i] := Random(10);
    end;

    procedure ShowNumbers;
    var
      i: Integer;
    begin
      Cleardebug;
      for i := 1 to 6 do
        nmb := nmb + IntToStr(Numbers[i]);
      WriteLn(Msg + nmb);
      Wait(3000);
    end;

    procedure Ask_Answer;
    var
      i: Integer;
    begin
      for i := 1 to 10 do
        WriteLn('|');
      Wait(3000);
      s := ReadLn('Enter Previous Number Here:');
      if nmb = s then
        WriteLn('You Have Entered The Correct Answer!')
      else
        Writeln('You Have Entered An Incorrect Answer!');
    end;

    begin
      GenerateNumbers;
      ShowNumbers;
      Ask_Answer;
    end.

    EDIT:
    And Atek, don't dual post and especially don't leech...

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

    Default

    Still having some troubles. =/
    If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly. - put this in your signature!

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
  •