Results 1 to 6 of 6

Thread: Change FindBank

  1. #1
    Join Date
    Dec 2007
    Location
    Somewhere in Idaho
    Posts
    480
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Change FindBank

    It would be great if we could change the findbank function to this

    SCAR Code:
    function FindBank(TheBank: string): Boolean;
    var
      bx, by, TheDTM: Integer;
      WhichAngle: Extended;
    begin
      TheBank := LowerCase(TheBank);
      case TheBank of
        'feb': TheDTM := DTMFromString('78DA63AC67626088634001FFFFFD63F80FA41' +
            '9416C2060AC01AA4987C83141D5FCF9C3C4C0055503028CAD44A8' +
            'E924AC0600131E11B5');
        'fwb': TheDTM := DTMFromString('78DA636C676260086540038C0CFFC12403C37' +
            'F206004A98986C8304155FCF9C3C4C0055503D6D14C849A6EC26A' +
            '009F5A0EA1');
        'db': TheDTM := DTMFromString('78DA636C67626008644001FFFFFD63F80FA41' +
            '9416C2060AC01AAF182C8B140D5FCF9C304A619A17CB09A204C35' +
            '22E86AC2F09B0300F8811153');
        'veb': TheDTM := DTMFromString('78DA63EC61626008624001FFFFFD63F80FA41' +
            '9416C2060EC00AA8982C83141D5FCF9C3C4C0055503028C138850' +
            'D343580D00122211A9');
        'vwb': TheDTM := DTMFromString('78DA63EC606260B066C000FF819811440301E' +
            '354A01A3B88381354FECF1F260611A81A1000AB3125428D2E7E35' +
            '0087F80E5E');
        'akb': TheDTM := DTMFromString('78DA636C606260F06140019D9D710CFF81342' +
            '310FF0702C652A01A37881C1354CD9F3F4C0C5C5035200056E345' +
            '841A3FFC6A002A3B0F97');
        else
        begin
          srl_Warn('FindBank', 'Invalid bank name', warn_Warning);
          Exit;
        end;
      end;

      Result := FindDtmRotated(TheDTM, bx, by, MMX1, MMY1, MMX2, MMY2,
                                Radians(-30), Radians(30), 0.05, WhichAngle);
      FreeDTM(TheDTM);

    And remove all the opening bank stuff. We already have an open bank function. If that is too much then I would happy if we split this part into a sub function.

    The reason is simple. Often I want to check and see if I am in a bank, the find bank function would be the fastest method for that. But I don't want to open the bank. For example, usually I will want to see "Am I in the bank?" then "Do I have a Pickaxe" and finally "Open bank, dump everything and if no pickaxe, get one".

    I don't know, it just doesn't seem right that a function named "FindBank" would go and open the bank as well, then it should be named "FindAndOpenBank" because it is doing those two things.

  2. #2
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    SRL doesn't have to change it...just take that function and add it to your script and rename it like FindBankEx

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  3. #3
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Your function does nothing with the returned x and y, therefore rendering it quite useless...



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  4. #4
    Join Date
    Dec 2007
    Location
    Somewhere in Idaho
    Posts
    480
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    Your function does nothing with the returned x and y, therefore rendering it quite useless...
    Not really, It tells if you are in a specific bank. Thats just as useful as anything else. At very least, a function name should reflect what the function does. If the function finds a bank and opens it up it should be called "FindBankandOpen"

  5. #5
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by boberman View Post
    Not really, It tells if you are in a specific bank. Thats just as useful as anything else. At very least, a function name should reflect what the function does. If the function finds a bank and opens it up it should be called "FindBankandOpen"
    I agree wiith that, but maybe make it return the coords aswell?

    -Tsn.
    [QUOTE=Santa_Clause;277761]I love you too TSN :p[/QUOTE]
    [CENTER][URL="http://www.stats.srl-forums.com/sigs"][IMG]http://www.stats.srl-forums.com/sigs/1324.png[/IMG][/URL][/CENTER]

  6. #6
    Join Date
    Dec 2007
    Location
    Somewhere in Idaho
    Posts
    480
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by the scar noob View Post
    I agree wiith that, but maybe make it return the coords aswell?

    -Tsn.
    Ok, I can see that as well. That really wouldn't be too hard.

    SCAR Code:
    function FindBank(TheBank: string; var bx, by: Integer): Boolean;
    var
      TheDTM: Integer;
      WhichAngle: Extended;
    begin
      TheBank := LowerCase(TheBank);
      case TheBank of
        'feb': TheDTM := DTMFromString('78DA63AC67626088634001FFFFFD63F80FA41' +
            '9416C2060AC01AA4987C83141D5FCF9C3C4C0055503028CAD44A8' +
            'E924AC0600131E11B5');
        'fwb': TheDTM := DTMFromString('78DA636C676260086540038C0CFFC12403C37' +
            'F206004A98986C8304155FCF9C3C4C0055503D6D14C849A6EC26A' +
            '009F5A0EA1');
        'db': TheDTM := DTMFromString('78DA636C67626008644001FFFFFD63F80FA41' +
            '9416C2060AC01AAF182C8B140D5FCF9C304A619A17CB09A204C35' +
            '22E86AC2F09B0300F8811153');
        'veb': TheDTM := DTMFromString('78DA63EC61626008624001FFFFFD63F80FA41' +
            '9416C2060EC00AA8982C83141D5FCF9C3C4C0055503028C138850' +
            'D343580D00122211A9');
        'vwb': TheDTM := DTMFromString('78DA63EC606260B066C000FF819811440301E' +
            '354A01A3B88381354FECF1F260611A81A1000AB3125428D2E7E35' +
            '0087F80E5E');
        'akb': TheDTM := DTMFromString('78DA636C606260F06140019D9D710CFF81342' +
            '310FF0702C652A01A37881C1354CD9F3F4C0C5C5035200056E345' +
            '841A3FFC6A002A3B0F97');
        else
        begin
          srl_Warn('FindBank', 'Invalid bank name', warn_Warning);
          Exit;
        end;
      end;
     
      Result := FindDtmRotated(TheDTM, bx, by, MMX1, MMY1, MMX2, MMY2,
                                Radians(-30), Radians(30), 0.05, WhichAngle);
      FreeDTM(TheDTM);
    end;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. About the FindBank function.
    By bzum in forum OSR Help
    Replies: 4
    Last Post: 09-03-2008, 09:20 PM
  2. FindBank ?
    By faster789 in forum OSR Help
    Replies: 3
    Last Post: 03-30-2008, 07:34 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
  •