Archive: WTF is wrong with this SCC


21st June 2002 08:00 UTC

WTF is wrong with this SCC


init:
n=500;rnd=5;
on beat:
c=bnot(c);rnd=rand(6);rnd=if(equal(rnd,0),2,rnd);rnd=if(equal(rnd,1),2,rnd);
per frame:
t=t-0.05;t1=t1+0.05;n=sqrt(h*h+w*w)
per point:
y=(getspec(y,1,cos(if(c,t,t1)))+cos(if(c,t,t1)))+v*rnd)/((if(c,t,t1)))+cos(i-t);
x=(getspec(x,1,cos(if(c,t,t1)))+(cos(if(c,t,t1)))+v*rnd)/((if(c,t,t1)))+sin(v));

21st June 2002 09:12 UTC

I think you've got one or two too many )s in there.


21st June 2002 16:41 UTC

Little trick
A good way to check if the error is a syntax error (e.g. a missing bracket) or a logical error (wrong formula/calculation), is just to add "x=i*2-1;y=0" to the end. If you made a syntax error, this will have no effect, but if you made a logical error, then the code will still get executed and draw a horizontal line.


21st June 2002 19:01 UTC

I think uNDefineD had it right.


25th June 2002 01:42 UTC

for the y=, you're missing a ( just in front of the second cos function


25th June 2002 08:32 UTC

Bracket errors are nasty because they can be very hard to spot. To quickly see if you made one, just go over each statement and keep an internal counter. When you see a '(', add one, when you see a ')', remove one. If you end up positive, you'got one '(' too many or not enough ')'. For negatives, it's the other way around of course.


25th June 2002 10:04 UTC

UC: Damn, I thought I had made that up. LOL

EDIT: I just picked up an extra ) at the end of the x line.