Results 1 to 11 of 11

Thread: InvBox

  1. #1
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default InvBox

    Simba Code:
    procedure CheckInventory;
    var
      i,p,tmpCTS:Integer;
      Box:TBox;
      foodCount,x,y:Integer;
    begin
      ToIni('Checking for food in inventory');
      tmpCTS := GetColorToleranceSpeed;
      for i := 1 to 28 do
      begin
        for p := 0 to 2 do
        begin
          SetColorspeed2Modifiers(Foods[p].HMod,Foods[p].SMod);
          Box := InvBox(i);
          if FindColor(x,y,Foods[p].Color,Box.X1,Box.Y1,Box.X2,Box.Y2) then
          begin
            foodCount := foodCount + 1;
            ToIni('Food found in slot ' + IntToStr(i));
          end;
        end;
      end;


    How exactly does "InvBox" work? Does it convert the slot in the parameters into a box? Not too clear on it. If it doesn't... I'll just have to write a new one.

    Not the complete procedure btw.

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

    Default

    Yeah it returns the TBox of the inv slot. Do you have anything else other than
    Simba Code:
    ToIni('Checking for food in inventory');
      tmpCTS := GetColorToleranceSpeed;
    before your for loop?

  3. #3
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Yeah it returns the TBox of the inv slot.

    Do you have anything else other than
    Simba Code:
    ToIni('Checking for food in inventory');
      tmpCTS := GetColorToleranceSpeed;
    before your for loop?
    Alright thanks!
    And no, I don't.

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

    Default

    I think the problem is that you didn't set it to CTS 2 then.

  5. #5
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    I think the problem is that you didn't set it to CTS 2 then.
    Ah I derped on that one xD
    I haven't actually tested it yet, I wrote it when I didn't have access to the internet.
    Thanks again!

  6. #6
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    I think the problem is that you didn't set it to CTS 2 then.
    Indeed. Also, remember to set your CTS back to 1 upon exiting the procedure.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  7. #7
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Indeed. Also, remember to set your CTS back to 1 upon exiting the procedure.
    Yup, did that
    Simba Code:
    SetColorToleranceSpeed(tmpCTS);

    Just kinda forgot it that once haha.

  8. #8
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Edit button not working?
    Well i'll post this and ask a mod to merge it.

    Anyways, anyone know what happened to PosInArray? I can't seem to find it

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

    Default

    Quote Originally Posted by Shay View Post
    Edit button not working?
    Well i'll post this and ask a mod to merge it.

    Anyways, anyone know what happened to PosInArray? I can't seem to find it
    What is that meant to do? Or are you looking for StrInArr?

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

    Default

    Quote Originally Posted by riwu View Post
    What is that meant to do? Or are you looking for StrInArr?
    Once upon a time PosInArray returned the position of a variable in an array. One day it magically disappered along with one of the most useful functions ever, BoolToInt.

  11. #11
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(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
  •