OK, couple things...
- That's not the HSL function I wrote, if you're trying to get eyes on debugging your own function, it might be more helpful to start a new topic, and I'm not sure from looking at that function what it's supposed to do, so I might not be able to help you.
- I'm using QB64 1.0, I should probably update because I bet _PI is in a newer version, and my version doesn't like that it has two different argument setups.
- Seems weird that you're asking about light / dark when you're passing the "gray" value into two parameters of your function. It doesn't look like you're doing anything at all with lightness here. If you're trying to vertically invert everything visually, try subtracting the y coordinate of pset from the y coordinate you want as the bottom edge.