PDA

View Full Version : A generic "What is wrong with my script!?" thread.



Revfan9
10-22-2006, 01:57 AM
So I've been writing a script for a custom boss, and I am having a bit of trouble.


WAIT WAITFRAME
COMPAREV x,209
GOTOMORE A
COMPAREV x,32
GOTOLESS B
MORE COMPAREV y,129
GOTOMORE C
COMPAREV y,32
GOTOLESS D
GOTO WAIT
A SETV x,208
SETV xd,-2
GOTO MORE
B SETV x,32
SETV xd,2
GOTO MORE
C SETV y,128
SETV yd,-2
GOTO WAIT
D SETV y,32
SETV yd,2
GOTO WAIT



There's the script for the boss itself. Okay... So I stole some code from Revolution.qst... This one I am having no trouble with. The Boss flies around the room, bouncing off the walls, weakened when it opens it's eye. 10 hits with the sword kills it (I used secrets for this part, as I am unsure how to do it with scripts).


WAIT WAITFRAME
COMPAREV d1,1
SUBV d1,1
GOTOTRUE CHNG
COMPAREV x,209
GOTOMORE A
COMPAREV x,32
GOTOLESS B
MORE COMPAREV y,129
GOTOMORE C
COMPAREV y,32
GOTOLESS D
GOTO WAIT
A SETV x,208
SETV xd,-2
GOTO MORE
B SETV x,32
SETV xd,2
GOTO MORE
C SETV y,128
SETV yd,-2
GOTO WAIT
D SETV y,32
SETV yd,2
GOTO WAIT
CHNG SETA1 data,d0
GOTO ATAK
ATAK WAITFRAME
SUBV d3,1
COMPAREV d3,1
GOTOMORE CHBK
SETV d2,1
COMPARER linkx,x
GOTOLESS LEFT
GOTOTRUE MORE
ADDR x,d2
MORA COMPARER linky,y
GOTOLESS UP
GOTOTRUE ATAK
ADDR y,d2
LEFT SUBR x,d2
GOTO MORA
UP SUBR y,d2
GOTO ATAK
CHBK SETR data,d4
SETR d1,d5
GOTO WAIT

However, this is the one I am having trouble with. What is suppossed to happen is that the object appears, and chases Link around the room, then it disappears after a set amount of time. Then after some more time, it reappears and chases Link again. But what happens is that the object just appears on the boss and stays there, even though I can't find anything wrong with my code. What is going on?

Also note, that I am the only one who realized that Zasm had a seperate forum. I find this somehow hilarious.

Saffith
10-22-2006, 03:30 AM
Its functionality appears to depend heavily upon its position and the initial values of its registers. What arguments are you giving it, and what are its initial position and velocity?

Revfan9
10-22-2006, 04:05 AM
x=120
y=80
xs=-2
ys=2
d0=402
d1=480
d2=1
d3=120
d4=49
d5=480