Results 1 to 7 of 7

Thread: A new ChooseOption :p

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

    Default A new ChooseOption :p

    SCAR Code:
    Function ChooseOptionEx(Text: String; Color: Integer; Action: ActionOptions): Boolean;

    Var
       dtm_Top, dtm_Bottom, tx, ty, bx, by: Integer;
       TPA: TPointArray;
       Txt: String;
       BB: TBox;
       
    Begin

      dtm_Top := DTMFromString('78DA632C626460606662C006186134480D2B1' +
           '16A7889502342404D1511EE6920424D2F613500F96003A5');
           
      dtm_Bottom := DTMFromString('78DA63F46162600800622C80114683D47812A' +
           '1C68E801A5722ECB224428D2E613500B821037B');
           
      FindColorsTolerance(TPA, 0, MSX1, MSY1, MSX2, MSY2, 0);
      BB := GetTPABounds(TPA);
      Txt := GetTextAtEx(BB.x1 + 2, BB.y1 + 1, 9, UpChars, False, False,
      0, 0, 4674653, 14, False, tr_Letters);
      If LowerCase(Trim(Txt)) = 'choose option' Then
      Begin
        If FindDTM(dtm_Top, tx, ty, MSX1, MSY1, MSX2, MSY2) Then
          If FindDTM(dtm_Bottom, bx, by, tx, ty, MSX2, MSY2) Then
          Begin
            FindColorsTolerance(TPA, 4674653, tx, ty, bx, by, 0);
            BB := GetTPABounds(TPA);
            Result := FindTextTPA(Color, 0, BB.x1, BB.y1, BB.x2, BB.y2, Text, UpChars, Action);
          End;
      End;
      FreeDTM(dtm_Top);
      FreeDTM(dtm_Bottom);
     
    End;

    Needs the ActionOptions type in Text.scar, tested, worked.

  2. #2
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    This is excellent! Rep++ for you

    This will probably come in very useful with ent detection because when its an ent the writing turns to yellow instead of blue.

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

    Default

    Hehe, thanks, coming to think of it, yes, just doing like

    Result := ChooseOptionEx(...) is shorter than moving the mouse on the tree, checking uptext and then right click etc or so.



    I took a new look at the Rev 15 one, it actually owns, but well... It doesn't have color! Mwuahaha!

  4. #4
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Lols.

    If they didn't introduce this into the next rev, would you mind if I used it and credited you for it? Cos I might make a woodcutter after my current project

  5. #5
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    But option's can have different colors.. x)
    Verrekte Koekwous

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by Dude Richard View Post
    Lols.

    If they didn't introduce this into the next rev, would you mind if I used it and credited you for it? Cos I might make a woodcutter after my current project
    I don't see why you need chooseoption to return a color if you check for the uptext first?
    Just do a quick findcolortolerance before your chooseoption, and see if you find a yellow color... (For the ent)



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

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

    Default

    Well there it's really a discussion wether to be safe or safer, if you check uptext with findcolortolerance there is a chance someone said something in cyan or for yellow in normal.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Chooseoption help
    By Brianb in forum OSR Help
    Replies: 37
    Last Post: 08-27-2008, 07:30 PM
  2. ChooseOption
    By Harry in forum OSR Help
    Replies: 12
    Last Post: 03-03-2008, 04:20 AM
  3. Hwo to use ChooseOption
    By PwNZoRNooB in forum OSR Help
    Replies: 3
    Last Post: 04-29-2007, 09:22 PM

Posting Permissions

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