Results 1 to 12 of 12

Thread: Records Question

  1. #1
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Records Question

    I read abu_jwka's Records tut, and I thought I understood everything, but when I go to use a variable I assigned in my LoadTLeatherRecord procedure, it has a value of 0, even though I assigned it to a different variable. Can someone show me what Im doing wrong? Heres the parts of the script, in order, related to the issue.
    Simba Code:
    program AlKharid_Tanner;
    {$i srl/srl.simba}

    type TLeatherRecord = record
      LeatherDTM, WaitTimeMin, WaitTimeMax:integer;
    end;

    var
      LDTM:TLeatherRecord;
      Hides_Tanned:Integer;

    const
      Row = 2;    //Row of item to tan in bank.
      Column = 2; //Column of item to tan in bank.
      Hides_To_Tan = 56; //How many hides are you tanning?
      Profit_per_hide = 20; //How much profit do you make per hide tanned? Used in progress report.

      procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := '';  //Username Here!
      Players[0].Pass := '';  //Password Here!
      Players[0].Pin := '';   //Pin here!
      Players[0].Active := True;
      Players[0].Strings[0] := 'GreenLeather'; //What Are we Tanning? Options(GreenLeather, RedLeather, BlackLeather, BlueLeather, RoyalLeather, HardLeather, SoftLeather) Dont Missspell them!
    End;

    Procedure LoadTLeatherRecord;
    begin
      case lowercase(Players[CurrentPlayer].Strings[0]) of
        'GreenLeather': begin
                          LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYEhkZGBIAeJQIA4A4hwgvgTED4D4JBBfAOKLQMxpywVUzYSCQSLogBELBgMADIgGaQ==');
                          LDTM.WaitTimeMin := 1000;
                          LDTM.WaitTimeMax := 1400;
                        end;
        'BlueLeather': begin
                         LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYChkZGBIB+JUIK4A4mogvgLEJ4D4FhDfg7K5eTyBqplQMBcDJmDEgsEAADGZBtM=');
                         LDTM.WaitTimeMin := 1200;
                         LDTM.WaitTimeMax := 1800;
                       end;
        'RedLeather': begin
                        LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYNjAyMCwGIiXA/EeIF4HxJeA+CwQ3wXiy0B8BIhteTmBqplQMBcDJmDEgsEAAKFaB/E=');
                        LDTM.WaitTimeMin := 2000;
                        LDTM.WaitTimeMax := 3000;
                      end;
        'BlackLeather': begin
                          LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYNBiZGBQAmJTIJYHYjMgvgjE94D4FBCfAOLLIDlZWaBqJhTMxYAJGLFgMAAAqwgFag==');
                          LDTM.WaitTimeMin := 2500;
                          LDTM.WaitTimeMax := 3500;
                        end;
        'SoftLeather': begin
                         LDTM.LeatherDTM := DTMFromString('mggAAAHicY2NgYIgH4mwgTgXiICAOBeIMIL7IyMBwDYiPAfE5IL4DxbYWnEBZJgzMyoAdMOLAEAAA+wgH0Q==');
                         LDTM.WaitTimeMin := 0;
                         LDTM.WaitTimeMax := 0;
                       end;
        'HardLeather': begin
                         LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYLgDxE+B+DkQXwbiSyDMyMBwHIhvAfEdID4NxDoaskAZJhTMxYAJGLFgMAAAAcAI+g==');
                         LDTM.WaitTimeMin := 0;
                         LDTM.WaitTimeMax := 0;
                       end;
        'RoyalLeather': begin
                          LDTM.LeatherDTM := DTMFromString('mbQAAAHicY2VgYFjOyMAwA4jXAfEWIJ4DxJeA+BoQ3wPiU1DsIB0OVM2EgrkYMAEjFgwGAKx3CDA=');
                          LDTM.WaitTimeMin := 3000;
                          LDTM.WaitTimeMax := 4000;
                        end;
        end;

    end;

    Procedure SetupStuff;
    begin
      SetupSRL;
      DeclarePlayers;
      LoadTLeatherRecord;
      Loginplayer;
      wait(randomrange(100, 200));
      Gametab(tab_inv);
      Makecompass('W');
    end;

    Function ClickTanner:boolean;
    var
      TanScreenDTM, counter, x, y:Integer;
    begin
      TanScreenDTM := DTMFromString('mggAAAHicY2NgYHjLyMBwE0j3A7EjEOsDcSwQPwGKLwXiqUC8EIinAPFkIC61EWb4//8/BuYC6mHFghlxYAgAAPN8FvQ=');
      if not(loggedin) then
        exit;
      wait(randomrange(500, 1000));
      if findobjTPAMulti(x, y, [TannerCapeColor, TannerShirtColor], 5, 2, 10, 10, 20, ['llis', 'Ellis']) then
        begin
          wait(randomrange(100, 300));
          Mouse(x, y, 2, 2, mouse_right);
          waitoption('ides', 1000);
        end else
          begin
            Mouse(257, 152, 4, 4, mouse_right);
            WaitOptionmulti(['hides', 'ide', 'an hi'], 1000);
          end;

      Marktime(counter);
      repeat
        wait(randomrange(50, 150));
        if TimeFromMark(counter) > 8000 then
          begin
            writeln('Tanning screen not opening up! Logging out!');
            Logout;
            TerminateScript;
          end;
      until(FindDTM(TanScreenDTM, x, y, MCX1, MCY1, MCX2, MCY2));
      Result := True;
      FreeDTM(TanScreenDTM);
      wait(randomrange(1000, 2000));

    end;

    Procedure TanHides;
    var
      Counter, x, y:integer;
    begin
      if not(loggedin) then
        exit;
      if FindDTM(LDTM.LeatherDTM, x, y, MCX1, MCY1, MCX2, MCY2) then
        begin
          Mouse(x, y, 5, 5, mouse_left);
            exit;
          end else
            begin
              MMouse(501, 427, 2, 10)
              wait(randomrange(LDTM.WaitTimeMin, LDTM.WaitTimeMax));
              Mousebox(5, 341, 505, 426, 3);
              Marktime(counter);
              repeat
                wait(randomrange(50, 200));
                if TimefromMark(counter) > 10000 then
                  begin
                    writeln('We couldnt find the LeatherDTM! Logging out!');
                    Logout;
                    Terminatescript;
                  end;
              until(findDTM(LDTM.LeatherDTM, x, y, MCX1, MCY1, MCX2, MCY2));
                mouse(x, y, 5, 5, mouse_left);
                exit;
            end;
      Writeln('Strings[0] String " ' + (Players[0].Strings[0]) + ' " Is unknown. Please enter an option from the list. Terminating script!');
      Logout;
      Terminatescript;
    end;

    Procedure ReleaseDTMs;
    begin
      FreeDTM(LDTM.LeatherDTM);
    end;

    begin
      SetupStuff;
      //repeat
        //WalkToTanner;
        if ClickTanner then
          begin
          writeln(IntToStr(LDTM.WaitTimeMax));
          TanHides;
          end;
        {WalkToBank;
        repeat
          OpenBankCustom;
        until(BankScreen or pinscreen);
        Bankprocedure;
        Proggy;
      until(Hides_Tanned >= Hides_To_Tan);}

      ReleaseDTMs;

    end.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  2. #2
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Seems good to me. I tried using your code but there are other compilation error.

    I'm going to remove the useless code and see if it actualy works.
    My scripts:
    Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
    Questions? I bet that for 98% of those, you'll find answer HERE

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

    Default

    I don't have much experience with records but I think it's because your case statement calls lowercase, but all the things have capitals.

  4. #4
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    I don't have much experience with records but I think it's because your case statement calls lowercase, but all the things have capitals.
    ^, I changed to lower cases and got;
    Code:
    1400
    Successfully executed.

  5. #5
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Didn't knew pascal script could be case sensitive in same cases. Guess you always learn new stuff :s
    My scripts:
    Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
    Questions? I bet that for 98% of those, you'll find answer HERE

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

    Default

    It's always case sensitive, just to let you know.
    E: Usually, lol.
    Last edited by Nebula; 08-11-2012 at 09:26 PM.

  7. #7
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks guys! Works perfectly now. And it won't conpile because that's not the entire script, only the parts using the record.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  8. #8
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    It's always case sensitive, just to let you know.
    Simba Code:
    program new;
    var
       a, A: Integer;
    begin
    end.

    Try this and tell me it's always case sensitive.
    My scripts:
    Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
    Questions? I bet that for 98% of those, you'll find answer HERE

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

    Default

    Duplicate identifier 'A' at line 3

    it's always case sensitive. Lol

    Wait no, I thought I was right but now I just realized that if it comes up as a duplicate identifier then it isn't case sensitive. Never mind lol. Usually it is.
    Last edited by Nebula; 08-11-2012 at 09:22 PM.

  10. #10
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    Duplicate identifier 'A' at line 3

    it's always case sensitive. Lol
    If it was case sensitive, it wouldn't throw you an error.
    My scripts:
    Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
    Questions? I bet that for 98% of those, you'll find answer HERE

  11. #11
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    It's always case sensitive, just to let you know.
    E: Usually, lol.
    AFAIK, only strings are case sensitive. Variables/procedure/function names etc are all not. Though of course u should follow good standards (camel case etc).

  12. #12
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by eska View Post
    Didn't knew pascal script could be case sensitive in same cases. Guess you always learn new stuff :s
    String types in pretty much all programming languages are case sensitive, as each character (uppercase or lowercase) represents a different ASCII/Unicode value on the lower level. e.g., type Writeln(Ord('a')) into Simba, followed by Writeln(Ord('A')). You will get two completely different answers.

    Regards,
    ~ Daniel.
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

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
  •