Daily Do-es/Freebies

Discussion in 'Neopets Program Discussion' started by elmer282, Nov 1, 2006.

Thread Status:
Not open for further replies.
  1. elmer282

    elmer282 Newbie

    Joined:
    Nov 1, 2006
    Messages:
    12
    Likes Received:
    0
    maybe you can make a program that will do all of the daily routines like tombola, fruit machine, etc.
     
  2. expon

    expon Administrator
    Staff Member

    Joined:
    Oct 30, 2006
    Messages:
    1,393
    Likes Received:
    56
    Location:
    UK
    :)

    okay made a perl script which does exactly that :)

    It is:
    Perl - Daily Do-er
    in the download section.
    Does 7 important dailies at the moment and is easy to add to if you like.
     
  3. jiggerchy23

    jiggerchy23 Newbie

    Joined:
    Nov 3, 2006
    Messages:
    17
    Likes Received:
    0
    just wsh there was a a magic shop autobuyer though

    wed all be rich-er by now
     
  4. Milanos

    Milanos Level IV

    Joined:
    Nov 2, 2006
    Messages:
    1,771
    Likes Received:
    12
    Location:
    In your nose
    Re: :)

    How can I add things to it?
     
  5. lopsk8er

    lopsk8er Level III

    Joined:
    Nov 12, 2006
    Messages:
    493
    Likes Received:
    4
    Location:
    In my pocket.
    yeah cuz theres a lot mre good things that can be addewd
     
  6. expon

    expon Administrator
    Staff Member

    Joined:
    Oct 30, 2006
    Messages:
    1,393
    Likes Received:
    56
    Location:
    UK
    Re: :)

    well it takes to long to explain completely and it is fairly complicated if you've never done anything like it before, but if you open it up in notepad, you should see what needs to be done. The last daily is:

    Code (Text):
    1.  
    2. sub dailies7{
    3.     my $daily = 'Giant Jelly';
    4.     my $regex = qr{You take some (.*?)!};
    5.     my $regexAgain = qr{cannot take more than one jelly};
    6.     my $url = $baseurl . '/jelly/jelly.phtml';
    7.    
    8.     my $header = HTTP::Headers->new(
    9.         'Referer' => $baseurl . '/jelly/jelly.phtml?',
    10.         'Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
    11.         'Connection' => 'keep-alive',
    12.         "Content-Type" => 'application/x-www-form-urlencoded'); # only for c-shrine/jelly
    13.        
    14.     my $req = HTTP::Request->new(POST, $url, $header, 'type=get_jelly');
    15.     my $res = $ua->request($req);
    16.    
    17.     if ($res->is_success){
    18.             if ($res->content =~ m{$regex}i){
    19.                 print "$daily: Got jelly - $1\n";
    20.             } elsif ($res->content =~ m{$regexAgain}i){
    21.                 print "$daily: You have already taken jelly today.\n";
    22.             } else {
    23.                 print "$daily: Unknown?.\n";
    24.             }
    25.     } else {
    26.         print "Error with daily: $daily.\n";
    27.     }
    28. }
    29.  
    So to add a new one, you'd change everything which is bold:


    sub dailies7{ #you'd change this to 8, duh
    my $daily = 'Giant Jelly'; #change this to the name of the daily
    my $regex = qr{You take some (.*?)!}; #make regexes for each thing, after it has done the daily. For example if you were doing one for coltzans shrine, it might say, "your neopet has become stronger", or something in the HTML of the page. So you'd make a regex my $regex = qr{your neopet has become stronger}
    my $regexAgain = qr{cannot take more than one jelly};
    my $url = $baseurl . '/jelly/jelly.phtml'; #change this to whatever is the URL which we are GOING to, (ie AFTER you've clicked the button for whatever daily), this $url should hold whatever comes AFTER 'www.neopets.com'

    my $header = HTTP::Headers->new(
    'Referer' => $baseurl . '/jelly/jelly.phtml?', #you might need to use a packet sniffer to find out what the referal header should be (look for a 'packet sniffer download' on google.
    'Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
    'Connection' => 'keep-alive',
    "Content-Type" => 'application/x-www-form-urlencoded'); # only for c-shrine/jelly #this isn't usually necessary, only use this if you detect (using a packet sniffer) that it needs to send this content-type header.

    my $req = HTTP::Request->new(POST, $url, $header, 'type=get_jelly'); #the 'type=get_jelly' is the content which is sent. Once again you can detect this with the packet sniffer, but often you won't need to send anything, as you only need this if you needed the 'content-type' header earlier.
    my $res = $ua->request($req);

    if ($res->is_success){
    if ($res->content =~ m{$regex}i){
    print "$daily: Got jelly - $1\n";
    } elsif ($res->content =~ m{$regexAgain}i){
    print "$daily: You have already taken jelly today.\n";
    } else {
    print "$daily: Unknown?.\n";
    }
    } else {
    print "Error with daily: $daily.\n";
    }
    }


    you'd also need to add to the 7th daily this line:

    &dailies2;

    at the end of the
    if ($res->is_success){



    --

    something tells me i wasted my time 'trying' to explain that because I don't think anyones gonna bother to try ;/
     
  7. Milanos

    Milanos Level IV

    Joined:
    Nov 2, 2006
    Messages:
    1,771
    Likes Received:
    12
    Location:
    In your nose
    Expon I'm trying it I'm trying to add the omelet thing. Lol I tried it but now when I try to open the daily doer it even doesn't popup :p So I just change everything back
     
Thread Status:
Not open for further replies.