I know it’s monstruous but could someone scan through it and tell me what’s wrong with it?
The if(timeout) part runs only once.
[CODE]// Graal2002 NPC by 2ndwolf
if (playerenters) {
// Initialize the attributes
showcharacter;
setcharprop #3,head118.gif;
setcharprop #C0,orange;
setcharprop #C1,white;
setcharprop #C2,blue;
setcharprop #C3,red;
setcharprop #C4,black;
setcharprop #2,no-shield.gif;
shieldpower = 1;
dir = 2;
}
if(playertouchsme&&johncandance){
say2 Thanks to you,#ball the girls fall for me.;
}
else if(playertouchsme&&this.talked==1){
say2 Alright!#b#b#b(A DDR like game will#bhappen on your screen, the goal#bis the same as regular DDR,#bpress the right keys#bonce the flashing arrows#balign with the ones on top)#bYou need a score of 8500#bor more.#bIf you fail, talk again to John,#bwho is beside you,#bto start again.);
this.talked = 2;
}
else if(playertouchsme&&seekingasteriskiancurrency){
say2 Alright, I’ll give you some#bAsteriskian currency if you teach#bme how to dance#bspeak to me again if you’re#bwilling.;
this.talked = 1;
}
else if(playertouchsme){
say2 Coin collecting is my hobby,#bwant to see some samples?;
}
if(playerendsreading&&this.talked==2){
freezeplayer2;
set dancingwithjohn;
callnpc testnpc(10,31),actionstartddr,;
this.talked = 0;
play metronome_155.mid;
//Heights that give points
this.nodetectheight = 0;
this.grayarrowsheight = 50;
this.perfectheight = 10;
this.goodheight = 20;
this.almostheight = 30;
//Points given
this.perfectpoints = 100;
this.goodpoints = 50;
this.almostpoints = 10;
//Arrow IDs
this.highestuparrowid = 0;
this.highestleftarrowid = 0;
this.highestdownarrowid = 0;
this.highestrightarrowid = 0;
//this. inits
this.key = {0,0,0,0,0,0,0,0,0}
this.speed = 12;
this.latestb = 10000;
this.originx = 20;
this.spacer = 10;
this.arrowwidth = 50;
this.encouragmentcoordinates = {100,300}
this.e = 0;
for(this.z=0;this.z<4;this.z++){
showimg 9000+this.z,ddrarrowsgray.gif,this.originx+(this.spacer+this.arrowwidth)*this.z,this.grayarrowsheight;
changeimgvis 9000+this.z,4;
}
changeimgpart 9000,0,50,50,50;
changeimgpart 9001,50,50,50,50;
changeimgpart 9002,50,0,50,50;
changeimgpart 9003,0,0,50,50;
sleep 2.9;
play unowenwasher.mid;
this.arrows = {950.666667 ,0,
1014.22222 ,0,
1072.88889 ,0,
1422.44444 ,0,
1481.11111 ,0,
1547.11111 ,0,
1894.22222 ,0,
1955.33333 ,0,
2021.33333 ,0,
2368.44444 ,0,
2429.55556 ,0,
2495.55556 ,0,
2842.66667 ,0,
2906.22222 ,0,
2964.88889 ,0,
3314.44444 ,0,
3378 ,0,
3441.55556 ,0,
3688.66667 ,0,
3752.22222 ,0,
3813.33333 ,0,
4160.44444 ,0,
4224 ,0,
4287.55556 ,0,
4351.11111 ,1,
4444 ,3,
4539.33333 ,1,
4634.66667 ,3,
4727.55556 ,0,
4822.88889 ,1,
4918.22222 ,3,
5011.11111 ,0,
5108.88889 ,1,
5201.77778 ,3,
5299.55556 ,1,
5397.33333 ,3,
5492.66667 ,0,
5583.11111 ,1,
5680.88889 ,2,
5869.11111 ,1,
5964.44444 ,3,
6057.33333 ,1,
6150.22222 ,2,
6245.55556 ,0,
6340.88889 ,1,
6433.77778 ,3,
6526.66667 ,0,
6624.44444 ,1,
6717.33333 ,3,
6810.22222 ,1,
6903.11111 ,3,
7003.33333 ,0,
7096.22222 ,1,
7201.33333 ,2,
7382.22222 ,1,
7382.22222 ,3,
7472.66667 ,0,
7570.44444 ,1,
7570.44444 ,3,
7663.33333 ,0,
7756.22222 ,1,
7756.22222 ,3,
7854 ,1,
7898 ,3,
7949.33333 ,2,
8047.11111 ,0,
8135.11111 ,0,
8323.33333 ,1,
8323.33333 ,3,
8516.44444 ,2,
8892.88889 ,1,
8892.88889 ,3,
8985.77778 ,0,
9083.55556 ,1,
9083.55556 ,3,
9178.88889 ,0,
9274.22222 ,1,
9274.22222 ,3,
9367.11111 ,1,
9416 ,3,
9462.44444 ,2,
9555.33333 ,0,
9653.11111 ,3,
9838.88889 ,2,
10029.5556 ,1,
10410.8889 ,1,
10410.8889 ,3,
10503.7778 ,0,
10599.1111 ,1,
10599.1111 ,3,
10694.4444 ,0,
10789.7778 ,1,
10789.7778 ,3,
10882.6667 ,1,
10926.6667 ,3,
10978 ,2,
11070.8889 ,0,
11166.2222 ,3,
11354.4444 ,2,
11545.1111 ,1,
11924 ,1,
11924 ,3,
12016.8889 ,0,
12112.2222 ,1,
12112.2222 ,3,
12207.5556 ,0,
12300.4444 ,1,
12300.4444 ,3,
12398.2222 ,1,
12442.2222 ,3,
12491.1111 ,2,
12584 ,0,
12679.3333 ,3,
12867.5556 ,2,
13058.2222 ,1,
13437.1111 ,2,
13532.4444 ,1,
13627.7778 ,3,
13728 ,1,
13825.7778 ,3,
13952.8889 ,1,
14080 ,3,
14214.4444 ,0,
14608 ,0,
14608 ,2,
14903.7778 ,2,
15028.4444 ,1,
15028.4444 ,3,
15197.1111 ,1,
15197.1111 ,3,
15385.3333 ,1,
15385.3333 ,3,
15580.8889 ,1,
15580.8889 ,3,
15774 ,0,
15774 ,2,
15964.6667 ,0,
15964.6667 ,2,
16162.6667 ,0,
16162.6667 ,2,
16350.8889 ,0,
16350.8889 ,2,
16544 ,0,
16671.1111 ,1,
16734.6667 ,0,
16932.6667 ,0,
17120.8889 ,0,
17016.4444 ,3,
17209.5556 ,3,
17158.2222 ,3,
17593.3333 ,1,
17593.3333 ,3,
17666.6667 ,1,
17666.6667 ,3,
17740 ,1,
17740 ,3,
17788.8889 ,1,
17979.5556 ,3,
18167.7778 ,0,
18356 ,1,
18546.6667 ,2,
18595.5556 ,1,
18683.5556 ,1,
18774 ,2,
18874.2222 ,2,
18923.1111 ,2,
18972 ,0,
19064.8889 ,0,
19157.7778 ,3,
19258 ,3,
19348.4444 ,1,
19443.7778 ,1,
19541.5556 ,2,
19632 ,2,
19727.3333 ,0,
19822.6667 ,0,
19918 ,1,
20010.8889 ,1,
20106.2222 ,3,
20199.1111 ,3,
20294.4444 ,2,
20392.2222 ,2,
20485.1111 ,0,
20578 ,0,
20673.3333 ,0,
20673.3333 ,1,
20768.6667 ,3,
20768.6667 ,2,
20815.1111 ,1,
20864 ,0,
20912.8889 ,3,
20956.8889 ,0,
21005.7778 ,1,
21054.6667 ,0,
21101.1111 ,3,
21147.5556 ,0,
21194 ,0,
21242.8889 ,0,
21289.3333 ,1,
21335.7778 ,0,
21382.2222 ,3,
21433.5556 ,2,
21480 ,0,
21526.4444 ,2,
21572.8889 ,1,
21616.8889 ,2,
21668.2222 ,1,
21714.6667 ,2,
21763.5556 ,3,
21807.5556 ,2,
21856.4444 ,1,
21905.3333 ,2,
21951.7778 ,0,
22000.6667 ,2,
22047.1111 ,1,
22091.1111 ,0,
22140 ,2,
22188.8889 ,0,
22281.7778 ,2,
22330.6667 ,1,
22377.1111 ,0,
22423.5556 ,3,
22472.4444 ,2,
22521.3333 ,1,
22567.7778 ,0,
22614.2222 ,3,
22660.6667 ,2,
22709.5556 ,1,
22753.5556 ,0,
22802.4444 ,1,
22848.8889 ,2,
22897.7778 ,3,
22944.2222 ,0,
22990.6667 ,1,
23039.5556 ,2,
23086 ,3,
23134.8889 ,0,
23181.3333 ,1,
23227.7778 ,2,
23274.2222 ,3,
23323.1111 ,0,
23369.5556 ,1,
23416 ,2,
23464.8889 ,0,
23560.2222 ,1,
23655.5556 ,2
};
timeout = .05;
}
if(timeout&&dancingwithjohn){
this.timeouts += 1;
freezeplayer2;
incrementKeys();
for(this.i=0;this.i<(arraylen(this.arrows)/2);this.i++){
this.arrows[this.i*2] -= this.speed;
if(this.arrows[this.i*2]<0){
this.arrowstartingpoint +=1;
}
if(this.arrows[this.i*2] in |0,600|){
this.arrowstobedrawn += 1;
}
//detection of the next arrow that needs to be pressed
if(this.arrows[this.i*2+1]==0){
if(this.arrows[this.i*2]>this.nodetectheight){
if(this.arrows[this.i*2]<this.highestuparrowheight){
this.highestuparrowheight = this.arrows[this.i*2];
this.highestuparrowid = this.i;
}
}
}
if(this.arrows[this.i*2+1]==1){
if(this.arrows[this.i*2]>this.nodetectheight){
if(this.arrows[this.i*2]<this.highestleftarrowheight){
this.highestleftarrowheight = this.arrows[this.i*2];
this.highestleftarrowid = this.i;
}
}
}
if(this.arrows[this.i*2+1]==2){
if(this.arrows[this.i*2]>this.nodetectheight){
if(this.arrows[this.i*2]<this.highestdownarrowheight){
this.highestdownarrowheight = this.arrows[this.i*2];
this.highestdownarrowid = this.i;
}
}
}
if(this.arrows[this.i*2+1]==3){
if(this.arrows[this.i*2]>this.nodetectheight){
if(this.arrows[this.i*2]<this.highestrightarrowheight){
this.highestrightparrowheight = this.arrows[this.i*2];
this.highestrightarrowid = this.i;
}
}
}
}
//drawing the arrows
hideimgs this.latestb-(this.oldarrowstartingpoint+this.oldarrowstobedrawn),this.latestb;
for(this.b=this.latestb;this.b<this.arrowstobedrawn+this.latestb+this.arrowstartingpoint;this.b++){
if(this.b-this.latestb in |this.arrowstartingpoint,this.arrowstartingpoint+this.arrowstobedrawn|){
if(this.arrows[(this.b-this.latestb)*2+1]==0){
showimg this.b,ddrarrows.gif,this.originx,this.arrows[(this.b-this.latestb)*2];
changeimgpart this.b,0,50,50,50;
changeimgvis this.b,6;
}
if(this.arrows[(this.b-this.latestb)*2+1]==1){
showimg this.b,ddrarrows.gif,this.originx+(this.spacer+this.arrowwidth)*1,this.arrows[(this.b-this.latestb)*2];
changeimgpart this.b,50,50,50,50;
changeimgvis this.b,6;
}
if(this.arrows[(this.b-this.latestb)*2+1]==2){
showimg this.b,ddrarrows.gif,this.originx+(this.spacer+this.arrowwidth)*2,this.arrows[(this.b-this.latestb)*2];
changeimgpart this.b,50,0,50,50;
changeimgvis this.b,6;
}
if(this.arrows[(this.b-this.latestb)*2+1]==3){
showimg this.b,ddrarrows.gif,this.originx+(this.spacer+this.arrowwidth)*3,this.arrows[(this.b-this.latestb)*2];
changeimgpart this.b,0,0,50,50;
changeimgvis this.b,6;
}
}
}
//saving the latest this.b value;
this.latestb = this.b;
this.oldarrowstobedrawn = this.arrowstobedrawn;
this.oldarrowstartingpoint = this.arrowstartingpoint;
this.arrowstobedrawn = 0;
this.arrowstartingpoint = 0;
//Get keys engine, with detection if the closest arrow has been muffed or not.
if(keydown(0)&&this.key[0]==1){
if(this.arrows[this.highestuparrowid2] in |this.grayarrowsheight-this.perfectheight,this.grayarrowsheight+this.perfectheight|&&!(this.uparrowpointsgiven==this.highestuparrowid)){
this.uparrowpointsgiven = this.highestuparrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,perfect.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.perfectpoints;
}
else if(this.arrows[this.highestuparrowid2] in |this.grayarrowsheight-this.goodheight,this.grayarrowsheight+this.goodheight|&&!(this.uparrowpointsgiven==this.highestuparrowid)){
this.uparrowpointsgiven = this.highestuparrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,good.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.goodpoints;
}
else if(this.arrows[this.highestuparrowid2] in |this.grayarrowsheight-this.almostheight,this.grayarrowsheight+this.almostheight|&&!(this.uparrowpointsgiven==this.highestuparrowid)){
this.uparrowpointsgiven = this.highestuparrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,almost.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.almostpoints;
}
else if(!(this.uparrowpointsgiven==this.highestuparrowid)){
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,nope.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.uparrowpointsgiven = this.highestuparrowid;
}
}
if(keydown(1)&&this.key[1]==1){
if(this.arrows[this.highestleftarrowid2] in |this.grayarrowsheight-this.perfectheight,this.grayarrowsheight+this.perfectheight|&&!(this.leftarrowpointsgiven==this.highestleftarrowid)){
this.leftarrowpointsgiven = this.highestleftarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,perfect.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.perfectpoints;
}
else if(this.arrows[this.highestleftarrowid2] in |this.grayarrowsheight-this.goodheight,this.grayarrowsheight+this.goodheight|&&!(this.leftarrowpointsgiven==this.highestleftarrowid)){
this.leftarrowpointsgiven = this.highestleftarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,good.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.goodpoints;
}
else if(this.arrows[this.highestleftarrowid2] in |this.grayarrowsheight-this.almostheight,this.grayarrowsheight+this.almostheight|&&!(this.leftarrowpointsgiven==this.highestleftarrowid)){
this.leftarrowpointsgiven = this.highestleftarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,almost.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.almostpoints;
}
else if(!(this.leftarrowpointsgiven==this.highestleftarrowid)){
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,nope.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.leftarrowpointsgiven = this.highestleftarrowid;
}
}
if(keydown(2)&&this.key[2]==1){
if(this.arrows[this.highestdownarrowid2] in |this.grayarrowsheight-this.perfectheight,this.grayarrowsheight+this.perfectheight|&&!(this.downarrowpointsgiven==this.highestdownarrowid)){
this.downarrowpointsgiven = this.highestdownarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,perfect.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.perfectpoints;
}
else if(this.arrows[this.highestdownarrowid2] in |this.grayarrowsheight-this.goodheight,this.grayarrowsheight+this.goodheight|&&!(this.downarrowpointsgiven==this.highestdownarrowid)){
this.downarrowpointsgiven = this.highestdownarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,good.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.goodpoints;
}
else if(this.arrows[this.highestdownarrowid2] in |this.grayarrowsheight-this.almostheight,this.grayarrowsheight+this.almostheight|&&!(this.downarrowpointsgiven==this.highestdownarrowid)){
this.downarrowpointsgiven = this.highestdownarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,almost.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.almostpoints;
}
else if(!(this.downarrowpointsgiven==this.highestdownarrowid)){
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,nope.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.downarrowpointsgiven = this.highestdownarrowid;
}
}
if(keydown(3)&&this.key[3]==1){
if(this.arrows[this.highestrightarrowid2] in |this.grayarrowsheight-this.perfectheight,this.grayarrowsheight+this.perfectheight|&&!(this.rightarrowpointsgiven==this.highestrightarrowid)){
this.rightarrowpointsgiven = this.highestrightarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,perfect.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.perfectpoints;
}
else if(this.arrows[this.highestrightarrowid2] in |this.grayarrowsheight-this.goodheight,this.grayarrowsheight+this.goodheight|&&!(this.rightarrowpointsgiven==this.highestrightarrowid)){
this.rightarrowpointsgiven = this.highestrightarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,good.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.goodpoints;
}
else if(this.arrows[this.highestrightarrowid2] in |this.grayarrowsheight-this.almostheight,this.grayarrowsheight+this.almostheight|&&!(this.rightarrowpointsgiven==this.highestrightarrowid)){
this.rightarrowpointsgiven = this.highestrightarrowid;
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,almost.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.points += this.almostpoints;
}
else if(!(this.rightarrowpointsgiven==this.highestrightarrowid)){
hideimg 5500+this.e;
this.e ++;
showimg 5500+this.e,nope.gif,this.encouragmentcoordinates[0],this.encouragmentcoordinates[1];
changeimgvis 5500+this.e,5;
this.rightarrowpointsgiven = this.highestrightarrowid;
}
}
this.highestuparrowheight = 600;
this.highestleftarrowheight = 600;
this.highestdownarrowheight = 600;
this.highestrightarrowheight = 600;
timeout = .05;
}
if(this.timeouts==1900){
hideimgs this.latestb-(this.oldarrowstartingpoint+this.oldarrowstobedrawn),this.latestb;
hideimg 5500+this.e;
hideimgs 9000,9003;
unset dancingwithjohn;
stopmidi;
if(this.points>10300){
say2 Wow! You were almost#bperfect!#bHere are your coins.#b#b#b#v(this.points) points;
set hasasteriskiancoins;
set johncandance;
}
else if(this.points>8500){
say2 You were good!#bHere are your coins.#b#b#b#v(this.points) points;
set hasasteriskiancoins;
set johncandance;
}
else if(this.points>8000){
say2 Almost there, but#bI think we could be better#b#b#b#b#v(this.points) points;
}
else {
say2 No no no, I’d rather#bfind another teacher#b#b#b#b#b#v(this.points) points;
}
this.timeouts = 0;
}
function incrementKeys(){
if(keydown(0)){
this.key[0] += 1;
}
else this.key[0]=0;
if(keydown(1)){
this.key[1] += 1;
}
else this.key[1]=0;
if(keydown(2)){
this.key[2] += 1;
}
else this.key[2]=0;
if(keydown(3)){
this.key[3] += 1;
}
else this.key[3]=0;
}[/CODE][COLOR=“Silver”]
---------- Post added at 02:40 AM ---------- Previous post was at 02:17 AM ----------
[/COLOR]ok I got it, this.arrows is too large.
EDIT:
Any idea for a hack?