 |

10-25-2011, 06:30 PM
|
|
Newcomer
|
|
Join Date: Oct 2011
Posts: 2
|
|
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.
Last edited by nghtspud : 10-25-2011 at 10:53 PM.
|

10-25-2011, 09:37 PM
|
 |
Guru
|
|
Join Date: Dec 2007
Posts: 1,339
|
|
Re: Pokemon Tower Defence script
i'd check it out but i can't load the game 0_o
|

10-25-2011, 10:31 PM
|
|
Newcomer
|
|
Join Date: Oct 2011
Posts: 2
|
|
Re: 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.
Last edited by nghtspud : 10-25-2011 at 10:55 PM.
|

11-02-2011, 06:23 AM
|
 |
Apprentice
|
|
Join Date: Jun 2010
Location: GE
Posts: 988
|
|
Re: 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.
Last edited by ashieldlol : 11-02-2011 at 06:23 AM.
|

11-03-2011, 12:58 AM
|
|
Active Member
|
|
Join Date: Jul 2005
Location: Belgium
Posts: 149
|
|
Re: Pokemon Tower Defence script
Heh, nice to see people still use SCAR to beat those addicting flash games 
|

11-23-2011, 11:56 AM
|
|
Member
|
|
Join Date: Aug 2010
Posts: 30
|
|
Re: Pokemon Tower Defence script
Is the shiny glitch fixed yet? I might try this if it works.
|
 |
|