Results 1 to 9 of 9

Thread: Inventory functions

  1. #1
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default Inventory functions

    I didnt see these functions they might have some but i didnt see any
    SCAR Code:
    //Uses item in inventory spot 1 with item in inventory spot 2
    Procedure UseItems(inv1,inv2: integer);
    begin
      if existsitem(inv1) and existsitem(inv2) then
      begin
        UseItem(inv1);
        Wait(100+random(50));
        UseItem(inv2);
      end else;
      Writeln('Theres nothing in one of the inventory spots');
    end;
    // uses dtm1 with dtm2
    Procedure UseItemsDTM(Dtm1,Dtm2: integer);
    begin
      if FindDTM(DTM1,X,Y,MIX1,MIY1,MIX2,MIY2) and
         FindDTM(DTM2,X,Y,MIX1,MIY1,MIX2,MIY2) then
      begin
        FindDTM(DTM1,X,Y,MIX1,MIY1,MIX2,MIY2);
        Mouse(x,y,3,3,true);
        FindDTM(DTM1,X,Y,MIX1,MIY1,MIX2,MIY2);
        Mouse(x,y,3,3,true);
      end else;
      writeln('Cannot find DTMs');
    end;

    and here are some inventory mouse clicking functions that use Tbox insted of coordinates.
    SCAR Code:
    Function InvTbox(i: integer): Tbox;
    begin
      row := ceil(i div 4);
      col :=i mod 4
      if (col < 0) then
      begin
        col := 4;
      end;
      Result.x1:=569+(42*(col-1));
      Result.y1:=213+(36*(row-1));
      Result.x2:=600+(42*(col-1));
      Result.y2:=244+(36*(row-1));
    end;

    Procedure MMouseItemBox(i: integer);
    var Box: Tbox;
    begin
      Box:=InvTbox(i);
      x:=RandomRange(Box.X1,Box.X2);
      y:=RandomRange(Box.Y1,Box.Y2);
      MMouse(x,y,0,0);
    end;

    Procedure MouseItemBox(i: integer;Left: boolean);
    var Box: Tbox;
    begin
      Box:=InvTbox(i);
      x:=RandomRange(Box.X1,Box.X2);
      y:=RandomRange(Box.Y1,Box.Y2);
      Mouse(x,y,0,0,Left);
    end;
    //by lorax made with InvBox
    procedure DropItemBox(i: Integer);
    begin
      GameTab(4);
      if ExistsItem(i) then
      begin
        MouseItemBox(i, False);
        Wait(50 + Random(100));
        if ChooseOption(x, y, 'Drop') then
          Wait(200 + Random(100));
      end;
    end;
    //By lorax with InvBox
    Procedure DropAllBox;
    begin
      for i:=1 to 28 do
        Dropitembox(i);
    end;
    //by sdcit made with invbox
    procedure DropTobox(x, y: Integer);
    var
      todr: Integer;
    begin
      for todr := x to y do
        DropItembox(todr)
    end;
    //By RSN with Invbox
    procedure DragItembox(inv1, inv2: Integer);
    var
      x, y: Integer;
    begin
      MMouseItemBox(Inv1);
      GetMousePos(x, y);
      HoldMouse(x, y, True);
      Wait(150 + Random(50));
      MMouseItembox(Inv2);
      GetMousePos(x, y);
      ReleaseMouse(x, y, True);
      Wait(100 + Random(100));
      MMouse(x, y, 2, 2)
    end;

    can someone explain what mod does because i discovered that that worked by accident and i would like to know what it actually does.

  2. #2
    Join Date
    May 2006
    Location
    Qld, Australia
    Posts
    223
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Mod = Remainder of a division sum.
    Eg. 5 Mod 2 Returns 1, 10 Mod 4 returns 2.

    Nice Functions btw, I like the idea of using DTM's incase you didnt know where an item is, although if there was more then 1 it might cause problems :P

    Also, Shouldnt it be if (col = 0) then not if (col < 0) then?
    And there shouldnt be a semicolon after and else statement or it will void it and the script will do whatever is after it anyway(I think)

    Actually, I really really really like the idea of TBoxes o_O Nice Job

    Oh, I didnt know there was ceil in Scar, is there Floor aswell?
    ^I feel stupid :P
    Woah theres div too
    Haven't scripted in a while, Willing to proofread, test and provide feedback.

  3. #3
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    So, I guess Mod divides by the highest divisible integer it can, and then returns the remainder?

    10 Mod 5 would return 0?
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  4. #4
    Join Date
    May 2006
    Posts
    1,230
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by SantaClause View Post
    So, I guess Mod divides by the highest divisible integer it can, and then returns the remainder?

    10 Mod 5 would return 0?
    yes. 10 mod 7 = 3, etc
    also, good work on the functions!

  5. #5
    Join Date
    Feb 2006
    Location
    Aussie
    Posts
    937
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    im pretty sure that(from the quick look i took) we have something similar.. Inventory.scar

  6. #6
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    nothing that uses a tbox the mmouseitem kind of does it but it uses a random(7) integer this clicks anywhere possible and i havnt got any feedback for like 4 days then in 1 day i get a bunch of feedback. yes i figured out what mod does.

  7. #7
    Join Date
    Feb 2006
    Location
    Aussie
    Posts
    937
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    kk, np. i havent really looked closely through srl since i got back.

  8. #8
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Good joob, useful functions.

  9. #9
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Thanks

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Inventory Empty
    By Cstrike in forum OSR Help
    Replies: 9
    Last Post: 10-14-2008, 10:54 PM
  2. Inventory Tbox
    By jhildy in forum Research & Development Lounge
    Replies: 8
    Last Post: 08-02-2007, 10:20 PM
  3. Inventory
    By 3Garrett3 in forum OSR Help
    Replies: 5
    Last Post: 03-18-2007, 01:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •