-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogHealthbarTags.php
48 lines (42 loc) · 990 Bytes
/
LogHealthbarTags.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$directory = "screenshots";
$screenshot_images = glob(__DIR__ . DIRECTORY_SEPARATOR . $directory . DIRECTORY_SEPARATOR . "*.HealthBar.jpg");
$output = '';
foreach($screenshot_images as $imgnum=>$image){
// Post data and determine values
if(isset($_POST["$imgnum-stim"])){
$stim = $_POST["$imgnum-stim"];
}
else{
$stim = -1;
}
if(isset($_POST["$imgnum-rad"])){
$rad = $_POST["$imgnum-rad"];
}
else{
$rad = -1;
}
// Generate states output e.g.:
// image.jpg -1 -1
// image.jpg -1 1
// image.jpg 1 -1
// image.jpg 1 1
$states = '';
if ($stim == '1'){
$states .= '1 ';
}
else{
$states .= '-1 ';
}
if($rad == '1'){
$states .= '1';
}
else{
$states .= '-1';
}
$output .= basename($image) . " $states" . PHP_EOL;
}
$file = fopen('HealthBar_Raw_States.txt', 'w');
fwrite($file, $output);
fclose($file);
echo "All Done!";