(Blargel: I thought it was meant to be a task as well, but he's likely applying it inside the passed object's microthread in which case this could be correct)
Ok. First of all you need to realize the wait function is just this:
function wait(n){
loop(n){
yield;
}
}
If you call wait(1); you are doing loop(1){ yield; } which as should be incredibly obvious, is just yield;. Unless you're yielding more than once, please just stick to yield;. It doesn't actually matter (well there is memory allocated for the parameter and herp so i guess it does but w/e), but it just looks uh less incompetent.
Second of all, this is what you are doing:
loop{
while(signalx==1){
xsize-xspeed;
if(xsize<=minx&&signalx==1){
signalx=0;
break;
}
wait(1);
}
}
1. You are encasing a while loop inside of an infinitely running loop. Even though you have a break call in there, it should only break out of the while loop, so you're stuck.
2. xsize-xspeed; is invalid syntax, you mean xsize = xsize - xspeed; or xsize -= xspeed;
3. The if condition having signalx==1 in it is redundant since that's the while condition.
4. You don't even need the signals:
while(xsize>minx){
xsize -= xspeed;
yield;
}
5. Even if your stuff all worked, it wouldn't visibly change anything because there are no SetScales in there besides the beginning.
6. You probably mean to use ysize instead of xsize in the last two loops.
7. Even if you changed the above, they would not scale at the same time; all it would do is scale the x-dimension down to the minimum then to the maximum, and then scaling the y-dimension down to the min and then to the max.
8. In relation to the above, you'd end up with a max-scaled object since you aren't going back to the original size.
9. Even if everything worked completely as you intended to code it, I doubt it would look as you would want it to since you're just linearly scaling which will look choppy.
IN ANY CASE, there is a much much easier less contrived way to do a pulse scaling (I'm assuming a bunch of things about your objects but this will probably apply):
task pulse(obj, minscale, maxscale, speed){
let mid = (maxscale-minscale)/2;
let t=asin(((1-minscale)/mid) - 1);
loop{
ObjRender_SetScaleXYZ(obj, minscale + (sin(t)+1)*mid, minscale + (sin(t)+1)*mid, 0);
t = (t+speed)%360;
yield;
}
}
(okay that took too long to figure out and calculate for a general case, whoops)