{
task THomingShot (GetX, GetY, 2, 90, RED02, 10);
{
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition (obj, GetX, GetY);
Obj_SetSpeed (obj, 2);
ObjShot_SetGraphic(obj, RED02);
ObjShot_SetDelay (obj, 10);
let maxTraverse = 0.5;
while(! Obj_BeDeleted(obj)) {
Obj_SetAngle(obj, 90);
yield;
let dir = atan2(GetPlayerY - Obj_GetY(obj),
GetPlayerX - Obj_GetX(obj));
let diff = dir - angle;
while(diff >= 180) { diff -= 360; }
while(diff < -180) { diff += 360; }
let diffAbs = (|diff|);
if(diffAbs < maxTraverse) {
angle = dir;
} else {
angle += maxTraverse * diff / diffAbs;
}
}
}
it says i need a parathesis somewhere, or something
what
Okay to answer this question, I need to start somewhere small and work my way up. Bear with me for a bit.

First let's explain a subroutine. Here's an example of a simple one.
sub CreateRingShot {
ascent(i in 0..36) {
CreateShot01(GetX, GetY, 2, i*10, RED01, 10);
}
}
If you take a look at what's inside the subroutine, it makes 36 bullets on the boss shooting out in a ring. Now, just having that subroutine there isn't going to make the boss actually shoot that ring because all we've done here is define the subroutine. To actually make the boss use that behavior, you have to call the subroutine somewhere in the @MainLoop. Basically, all instances of CreateRingShot; will be replaced with that ascent that spawns the ring. This is usually used to help stay organized.
Now for functions. Functions are more complicated versions of subroutines because they are more flexible. Using the last example, here's an altered version that grants more flexibility:
function CreateRingShot(speed, graphic, delay) {
ascent(i in 0..36) {
CreateShot01(GetX, GetY, speed, i*10, graphic, delay);
}
}
Again, just writing that doesn't make the boss actually do those actions yet since we only defined the function. In fact, as it is now, the speed, graphic, and delay isn't even known yet, right? That's because when you call the function with CreateRingShot, you'll be telling it what speed, graphic, and delay to use at that time. This means you can write something like CreaterRingShot(1, RED22, 5); and it'll make a ring of RED22 bullets delayed for 5 frames with a speed of 1. You can pass in any other variation you want and it'll use what you tell it to use. Just make sure you don't tell it to try to use YELLOW11 as a speed or something or, of course, Danmakufu is gonna yell at you in moonspeak.
And now, tasks. Tasks are even more flexible versions of functions because they can be paused at any time instead of being run all at once in one frame. To pause a task, all you need to do is tell it to yield. When it yields, it'll stop running until the next time it encounters a yield
in the @MainLoop. When the script encounters a yield in the @MainLoop, it'll continue any task that hasn't been completed yet from the last time it yielded. Here's an example, again based on what we've been working on before with the ring shot:
task CreateRingShot(speed, graphic, delay) {
ascent(i in 0..36) {
CreateShot01(GetX, GetY, speed, i*10, graphic, delay);
yield;
}
}
This task is only slightly different from the previous function. All I did was change function to task and add a yield; after each create shot. (This task yields 36 times because the ascent loops 36 times to create 36 shots). Don't forget to put a yield; in the @MainLoop too so that it gets called every frame as well. Otherwise, the tasks that haven't finished yet can't continue. Now, when you call CreateRingShot(1, RED22, 10); the ring won't spawn each bullet all in the same frame, but 1 per frame instead.
Hopefully, you understand a little better why your task is giving you errors. If not, you probably shouldn't even be trying to use tasks yet. Instead, try using subroutines and then working your way up to functions and tasks as you get the hang of them.