Results 1 to 3 of 3

Thread: Fix Spell Tab

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

    Default Fix Spell Tab

    Meh, probably could be moved to snippets, but I thought it may be useful enough to make the include considering it's a nice fail safe to check with before trying to teleport with some DTM or such. I've a feeling I've seen the idea before in another script, but I can't remember where. :s (probably is better than this too). Not to mention, feel free to mod the code for easier readability and/or less code (could be done, but I'm not that pro).

    Anywho, hope this helps.

    (ex. visually of what this exactly organizes)


    Simba Code:
    {
      Regular Spell's = Cmb/Tele/Misc/Skill
      Lunar Spell's = Cmb/Tele/Misc
      Ancient Spell's = Cmb/Tele

      Example of Useage:

      TBoolArray paramater;
       - false = no white outline expected, hence we'll make sure it's not outlined
       - true = white outline expcected, hence we'll make sure it's outlined/used.

      if OrganizeSpellBook('regular', [false, false, false, true]) then
        writeln('Only showing the last regular magic spells [which is skills]');
    }

    function OrganizeSpellBook(Spells:String; FilterOrder:TBoolArray): boolean;
    var
      i: integer;
      cc: integer; // color count (white color color count)
      indexBool: array of boolean; // stores the temp state of the filter boxes
    begin
      result := false;
      if not loggedin then
        exit;
      if (GetCurrentTab <> tab_magic) then
        GameTab(tab_magic);

      case Spells of
        'regular':
        begin
          if (Length(FilterOrder) <> 4) then
          begin
            SRL_Warn('OrganizeSpellBook', 'Faulty amount of True/False in '
                                          + 'TBoolArray', Warn_AllVersions);
            exit;
          end;
          SetLength(indexBool, 4); // There are 4 options in regular spell book.
          for i := 0 to 3 do
          begin
            cc := CountColorTolerance(16711422, MIX1+35+(i*21), MIY2-31,
                                                MIX1+56+(i*21), MIY2-1, 1);
            if (inRange(cc, 75, 78)) then
              indexBool[i] := True;
            if (not FilterOrder[i]) and indexBool[i] then
            begin
              MouseBox(MIX1+35+(i*21), MIY2-31, MIX1+56+(i*21), MIY2-1, mouse_left);
              result := true;
            end else
            if FilterOrder[i] and (not indexBool[i]) then
            begin
              MouseBox(MIX1+35+(i*21), MIY2-31, MIX1+56+(i*21), MIY2-1, mouse_left);
              result := true;
            end;
          end;
        end;
        'lunar':
        begin
          if (Length(FilterOrder) <> 3) then
          begin
            SRL_Warn('OrganizeSpellBook', 'Faulty amount of True/False in '
                                          + 'TBoolArray', Warn_AllVersions);
            exit;
          end;
          SetLength(indexBool, 3); // There are 3 options in lunar spell book.
          for i := 0 to 2 do
          begin
            cc := CountColorTolerance(16711422, MIX1+37+(i*27), MIY2-31,
                                                MIX1+64+(i*27), MIY2-1, 1);
            if (inRange(cc, 75, 78)) then
              indexBool[i] := True;
            if (not FilterOrder[i]) and indexBool[i] then
            begin
              MouseBox(MIX1+37+(i*27), MIY2-31, MIX1+64+(i*27), MIY2-1, mouse_left);
              result := true;
            end else
            if FilterOrder[i] and (not indexBool[i]) then
            begin
              MouseBox(MIX1+37+(i*27), MIY2-31, MIX1+64+(i*27), MIY2-1, mouse_left);
              result := true;
            end;
          end;
        end;
        'ancient':
        begin
          if (Length(FilterOrder) <> 2) then
          begin
            SRL_Warn('OrganizeSpellBook', 'Faulty amount of True/False in '
                                          + 'TBoolArray', Warn_AllVersions);
            exit;
          end;
          SetLength(indexBool, 2); // There are 2 options in ancient spell book.
          for i := 0 to 1 do
          begin
            cc := CountColorTolerance(16711422, MIX1+49+(i*36), MIY2-31,
                                                MIX1+84+(i*36), MIY2-1, 1);
            writeln(cc);
            if (inRange(cc, 75, 78)) then
              indexBool[i] := True;
            if (not FilterOrder[i]) and indexBool[i] then
            begin
              MouseBox(MIX1+49+(i*36), MIY2-31, MIX1+69+(i*36), MIY2-1, mouse_left);
              result := true;
            end else
            if FilterOrder[i] and (not indexBool[i]) then
            begin
              MouseBox(MIX1+49+(i*36), MIY2-31, MIX1+69+(i*36), MIY2-1, mouse_left);
              result := true;
            end;
          end;
        end;
      end;
    end;

    Cheers,
    Lj

    Edit : could replace the out-dated code in "Includes\SRL\SRL\skill\magic.simba", specifically the ClickSpellMode & SetSpellMode procedures.
    Last edited by Le Jingle; 10-16-2012 at 05:37 AM.

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

    Default

    There are some similar functions in skill/magic.simba, last modified is 12 Sept. 09. Seems like it doesn't support lunar/ancient, so maybe you can combine yours into it? Nice work.

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

    Default

    Thanks, I submitted it to the SRL/SRL5 git, guess we'll see what happens there.

    I'll try rewriting some of extension skill files in their same formats if I get some more free time. I've noticed quite a few (even though they're not heavily used) are out dated.

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
  •