Old 20th July 2005, 02:39   #1
SkarlathAmon
Junior Member
 
Join Date: Jul 2005
Posts: 6
Working Logic?

Is it just me or is the If, Above and Below functions broken? I've tried multiple tests to see if they work and it appears that they make no change whatsoever to anything.

I may be using them wrong but...

init: m=0;n=800

beat: if(0,m=.99,m=-.99)
perpoint: x=m; y=m

then the moment i get a beat in the music, the point should move to the bottom right, (or if the documentation's reversed the top left) but it does neither. Can anyone tell me what i'm doing wrong?

thanks
SkarlathAmon is offline   Reply With Quote
Old 20th July 2005, 03:50   #2
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
either a) avs is not registering beats or b) there's something wonky with your code. for one, you don't need to render 800 points, and if nothing's showing up at all with that, you're probably rendering lines. try reinstalling winamp and see if that helps.

btw, +y is bottom, +x is right, so the point ought to move to the top left.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 20th July 2005, 05:41   #3
SkarlathAmon
Junior Member
 
Join Date: Jul 2005
Posts: 6
I had just left it on what it defaulted to for the spiral, even when i put it in the frame code, or the point code, i can't make it evaluate the above functions. I have winamp on two machines, neither of which can successfully use it. Though both are using AVS 2.81b.

But your saying that my code should is correct for the if statement right?
SkarlathAmon is offline   Reply With Quote
Old 20th July 2005, 10:47   #4
jheriko
Forum King
 
jheriko's Avatar
 
Join Date: Aug 2002
Location: a twist in the fabric of space
Posts: 2,150
Send a message via ICQ to jheriko
beat: if(0,m=.99,m=-.99)

you shouldnt expect that to work. I wouldnt, in ANY programming language. wspecially evallib with its simple and consistent syntax.

read the expression help. PROPERLY.

above() below() or equals() return 1 if the expression they represent is true and 0 if false. so above(2,3) is 0, below(5,6) is 1 etc... ifs first parameter determines the code path. 1 it executes the then parameter, 0 and it executes the else parameter.

try looking at other presets if you find the expression help hard.

look at your current code and your if statement is always comparing zero. so it always runs the else path. which is an invalid block of code anyway. so it does nothing.

-- Jheriko

'Everything around us can be represented and understood through numbers'
jheriko is offline   Reply With Quote
Old 20th July 2005, 16:23   #5
SkarlathAmon
Junior Member
 
Join Date: Jul 2005
Posts: 6
... I know how to program. I know what they do, i read the help MULTIPLE times. My problem is... it runs NEITHER command. My question was that if anyone else was having a problem with IF not working, or if my syntax was wrong, but you have confirmed that my syntax is right to make the true value trigger...
SkarlathAmon is offline   Reply With Quote
Old 20th July 2005, 17:09   #6
^..^
Major Dude
 
^..^'s Avatar
 
Join Date: Sep 2004
Location: There
Posts: 1,002
Send a message via ICQ to ^..^
First: YOUR CODE IS WRONG!

as jheriko already said: if you're really using this code:
Quote:
Originally posted by SkarlathAmon
init: m=0;n=800
beat: if(0,m=.99,m=-.99)
perpoint: x=m; y=m
in AVS it simply won't work. Cause it's not AVS syntax!


btw: if there is code in the beat box, it'll only be executed whenever AVS detects a beat.
So, if you want to have a point jump to the opposite corner whenever there is a beat, just do that:
code:
init: m=0; n=1; <- you only need one single point (as you said yourself)

frame: m=.99;

beat: m=-.99;

perpoint: x=m; y=m

now your point will be in the opposite corner whenever there is a beat.


If you still want to use the if() function (though it would be pretty stupid, cause we already found a much faster and simpler solution), then do the following:
code:
if( b , assign(m,-.99) , assign(m,.99) )

'b' is a variable used by AVS which is either 1 (if there currently is a beat)
or 0 (when there isn't a beat).
And what assign() does, should be pretty obvious.

Now, as long as b has the value 1 the if-function processes the code in the middle-part: assign(m,-.99). Otherwise (if b has the value 0) the last part of the code will be processed: assign(m,0.99).


wow, guess that is enough explanation...

^..^ is offline   Reply With Quote
Old 20th July 2005, 20:48   #7
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
/Lights flamethrower

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 20th July 2005, 20:53   #8
^..^
Major Dude
 
^..^'s Avatar
 
Join Date: Sep 2004
Location: There
Posts: 1,002
Send a message via ICQ to ^..^
hehe...
but wait pak! The very last ultimatum hasn't run out yet!

^..^ is offline   Reply With Quote
Old 21st July 2005, 06:37   #9
SkarlathAmon
Junior Member
 
Join Date: Jul 2005
Posts: 6
Thanks :D

Ah and that was my problem, not using assign. it was my understanding that = did the same thing, but i guess i was wrong.

thanks
SkarlathAmon is offline   Reply With Quote
Old 21st July 2005, 16:12   #10
^..^
Major Dude
 
^..^'s Avatar
 
Join Date: Sep 2004
Location: There
Posts: 1,002
Send a message via ICQ to ^..^
no prob...

and don't forget that the if(0... part doesn't do what you wanted it to either!

^..^ is offline   Reply With Quote
Old 22nd July 2005, 02:38   #11
StevenRoy
Senior Member
 
StevenRoy's Avatar
 
Join Date: Jun 2005
Location: USA
Posts: 129
Send a message via ICQ to StevenRoy Send a message via AIM to StevenRoy
The major difference between = and assign() is that the former doesn't work inside functions, such as if(). However, you can just as easily use = if you rearrange the equation a little. (Yes, if() is a function. It's like the ?: operator in C and Java and other languages.)

For example, the following three lines are equivalent:
code:
if(b,assign(m,-.99),assign(m,.99));
assign(m,if(b,-.99,.99));
m=if(b,-.99,.99);

Of course, if you're using the "b" variable to determine when there's a beat, it's usually a good idea to consider dividing the code into the "frame" and "beat" sections. There's a good example of this posted by ^..^ about five posts ago.
StevenRoy is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS > AVS Troubleshooting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump