Thread Problem mit WWW::Mechanize: oder was anderem ;) (18 answers)
Opened by FlorianL at 2007-06-30 21:35

FlorianL
 2007-07-02 16:37
#37591 #37591
User since
2007-05-18
142 Artikel
BenutzerIn
[default_avatar]
Code (perl): (dl )
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
sub heal {
        my $pro = shift;
        $agent->get("http://$url/index.php?act=atkshop");
        my ($money) = $agent->content =~ m/Euro:<\/strong> (\d+(?:,\d+)?)/;
        my ($s_potions) = $agent->content =~ m/.+>War Pills \((\d+)\)</;
        print("Money: $money \| Small Potions: $s_potions\n");
        if ($pro == '50') {
               
 print("Got 50 percent\n");
               
 if ($s_potions > 1) {
               
         print gettime(), "Using small Potion\n";
               
         $agent->get("http://$url/index.php?act=atkshop&do=use&item=1");
               
 } elsif (($s_potions == 0) and ($money > 125)) {
               
         print gettime(), "Buying small Potion\n";
               
         $agent->get("http://$url/index.php?act=atkshop&do=buy&item=1");
               
         print gettime(), "Using small Potion\n";
               
         $agent->get("http://$url/index.php?act=atkshop&do=use&item=1");
               
 } elsif (($s_potions == 0) and ($money < 125)) {
               
         print gettime(), "No Money, No Potions, sleeping...\n";
               
         goto SLEEP;
               
 }
        } elsif ($pro == '25') {
               
         print("Got 25 percent\n");
               
         if ($s_potions > 1) {
               
         print gettime(), "Using small Potion\n";
               
         $agent->get("http://$url/index.php?act=atkshop&do=use&item=1");
               
 } elsif (($s_potions == 0) and ($money > 125)) {
               
         print gettime(), "Buying small Potion\n";
               
         $agent->get("http://$url/index.php?act=atkshop&do=buy&item=1");
               
         print gettime(), "Using small Potion\n";
               
         $agent->get("http://$url/index.php?act=atkshop&do=use&item=1");
               
 } elsif (($s_potions == 0) and ($money < 125)) {
               
         print gettime(), "No Money, No Potions, sleeping...\n";
               
         goto SLEEP;
               
 }
        }
}


wird das mit dem matchen so funktionieren? ich habe im kopf das ich das samstag nacht mal probiert habe, aber andauernd 0 rauskam?!

ach, ist jetz auch blöd so ohne testen... ich schau's mir heut nachmittag nochma an wenn der server wieder erreichbar ist..

View full thread Problem mit WWW::Mechanize: oder was anderem ;)