View Single Post
Old 9th February 2010, 19:17   #25
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 872
Tutorial

I had planned to write a brief tutorial about the new features a few weeks ago, to spare others the hassle of reading through the long tutorial, but I never got round to it. When I finally started (an hour ago), I noted to my considerable surprise that most of what I could tell you (and what I learned from the AVS tutorial), is obsolete.

With one of the latest betas, they seem to have changed the compiler discreetly, making things much easier than before. For instance I found there is no need for assign() statements anymore, and also the cumbersome exec statements have gone. Wonder why nobody told us. Maybe it's a bug, not a feature ? But definitely my code now works without assign and exec2/exec3... which is a huge relief I can tell you. Hope that will be official.

Ok, now to the features... can keep it much shorter than planned.

Global variables
These are read- and writable from anywhere except shader code.
gmegabuf() array can store 1 million values***
reg00 ... reg99 can store 99 values, similar to q1 ... q32 (except that regxx and gmegabuf work in both directions, e.g. can be written in the wave section and read in the frames section, while the q vars are unidirectional only)

Local variables
megabuf() array can store 1 million values but these are only valid locally, e.g. within the section and cannot be used to transfer data from frame to waves etc.

Loops
Array of millions of values would be useless without a way to fill them. Therefore we have loops to do that.

loop (n, statement1; statement2; statement3; etc. );
n is the number of times the loop is repeated, statements are normal lines of milkdrop code. As far as I tried, you can add as many statements as you like, separated by semicolons.

And that's it folks, unless Benski introduced other secrets I haven't discovered yet.

***The tutorial says that megabuf/gmegabuf can store 1 million values, although I could successfully address gmegabuf (20000000); - 20 millions. Not sure whether this is intended or rather a lack of range checking... suggest you are careful and don't use more than a million. Should be enough for the moment.

Martin

Last edited by Nitorami; 9th February 2010 at 19:37.
Nitorami is offline   Reply With Quote