Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

58
LINES

< > BotCompany Repo | #1005750 // Find Start Button [execution, dev., v2]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (5123L/32K/109K).

1  
!752
2  
3  
concepts.
4  
5  
!include #1005686 // PIF Classes v2
6  
7  
static L<BWImage> images;
8  
static float similarity = 0.99f;
9  
10  
concept LastFound {
11  
  BWImage img;
12  
  Rect position;
13  
}
14  
15  
p {
16  
  concepts();
17  
  images = loadGoodClipsFrom("#1005676");
18  
  
19  
  while licensed {
20  
    step();
21  
    sleepSeconds(1);
22  
  }
23  
}
24  
25  
svoid step {
26  
  LastFound lf = latest(LastFound);
27  
  if (lf != null && verify(lf))
28  
    print("Verified!");
29  
  else {
30  
    deleteAll(LastFound);
31  
    fullSearch();
32  
    lf = latest(LastFound);
33  
    if (lf != null && verify(lf))
34  
      print("Verified!");
35  
    else
36  
      print("Not found.");
37  
  }
38  
}
39  
40  
svoid fullSearch {
41  
  print("Full search.");
42  
  BWImage big = new BWImage(shootScreen2());
43  
  for (BWImage pat : images)
44  
    for (FoundImg fi : bwRawImageSearch(big, pat, similarity)) {
45  
      cnew(LastFound, img := pat, position := fi.r);
46  
      print("Found.");
47  
      ret;
48  
    }
49  
}
50  
51  
sbool verify(LastFound lf) {
52  
  try {
53  
    ret bwImagesSimilar(new BWImage(shootScreen2(lf.position)), lf.img, similarity);
54  
  } catch e {
55  
    printShortException(e);
56  
    false;
57  
  }
58  
}

Author comment

Began life as a copy of #1005749

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005750
Snippet name: Find Start Button [execution, dev., v2]
Eternal ID of this version: #1005750/1
Text MD5: c733b229272239e49442d90c6a9837e1
Transpilation MD5: b3ff0692ce78d91aa1def70396ae5769
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-05 23:54:11
Source code size: 1096 bytes / 58 lines
Pitched / IR pitched: No / No
Views / Downloads: 526 / 602
Referenced in: [show references]