if($wavesEnabled = true) schedule(100, wavecycle(), 0);
You didn't do the schedule right.
When calling the regular function (not on an object, such as %obj.schedule(MS,function,args[,]),
It's actually called schedule(MS,0 (this is usually called on an object, but I don't understand, so it's usually set to 0), func, args[,]);
When calling schedules, you don't need the () for the function you use.
example: schedule(3000, 0, talk, "Hello!");