there are several things wrong. I'm sure reading some example code helps to avoid too much try-and-error with this exotic language. But that's probably done after almost 4 months? ;-)
Firstly you need to declare all variables in the on init and always use their corresponding prefix (for integers its "$") like so:
on init
declare $x
declare $y
declare $output
end on
Secondly you can not call a function in the on init. For this example I use the on note callback that triggers every time you play a note. Additionally use "call" to execute a function.
on note
$x := 1
$y := 2
call Add
message($output)
end on
And lastly use brackets around your conditions:
function Add
if ($x > 0)
$output := $x + $y
else
$output := 0
end if
end function
It is like in most programming languages important to declare all your functions before their execution. Since you can not use them in the on init, you can place this callback always on top followed by your functions.
This would be the full code:
on init
declare $x
declare $y
declare $output
end on
function Add
if ($x > 0)
$output := $x + $y
else
$output := 0
end if
end function
on note
$x := 1
$y := 2
call Add
message($output)
end on
Enjoy ;-)