Nullsoft AVS Preset 0.1[V Well here she is. She's definately not the definitive guide, but she's adequate for those who need to know the basics and experiment with the advanced. Just go through everything in order clicking on each effects list, making sure its enabled and all others after it are disabled, then read the comments while examining the display. This tutorial also assumes you pretty much know everything about superscopes (ie waveform/spectrum, dots/lines, left/center/right channels, and colors) excluding the actual scripting process. If you don't, you're not ready to read this tutorial, so go experiment for a while. You might want to change to a lower resolution on your computer. 800x600 comes to mind because reading these comments are easier on the eyes. This tutorial is made for waveform scopes just because they're the best! :) The same techniques can be applied with spectrum with little effort if you understand the difference (the differences being spectrum uses a linear 'v' variable that is strictly positive.) Written by Idealius - idealius@yahoo.com Edited by 8ate8 - ozzzie@mindless.com  No need to make sure this fffects list is enabled, there's nothing to display! This is just a familiarity test. First let's take a look at the init text box. This is executed everytime you load the preset. When it -is- calculated, it is calculated before all other text boxes. Secondly, there's the point text box. This is calculated everytime a point (as in dot or positions between lines) is displayed on the screen. Thirdly, the frame text box is calculated after all the points are displayed from the point text box but only once before the -first- point is calculated for reasons beyond my comprehension. You really don't have to worry about this, but that's the way it works! Remember, point is calculated 'n' times. Fourthly and finally, the beat text box is calculated only when a beat hits -and- after the first three text boxes are executed. Alright, now lets explain some syntax. Variables are 'x', 'y', 'v', 'i', 'n', and your custom variables. The first four are the variables AVS uses for most any superscope. They are pretty much vital in most superscopes. Your custom variables are the ones you name, and I warn you some of your names won't work for reasons beyond my knowledge. One letter variables are probably the best, but I like some of the two letter combinations. For those of you with no programming experience, the line 'x=3' does -not- mean 3 is equal to 'x' and 'x' is equal to 3. It means -assign- the value of 3 to 'x'. Anything after the '=' sign's are assigned to 'x'. This can -not- be used interchangeably (ie '3=x' doesn't mean assign the value of 3 to 'x', it means assign the value of 'x' to 3, which isn't possible, because 3 is a constant.) All variables assignments -must- be seperated by semi colons. So if you say 'n=n+100' and 'y=v-.4' in the same text box you would put 'n=n+100; y=v-.4' and these -can- be used interchangeably, so you could put 'y=v-.4; n=n+100' instead.$=i+v*0.2; r=t+i*3.14159*4; x=cos(r)*d; y=sin(r)*d-cos((i*2-t*v*0.2)/I+t)*COS(T)*SIN(C)-SIN(T)*0.5*COS(C))/s; u=(rand(5)-2)/s; x=x+t; y=y+u; x=min(1,max(0,x)); y=min(1,max(0,y)); =t-0.05;t=t+dt;dt=0.9*dt+0.001; t=if(above(t,3.14159*2),t-3.14159*2,t); =0c;sc=-sc;N=RAND(300);C=C+1dt; x=0.5;y=0.5;t=0;u=0;s=80 =800=50; dt=0.01; t=0; sc=1; 4 x,\(?yq= ףp?isbeat?islbeat?bi?t{GzsI@u{Gz  Let's take a look at the simplest scope you can pretty much make. As you can see 'n' is the number of dots or points the scope has to work with. It's also the number of times the point text box is calculated before moving onto the frame text box, for obvious reasons. If you have 100 points ('n'=100), you'll have to calculate the point text box 100 times. Its present in the init text box because we only want to -set- the number of points once in this scope. Now lets look at the point text box. This is usually the most complicated text box. We will be introducing variables 'x', 'y', and 'i' right now. 'x' is the horizontal position the current point being calculated is displayed in the AVS window. 'y' is the vertical position the current point being calculated is displayed in the AVS window. These variables are based on the Cartesian coordinate system (ie (0,0) is the center of the screen, (-1,1) is the top left of the screen, and (1,-1) is the bottom right of the screen.) 'i' is 1 divided by the "index" of the current point being calculated, so as the SuperScope calculates, i goes from 0 to 1 skipping every (1/n) (for a basic explanation just think of it as which point the scope is calculating at any given time.) 'v' is a number from -1 to 1 that is based on the sound. So in summary, we have a superscope with 300 points that starts horizontally at 0 ending at 1 and starts vertically at 0 plus whatever 'v' happens to be.$x=i;y=vt;59*4; x=cos(r)*d; y=sin(r)*d-cos((i*2-t*v*0.2)/I+t)*COS(T)*SIN(C)-SIN(T)*0.5*COS(C))/s; u=(rand(5)-2)/s; x=x+t; y=y+u; x=min(1,max(0,x)); y=min(1,max(0,y)); =10.05;t=t+dt;dt=0.9*dt+0.001; t=if(above(t,3.14159*2),t-3.14159*2,t); =0c;sc=-sc;N=RAND(300);C=C+1dt; x=0.5;y=0.5;t=0;u=0;s=80 n=3000; dt=0.01; t=0; sc=1; 4 x,\(?yq= ףp?isbeat?islbeat?bi?t{GzsI@u{Gzf   In this effect list, I'll be introducing the idea of scaling and shifting your scopes. First you'll notice both scopes start vertically from -1 to 1 (the entire screen vertically.) Well, this stems from the calculations with the variable 'y' and its assignment of 'i.' You'll notice in the previous effects list the variable 'i' moved the 'x' variable from 0 to 1. Well, to make your scope go from -1 to 1 all we have to do is scale the variable by multiplying by 2. That only makes the scope go from 0 to 2 so we just subtract 1 to move the scope back to -1 to 1. On a side note, this technique can be used for both 'x' and 'y' variables interchangeably. Next you'll notice the scopes aren't centered in the middle of the screen. That's because of the -.5 and +.5 on the 'x' variables for both scopes. This is called shifting. Fairly obvious how it works. After that, you'll notice that the red scope appears to react more sensitively to the sound. That's because in the blue scope 'v' is scaled down by a factor of 2.$x=v-.5;y=i*2-1*3.14159*4; x=cos(r)*d; y=sin(r)*d=t-0.05n=300$x=v/2+.5;y=i*2-13.14159*4; x=cos(r)*d; y=sin(r)*d=t-0.05n=3006 Now let's do something cool :) By now you know how to make a simple superscope similar to the scope with the same name. You can even change how well it responds to sound and move it around the screen. Now what if you want to make it move randomly every time a beat hits? Well for that we need two new variables. These variables can equal whatever we want them to, and 'x','v','n', and 'i' have no relation to them unless we -make- them have one (ie, we can change the new variables all we want and it will still have no effect on the scope unless we modify those variables to equal them in some way.) We'll call them 'dd' and 'dc'. First we'll init them equal to 0. Then when a beat hits we'll make them equal a random position somewhere on the screen. This is where things start getting a little complicated. The rand() function gets introduced. The number in between the parentheses specifies the maximum value the random number can be, minus one. So we'll recieve a number ranging from 0 to eleven so no matter what number is in the rand() function, it will always return a positive number. But we're using the Cartesian system here people (we have a negative part of the screen too!) So we want to visit -all- of the screen. So, we just subtract half of 12 so we'll have a value between -5 and 5. Finally, if you remember the screen ranges in width and height from (-2, 2) in which case we'll have to divide these numbers or we'll almost never see the scope! So now dd and dc change every time a beat hits, but how do we get that to affect our scope? Well that's the easy part, since our scope is already centered, we just shift them by adding 'dd' to the 'x' variable and 'dc' to the 'y' variable and while were at it, lets scale down the 'x' variable so it's smaller by dividing the -whole- quantity (i*2-1) by two. But its still missing something. So let's make it so everytime a beat hits the reaction to sound increases. That means 'v.' So, we just add another variable 't.' We init it as 1 because if it was equal to 0 and we multiplied it by 'v' then 'v' would be equal to 0 until we changed 't'! So, we just make 't' equal something other than one when a beat hits. So in the beat text box, we let 't' equal a random number from 0 to 5 and add one, so 't' doesn't ever equal 0. But now the superscope is as big as t until another beat hits! We just want it to display 't' whenever a beat hits. So, we just put in the frame text box that 't' equals one between beats and now we're finished.$x=(i*2-1)/2+dd;y=v*t+dc4; x=cos(r)*d; y=sin(r)*dt=10.05dd=(rand(12)-6)/10;dc=(rand(12)-6)/10;t=rand(6)+1n=300;dd=0;dc=0;t=1#  To progress further with scopes lets teach you some trig. Now teaching trig can take someone forever, so if you want to know more, research it yourself :) I'll just teach the stuff that's more relevant to superscope making. The yellow scope you're seeing on your screen right now is in essence a sine wave. The sin() function returns the sine of whatever its argument is, but if you don't know what the sine of something is how are you going to know what it returns, right? Well it basically takes a value and makes it rollercoaster from -1 to +1 as the value increases. See the roller coaster on your screen? Well, if we just set 'y' equal to the sine of 'x' than we'd get a pretty lame rollercoaster, so we took 'x' times 20 -inside- of the sin function to make "Six Flags" jealous :) Now for the second scope, we'll just add a nifty randomized beat effect with 't,' and a reaction to sound with the 'v' variable added to 'x.' Pretty nutty scope, eh?$x=i*2-1;y=sin(x*20)4; x=cos(r)*d; y=sin(r)*d=10.05=10+rand(40))/10;dc=(rand(12)-6)/10;t=rand(6)+1n=30020dc=0;t=1$x=i*2-1+v;y=cos(x*t)9/2)(r)*d; y=sin(r)*d=10.05t=10+rand(40))/10;dc=(rand(12)-6)/10;t=rand(6)+1n=300;t=20c=0;t=1VQ Trig tutorial vol II. Alright, we can make rollercoasters, but where are the loops? :) Lets make a circle scope. For this one you can see that long number 3.14159. I would suggest you memorize that number because it's very important in the world of math. -Only- until the first 9 though :) This number is called PI (pronounced pie) and it's math symbol looks kind of like 'TT' with the tops of the T's connected. These are very relavent to sine, cosine, tangent, their reciprocals, and the unit circle. Learn more in trigonometry :) For AVS's sake we'll just teach you that its important! For starters we set our variable 'r' to 'i' times PI and finally multiply it by 2 in the point text box (multiplying from -1 to 1 will not give you a circle, but anything else will.) We don't really need to initialize 'r' as anything because it will constantly be changing because of 'i'. I really wish I could go into greater detail about 'r', but trig isn't explainable in a comment. The reason why we have x equal to the sine of 'r' and 'y' equal to the cosine of 'r' is so that we have a circle. Cosine is basically the same as sine with the rollercoaster shifted -PI/2. But this ends up to be very useful, because if you think about it, it makes sense. Put two related curves together and get a circle. Just don't tell your Math teacher that! So, for the second superscope lets just add some sound reaction. We'll put 'v' in 'r' so our circle stays a circle, but reacts to sound. We'll also scale down 'x' and 'y' by 2 and scale 'v' up by 8 and we end up with a pretty nifty looking superscope.$r=i*3.14159*2; x=cos(r); y=sin(r)=4=10+rand(40))/10;dc=(rand(12)-6)/10;t=rand(6)+1n=800dc=0;t=1$r=i*3.14159*2+v*8; x=cos(r)/2; y=sin(r)/2=4=10+rand(40))/10;dc=(rand(12)-6)/10;t=rand(6)+1n=800dc=0;t=1@y  *phew* enough with the trig! Now lets mess with some of the more complicated programming-related options in the AVS superscope. We'll keep the circle though :) Let's scale it down a little bit more, say by 4. Well, what if we wanted it to bounce off the sides of the screen? We'll just have to add some variables :) We'll need four for this one, two for the 'x' and 'y' position relative to original circle scope and two for the directions and speeds for those variables. We'll call the position variables 'dc' and 'dd'. We'll initialize them at 0 and add them to our original 'x' and 'y' variables in the point text box. Well now were not even moving! We'll have to make 'dd' and 'dc' go somewhere, so we'll add the variables 'bb' and 'cc'. They're the speed/direction of the 'dd' and 'dc' variables (assigning 'bb' a negative value will subtract from the 'dd' variable and a positive value adds to the 'dd' variable, get it?). We'll init them at some respectable decimals .3 and .1. So now the ball is moving because of these new additions to the frame text box but it eventually just floats off of the screen! That's no good. So now we're introducing the 'if' statements. Their syntax is "if(cond,vartrue,varfalse)". Cond can equal any of the ones listed when you press the help button on a Trans / Movement. Basically, if the cond is true then it returns vartrue, otherwise it returns varfalse. So what if you want to change a variable only if the cond is true or vice versa? Well then you just put in the changed value after the cond and then a comma and the original variable or vice versa. Confused? Well if we wanted to change 'bb' to a negative value -only- if 'dc' is above one then we'd enter 'dc=if(above(dc,1),-bb,bb)'. So we'll need 4 'if' statements because we have 4 sides of the AVS window :) Or do we? If we just use a handy dandy absolute value function (abs()) we can avoid two 'if' statements. We'll just set 'bb' equal to -'bb' if the absolute value of 'dc' is above 1. (translation: we'll reverse directions if we hit the side of the window.) Do the same for 'cc' and 'dd'. Alrighty, adding more to the frame text box, we now have a nice bouncy ball, but can we get some variety in here!! That's where the beat and the second superscope come into play, lets say we change speed/direction/size every time a beat hits? For that we just add a few lines (that should be self explanatory to you now) to the beat text box and change 4 to 't' while initializing 't' at 1. We'll init bb and cc at random values so everytime you start the preset the ball will go a different direction, also. After a few tests we find out that if the song's beat is too fast the ball can get stuck on the side of one of the walls. So let's just randomly send the ball to the middle, eh? Well we could add another variable, but now our superscope is getting pretty rowdy, so lets conserve some space and base it on one of the existing variables. For that we'll just look at our code. Hmm.. if we take a look at the 't' variable in the Beat text box we can see that on occasion it will equal 2 so we'll just say if 't' equals two (when the ball is the biggest) we'll send the ball to the middle of the screen. For that we need two more 'if's' (remember, x -and- y.) Now were finished with a nice bouncy beat ball :)$r=i*3.14159*2+v*8; x=cos(r)/4+dd; y=sin(r)/4+dcdd=dd+bb;dc=dc+cc;bb=if(above(abs(dd),1),-bb,bb);cc=if(above(abs(dc),1),-cc,cc)b=(rand(10)-5)/40;cc=(rand(10)-5)/40;t=4-rand(3);dd=if(equal(t,2),0,dd);dc=if(equal(t,2),0,dc)-5)/50)n=80;dd=0;dc=0;bb=.3;cc=.1=4$r=i*3.14159*2+v*8; x=cos(r)/t+dd; y=sin(r)/t+dcdd=dd+bb;dc=dc+cc;bb=if(above(abs(dd),1),-bb,bb);cc=if(above(abs(dc),1),-cc,cc)bb=(rand(10)-5)/40;cc=(rand(10)-5)/40;t=4-rand(3);dd=if(equal(t,2),0,dd);dc=if(equal(t,2),0,dc)-5)/50)n=80;dd=0;dc=0;bb=(rand(30)-15)/100;cc=(rand(30)-15)/100;t=4ZU Dissatisfied? You should be. This is a tutorial. It -should- be filled with lame, barely usable scopes. The rest is for you to decide! With some creativity you can do some crazy stuff with scopes. I did a lot of the more symmetrical examples. More often than not there's a lot of work that goes into good scopes with an unbalance ratio of lots of work and little substance, as seen in the last effects list. But that's the price you pay for unlimited customability that AVS provides! Tutorial written by Idealius. Hosted by 8ate8. Obtain the latest version from http://8.deskmod.comr/avs