This post is about implementing custom timelines in GameMaker.
Admittedly, timelines remain to be one of the more dated features of the software, designed for a specific purpose and kept in their original form for compatibility.
Time to time you'll see someone stopping by on forums to write a big rant about how these are a mess, do not do what they expect them to do, and should be redesigned immediately.
People will usually also argue that doing these things by yourself is too hard.
Since it is far easier than people claim, I decided to write a post about this.
This is a small post about a method for figuring out collision_line's "contact point" in GameMaker - in other words, obtaining not just whether there's something on the way, but also the nearest point on the nearest matching entity.
Most commonly asked about for "hitscan" weapons and laser-sights, but has many uses.
url_open_ext can open links in a new tab, but triggers popup blocker.
clickables can open links in a new tab, but have to be repositioned manually.
(particularly inconvenient if scaling-positioning the game for mobile browsers)
url_open_ext is by far the most convenient of these, so let me explain why that does not work:
To prevent any page from being able to randomly open indefinitely large quantities of new tabs, the browser will automatically block attempts to open new tabs\windows unless they originate from user interaction (click event);
GameMaker handles events, and writes down new input states to later dispatch GML-level events at the right time and place (see event order). This means that your GML code inside a "Mouse Pressed" event does not count as originating from a user interaction (as it executes a few milliseconds later), and thus is not allowed to open new tabs (and do some other things).
However, with a bit of JS (and understanding of internal workings of GM), it is possible to accomplish the intended result, and this post is about that.