Results 1 to 11 of 11

Thread: boxtoint?

  1. #1
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default boxtoint?

    is there a way to convert a tbox to integers ie. x1, x2, y1, y2.

    I know that a box contains 2 points right? if so maybe there's a way to do point to integers as well ie. ex, es, yx, ys .

  2. #2
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Box.X1, Box.Y1, Box.X2, Box.Y2

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  3. #3
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    procedure Example;
    var
      B, b2: TBox;
    begin
      B := (IntToBox(100, 200, 300, 400));

      WriteLn(ToStr(B));
      WriteLn('B.X1 = ' + ToStr(B.X1));
      WriteLn('B.Y1 = ' + ToStr(B.Y1));
      WriteLn('B.X2 = ' + ToStr(B.X2));
      WriteLn('B.Y2 = ' + ToStr(B.Y2));

      b2 := (PointToBox(Point(000, 000), Point(111, 111)));

      WriteLn(ToStr(b2));
      WriteLn('b2.X1 = ' + ToStr(b2.X1));
      WriteLn('b2.Y1 = ' + ToStr(b2.Y1));
      WriteLn('b2.X2 = ' + ToStr(b2.X2));
      WriteLn('b2.Y2 = ' + ToStr(b2.Y2));
    end;

    Is that what you are looking for? Excuse my lazy standards, please.

  4. #4
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by RISK View Post
    Excuse my lazy standards, please.
    I don't see anything wrong with it?

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  5. #5
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    TBox is a type that actually contains 4 integers (that make up the 2 points):
    Quote Originally Posted by Dgby714 View Post
    Box.X1, Box.Y1, Box.X2, Box.Y2
    In a similar way, the TPoint type can be converted in the same way:
    Simba Code:
    Point.X, Point.Y

    If you give some more information on what you're trying to do, I can help you further!

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

  6. #6
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I figured I could have made it shorter by making a loop for the WriteLns.

    Quote Originally Posted by Dgby714 View Post
    I don't see anything wrong with it?

  7. #7
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    well there are many useful functions like intTobox, or pointToBox. but what about the other way around?

  8. #8
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    You just want the points of the box itself? Just use Box.X1, etc. Or what exactly are you trying to do?

  9. #9
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    im doing a whole lot but yes basically im searching a color and i did not have a way to make my box fit within the parameters ie. wrong variable type...

    so b.x1 you say?

    edit.
    i would need the box ie. box1:Tbox to fit within findcolor(1111,box1.x1,box1.x2,box1.y1,box1.y2) i would not know if box.x1 changes a Tbox to an integer.
    Last edited by m3gaman3g3nd; 01-13-2012 at 04:04 AM.

  10. #10
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    procedure Exampe;
    var
      X, Y: Integer;
      B: TBox;
    begin
      B := (IntToBox(100, 200, 300, 400));

      if (FindColor(X, Y, COLOR, B.X1, B.Y1, B.X2, B.Y2)) then
        WriteLn('Success.');
    end;

    How about like that? A TBox just holds 4 values to make a box. You can 'Grab' each of the values at any time you desire as long as you have the values declared. Like in the example script I have given you, you first declare the box's values and then you use the box's values in a FindColor() method. It's just 'Borrowing' the values from the TBox, really.

  11. #11
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    I appreciate your assistance and that is a prestige sample that clarifies everything, hail Hydra. Rep ++

    edit.
    ahhh but i see it must be x1 y1 x2 y2 or you get an error
    Last edited by m3gaman3g3nd; 01-13-2012 at 04:30 AM.

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
  •