Pokemon Tower Defence script

Discussion in 'Scar/Simba Help' started by nghtspud, Oct 25, 2011.

Pokemon Tower Defence script
  1. Unread #1 - Oct 25, 2011 at 1:30 PM
  2. nghtspud
    Joined:
    Oct 25, 2011
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    nghtspud Newcomer

    Pokemon Tower Defence script

    Okay, I've written a script for PTD based at http://www.newgrounds.com/portal/view/566150.
    It just repeats route 8 (takes a while to reach but has pretty fast levelling potential), levels pokemon and should catch any shine pokemon to appear.
    Unfortunately it seems to crash every time the shiny procedure gets called. I've looked through the script and can't see any problem that would scar to crash completly.

    A few other side notes, I use ubuntu and so have to run it through WINE, this has also meant that I've had to set the window myself, hence the TLx and TLy constants that you need to set yourself.

    Anyway, any suggestions, and any idea why it crashes, also does it crash for anyone else who doesn't run it in linux?

    If you want me to edit the code a bit to make it clearer just ask (I'll indent it and add a few more notes and stuff...)

    Code:
    program PTDroute8;
    var
    x,y, fin,a,d,c, lvl,levels, finishes, caught : Integer ;
    one,two,three,four,five,six : Integer;
    
    const
    TLx =   113;     // choose the very top left corner, it must be the exact pixel.
    TLy =   113;
    ///////////////////////////////////////////////////////////////////////////////
    procedure start ;
    begin
         Movemousesmooth ((TLx + 548), (TLy + 129));
         wait (100)
         clickmouse((TLx + 548), (TLy + 129),true)      //select route 8
         wait(500)
         Movemousesmooth (TLx + 626, TLy + 21);
         wait (100)
         clickmouse(TLx + 626, TLy + 21,true)          //select start
         wait(500)
         Movemousesmooth (TLx + 126, TLy + 18);
         wait (100)
         clickmouse(TLx + 126, TLy + 18,true)         //select skip
         wait (3000)
    end;
    //////// GO!!!!!!
    ///////////////////////////////////////////////////////////////////////////////
    procedure chooserandpoke;
    begin
         repeat
         d:= random (6)
             if (d=0) and (one <> 1) then  begin       // choose 1
                x:= (TLx + 167)
                y:= (TLy + 291)
                one :=1
                c:=1
             end;
             if (d=1) and (two <> 1)  then begin      //choose 2
                x:= (TLx + 247)
                y:= (TLy + 291)
                two :=1
                c:=1
             end;
             if (d=2) and (three <> 1)  then begin   //choose 3
                x:= (TLx + 329)
                y:= (TLy + 297)
                three :=1
                c:=1
             end;
             if (d=3) and (four <> 1)  then begin   //choose 4
                x:= (TLx + 413)
                y:= (TLy + 298)
                four :=1
                c:=1
             end;
             if (d=4) and (five <> 1)  then begin   //choose 5
                x:= (TLx + 501)
                y:= (TLy + 298)
                five :=1
                c:=1
             end;
             if (d=5) and (six <> 1)  then begin   //choose 6
                x:= (TLx + 583)
                y:= (TLy + 298)
                six :=1
                c:=1
             end;
         until (c = 1)
         c:=0
    end;
    procedure placepokemon ;
    begin
         chooserandpoke;
         movemousesmooth (x, y)
         wait(100)
         holdmouse (x, y,true) //Pokemon 1
         wait (300)
         movemousesmooth (TLx + 340, TLy + 316)
         wait(100)
         releasemouse (TLx + 340, TLy + 316,true)
         wait (500)
    ///////////////////
         chooserandpoke;
         movemousesmooth (x, y)
         wait(100)
         holdmouse (x, y,true) //Pokemon 2
         wait (300)
         movemousesmooth (TLx + 663,TLy + 290)
         wait(100)
         releasemouse (TLx + 663,TLy + 290,true)
         wait (500)
    ///////////////////
         movemousesmooth (TLx + 623,TLy + 298)
         wait(100)
         holdmouse (TLx + 623,TLy + 298,true)  //Move screen right
         wait (300)
         movemousesmooth (TLx + 127,TLy + 288)
         wait(100)
         releasemouse (TLx + 127,TLy + 288,true)
         wait (500)
    ///////////////////
         chooserandpoke;
         movemousesmooth (x, y)
         wait(100)
         holdmouse (x, y,true)  //Pokemon 3
         wait (300)
         movemousesmooth (TLx + 445,TLy + 289)
         wait(100)
         releasemouse (TLx + 445,TLy + 289,true)
         wait (500)
    ///////////////////
         chooserandpoke;
         movemousesmooth (x, y)
         wait(100)
         holdmouse (x, y,true)  //Pokemon 4
         wait (300)
         movemousesmooth (TLx + 677,TLy + 338)
         wait(100)
         releasemouse (TLx + 677,TLy + 338,true)
         wait (500)
    ///////////////////
         movemousesmooth (TLx + 639,TLy + 393)
         wait(100)
         holdmouse (TLx + 639,TLy + 393,true)  //Move Down
         wait (300)
         movemousesmooth (TLx + 637,TLy + 11)
         wait(100)
         releasemouse (TLx + 637,TLy + 11,true)
         wait (500)
    ///////////////////
         chooserandpoke;
         movemousesmooth (x, y)
         wait(100)
         holdmouse (x, y,true)  //Pokemon 5
         wait (300)
         movemousesmooth (TLx + 501,TLy + 80)
         wait(100)
         releasemouse (TLx + 501,TLy + 80,true)
         wait (500)
    ///////////////////
         chooserandpoke;
         movemousesmooth (x, y)
         wait(100)
         holdmouse (x, y,true)  //Pokemon 6
         wait (300)
         movemousesmooth (TLx + 664,TLy + 235)
         wait(100)
         releasemouse (TLx + 664,TLy + 235,true)
         wait (500)
    end;
    ///////////////////////////////////////////////////////////////////////////////
    procedure movetoBL;
    begin
         a :=1;                                                    //drag screen down
         repeat
               wait (200)
               movemousesmooth (TLx + 460,TLy + 208)
               wait(100)
               holdmouse (TLx + 460,TLy + 208,true)
               wait (300)
               movemousesmooth (TLx + 24,TLy + 16)
               wait(100)
               releasemouse (TLx + 24,TLy + 16,true)
               a:= a + 1;
         until (a=5)
         a:=1
    end;
    ///////////////////////////////////////////////////////////////////////////////
    procedure speedup;
    begin
         movemousesmooth (TLx + 124,TLy + 380)    //speed up
         wait (200)
         clickmouse(TLx + 124,TLy + 380,true)
         wait(100)
         clickmouse(TLx + 124,TLy + 380,true)
         wait(100)
         clickmouse(TLx + 124,TLy + 380,true)
         wait(100)
    end;
    
    ///////////////////////////////////////////////////////////////////////////////
    procedure finish;
    begin
         finishes := finishes + 1
         movemousesmooth (x,y);                     //click skip at end
         clickmouse (x,y,true);
         writeln ('completed  ' + (inttostr(finishes)) + ' rounds!')
         one:=0
         two:=0
         three:=0
         four:=0
         five:=0
         six:=0
    end;
    ///////////////////////////////////////////////////////////////////////////////
    procedure shiny;
    begin
         movemousesmooth (TLx + 677, TLy + 340)               //click pokeball
         clickmouse (TLx + 677, TLy + 340,true);
         wait (100)
         holdmouse (TLx + 677, TLy + 340,true)                //drag pokeball
         wait (300)
         movemousesmooth (TLx + 604, TLy + 222)
         wait(1000)
         releasemouse (TLx + 604, TLy + 222,true)             //catch pokemon
         if findcolor (x,y,0,TLx + 540, TLy + 231,TLx + 395, TLy + 412) then caught:= caught+1; //check if anything got caught
         writeln ('caught ' + (Inttostr(caught)) + ' pokemon')
         clickmouse (x,y,true)                         //click off shiny
         speedup;
    end;
    
    ///////////////////////////////////////////////////////////////////////////////
    procedure levelup;
    begin
         levels := levels + 1;
         writeln ('levelling up!')
         writeln ('Gained ' + (inttostr (levels)) + ' levels!')
         movemousesmooth (x,y)                          //click pokemon
         clickmouse (x,y,true)
         wait (300)
         movemousesmooth (TLx + 621,TLy + 204)
         wait (300)
         clickmouse (TLx + 621,TLy + 204,true)          //click level up
         wait(700)
         if(FindColor(x,y,0,TLx +  477,TLy + 249,TLx + 490,TLy + 259)) = true then
                  begin
                       movemousesmooth (x,y)
                       wait (300)                      //click don't learn move
                       clickmouse (x,y,true)
                       wait(300)
                  end;
         movemousesmooth (TLx + 477,TLy + 249)        //mouse back to center screen
         wait (300)
         clickmouse (TLx + 477,TLy + 249,true)
         wait(300)
         movetoBL;
    end;
    ///////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////
    begin
         Levels := 0;
         finishes :=0
         repeat
               fin :=0;
               start;
               placepokemon;
               speedup;
               movetoBL;
               repeat
                     repeat
                           if (FindColor(x,y,251,TLx +  128,TLy + 270,TLx + 621,TLy + 290)) = true then levelup;
                           if findcolor (x,y,16777215,TLx + 395,TLy + 154, TLx + 396, TLy + 171) then shiny;
                           lvl := lvl +1;
                           wait (100)
                     until (lvl = 20)
                     lvl:=1;
                     if (FindColor(x,y,238, TLx + 77,TLy + 10,TLx + 138,TLy + 40)) = true then fin:=1;
                     if (FindColor(x,y,238, TLx + 77,TLy + 10,TLx + 138,TLy + 40)) = true then finish;
                     wait (1000)
               until (fin = 1)
         until (false);
         writeln ('caught ' + (inttostr (caught)) + ' pokemon')
         writeln ('gained ' + (inttostr (levels)) + ' levels')
    end.
     
  3. Unread #2 - Oct 25, 2011 at 4:37 PM
  4. M_A_I_N_FTW
    Joined:
    Dec 22, 2007
    Posts:
    1,336
    Referrals:
    1
    Sythe Gold:
    0

    M_A_I_N_FTW Guru

    Pokemon Tower Defence script

    i'd check it out but i can't load the game 0_o
     
  5. Unread #3 - Oct 25, 2011 at 5:31 PM
  6. nghtspud
    Joined:
    Oct 25, 2011
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    nghtspud Newcomer

    Pokemon Tower Defence script

    did you try ctrl F5 to refresh the page etc? There are other places you can play but the resolution of the screen is slightly different at each place so none of the co-ords would be right...
    http://samdangames.blogspot.com/p/play-ptd_03.html

    Just edited first post to give a slightly clearer view of the code.
     
  7. Unread #4 - Nov 2, 2011 at 2:23 AM
  8. ashieldlol
    Joined:
    Jun 5, 2010
    Posts:
    1,017
    Referrals:
    2
    Sythe Gold:
    0

    ashieldlol Guru
    $5 USD Donor

    Pokemon Tower Defence script

    Cool man, I've been playing this from time to time for the past couple months. I was wondering if anyone had written scripts for it yet. I might try this out if I get a chance.
     
  9. Unread #5 - Nov 2, 2011 at 8:58 PM
  10. freddy1990
    Joined:
    Jul 1, 2005
    Posts:
    149
    Referrals:
    1
    Sythe Gold:
    0

    freddy1990 Active Member

    Pokemon Tower Defence script

    Heh, nice to see people still use SCAR to beat those addicting flash games :p
     
  11. Unread #6 - Nov 23, 2011 at 6:56 AM
  12. Clumsy One
    Joined:
    Aug 27, 2010
    Posts:
    30
    Referrals:
    0
    Sythe Gold:
    0

    Clumsy One Member
    Banned

    Pokemon Tower Defence script

    Is the shiny glitch fixed yet? I might try this if it works.
     
< All Scripts are not working in this site | >

Users viewing this thread
1 guest


 
 
Adblock breaks this site