Results 1 to 5 of 5

Thread: Automatic Summoning Scroll Profits Functions/Procedures

  1. #1
    Join Date
    Jan 2012
    Location
    Texas
    Posts
    241
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default Automatic Summoning Scroll Profits Functions/Procedures

    Recently, after thinking about my friend's java program which read a website for real-time stock prices, I figured since I made a summoning script with scroll support and was constantly checking scroll profits that I should do the same thing in Simba but for summoning scrolls' profits.

    It probably isn't the best way to program this task, but it works.

    More functions/procedures to come.

    Simba Code:
    Program ScrollsProfits;

    Const
    ScrollType = 'Ambush';

    Function GetScrollProfit(Scroll:string):String;
    Var
      Words:String;
      Index, Index1:Integer;
    begin
      Words := GetPage('http://runescape.wikia.com/wiki/Calculator:Summoning/Scrolls/High');
      Index := PosEx('>', Words, PosEx('color:', Words, Pos(Scroll, Words))+6);
      Index1 := PosEx('<', Words, Index);
      Result := ScrollType + ' Scroll Profit: ' + Copy(Words, Index+1, PosEx('<', Words, Index)-(Index+1)) + 'gp';
    end;

    Procedure DisplayAllScrolls; //Displays all scrolls, their required summoning levels, their corresponding pouches, and their profits/losses
    Var
      Page, Scroll, Level, Pouch, Profit:String;
      Index, Index1, i:Integer;
    begin
      Writeln('|==============================================================|');
      Writeln('|        Scroll         Level           Pouch          Profit  |');
      Writeln('|==============================================================|');
      Page := GetPage('http://runescape.wikia.com/wiki/Calculator:Summoning/Scrolls/High');
      For i := 0 to 41 Do
      begin
        Index := PosEx('name="', Page, Pos('Profit', Page)+(i*1230));
        Index1 := PosEx('.p', Page, Index+10);
        Scroll := Copy(Page, Index+6, Index1-(Index+6));
        If Pos('Titan', Scroll) <> 0 Then
          Scroll := 'Titan''s con. scroll';
        Level := Copy(Page, PosEx('scroll</a> </td><td> ', Page, Index)+21, 2);
        Pouch := Copy(Page, PosEx('name="', Page, Index+4)+6, PosEx('.p', Page, PosEx('name="', Page, Index+4)+6)-(PosEx('name="', Page, Index+4)+6));
        Index1 := PosEx('<', Page, PosEx('color', Page, PosEx('name', Page, Index)));
        Profit := Copy(Page, PosEx('>', Page, PosEx('color', Page, PosEx('name="', Page, Index)))+1, Index1-(PosEx('>', Page, PosEx('color', Page, PosEx('name="', Page, Index)))+1)) + 'gp';
        Writeln('    ' + Scroll + '   ' + Level + '   ' + Pouch + '   ' + Profit);
      end;
    end;

    Procedure DisplayPositiveProfitScrolls; //Displays scrolls' names, required levels, corresponding pouches, and profits if they can make a profit
    Var
      Page, Scroll, Level, Pouch, Profit, Comma:String;
      Index, Index1, i:Integer;
    begin
      Writeln('|==============================================================|');
      Writeln('|        Scroll         Level           Pouch          Profit  |');
      Writeln('|==============================================================|');
      Page := GetPage('http://runescape.wikia.com/wiki/Calculator:Summoning/Scrolls/High');
      Comma := ',';
      For i := 0 to 41 Do
      begin
        Index := PosEx('name="', Page, Pos('Profit', Page)+(i*1230));
        Index1 := PosEx('.p', Page, Index+10);
        Scroll := Copy(Page, Index+6, Index1-(Index+6));
        If Pos('Titan', Scroll) <> 0 Then
          Scroll := 'Titan''s con. scroll';
        Level := Copy(Page, PosEx('scroll</a> </td><td> ', Page, Index)+21, 2);
        Pouch := Copy(Page, PosEx('name="', Page, Index+4)+6, PosEx('.p', Page, PosEx('name="', Page, Index+4)+6)-(PosEx('name="', Page, Index+4)+6));
        Index1 := PosEx('<', Page, PosEx('color', Page, PosEx('name', Page, Index)));
        Profit := Copy(Page, PosEx('>', Page, PosEx('color', Page, PosEx('name="', Page, Index)))+1, Index1-(PosEx('>', Page, PosEx('color', Page, PosEx('name="', Page, Index)))+1)) + 'gp';
        If Pos('-', Profit) = 0 Then
        begin
          If Pos(Comma, Profit) > 0 Then
            Delete(Profit, Pos(Comma, Profit), 1);
          Writeln('    ' + Scroll + '   ' + Level + '   ' + Pouch + '   ' + Profit);
        end;
      end;
    end;

    begin
      Writeln(GetScrollProfit(ScrollType));
      DisplayAllScrolls;
      DisplayPositiveProfitScrolls;
    end.

    Outputs in order:
    Code:
    Ambush Scroll Profit: 454gp
    Code:
    |================================|
    |        Scroll         Level           Pouch          Profit    |
    |================================|
        Tireless run scroll   52   Spirit terrorbird pouch   -89gp
        Abyssal drain scroll   54   Abyssal parasite pouch   -1,227gp
        Dissolve scroll   55   Spirit jelly pouch   -627gp
        Steel bull rush scroll   56   Steel minotaur pouch   -502gp
        Fish rain scroll   56   Ibis pouch   -415gp
        Ambush scroll   57   Spirit kyatt pouch   454gp
        Rending scroll   57   Spirit larupia pouch   -753gp
        Goad scroll   57   Spirit graahk pouch   -6,667gp
        Doomsphere scroll   58   Karam. overlord pouch   -566gp
        Dust cloud scroll   61   Smoke devil pouch   -789gp
        Abyssal stealth scroll   62   Abyssal lurker pouch   842gp
        Oph. incubation scroll   63   Spirit cobra pouch   407gp
        Poisonous blast scroll   64   Stranger plant pouch   -533gp
        Mith bull rush scroll   66   Mithril minotaur pouch   -657gp
        Toad bark scroll   66   Barker toad pouch   -203gp
        Testudo scroll   67   War tortoise pouch   -8,365gp
        Swallow whole scroll   68   Bunyip pouch   -198gp
        Fruitfall scroll   69   Fruit bat pouch   257gp
        Famine scroll   70   Ravenous locust pouch   45gp
        Arctic blast scroll   71   Arctic bear pouch   -232gp
        Volcanic str. scroll   73   Obsidian golem pouch   -799gp
        Crushing claw scroll   74   Granite lobster pouch   -744gp
        Mantis strike scroll   75   Praying mantis pouch   -802gp
        Inferno scroll   76   Forge regent pouch   -663gp
        Adamant bull rush scroll   76   Adamant minotaur pouch   -405gp
        Deadly claw scroll   77   Talon beast pouch   -571gp
        Acorn missile scroll   78   Giant ent pouch   -716gp
        Titan's con. scroll   79   Fire titan pouch   239gp
        Titan's con. scroll   79   Ice titan pouch   -5,685gp
        Titan's con. scroll   79   Moss titan pouch   215gp
        Regrowth scroll   80   Hydra pouch   -538gp
        Spike shot scroll   83   Spirit dagannoth pouch   -45gp
        Ebon thunder scroll   83   Lava titan pouch   -917gp
        Swamp plague scroll   85   Swamp titan pouch   -731gp
        Rune bull rush scroll   86   Rune minotaur pouch   -58gp
        Healing aura scroll   88   Unicorn stallion pouch   365gp
        Boil scroll   89   Geyser titan pouch   -888gp
        Magic focus scroll   92   Wolpertinger pouch   60gp
        Essence shipment scroll   93   Abyssal titan pouch   -226gp
        Iron within scroll   95   Iron titan pouch   -17gp
        Winter storage scroll   96   Pack yak pouch   330gp
        Steel of legends scroll   99   Steel titan pouch   578gp
    Code:
    |================================|
    |        Scroll         Level           Pouch          Profit    |
    |================================|
        Ambush scroll   57   Spirit kyatt pouch   454gp
        Abyssal stealth scroll   62   Abyssal lurker pouch   842gp
        Oph. incubation scroll   63   Spirit cobra pouch   407gp
        Fruitfall scroll   69   Fruit bat pouch   257gp
        Famine scroll   70   Ravenous locust pouch   45gp
        Titan's con. scroll   79   Fire titan pouch   239gp
        Titan's con. scroll   79   Moss titan pouch   215gp
        Healing aura scroll   88   Unicorn stallion pouch   365gp
        Magic focus scroll   92   Wolpertinger pouch   60gp
        Winter storage scroll   96   Pack yak pouch   330gp
        Steel of legends scroll   99   Steel titan pouch   578gp


    Note: Thank you Tootoot222 for answering my abundance of questions.
    Last edited by Spiker; 05-18-2012 at 01:01 AM.
    Coming together is a beginning.
    Keeping together is progress.
    Working together is success.

  2. #2
    Join Date
    May 2012
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    good work man! looks good!

  3. #3
    Join Date
    Oct 2010
    Posts
    1,255
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    Google document spreadsheets work nicely also.
    I'm back

  4. #4
    Join Date
    Jan 2012
    Location
    Texas
    Posts
    241
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by smurg View Post
    Google document spreadsheets work nicely also.
    Yeah, I was going to look into this for getting items straight from the GE.
    It was just convenient that the scroll profits, etc. were all on one page.
    Coming together is a beginning.
    Keeping together is progress.
    Working together is success.

  5. #5
    Join Date
    Jul 2007
    Location
    Finland
    Posts
    304
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Use padding functions to make output readable.

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
  •