This is a useful phrase I keep in my spellbook for targeting entities, which selects the entity from a list closest to my crosshair (based on the average position of the entity's feet and head), within a given viewcone. It makes use of a few other utility phrases, which I've included as their own patterns below.
______________________________________________________________________________________________________
Clean Thoth (list<pattern>, list → list)
Thoth, but only the iotas at the top of the stack are included in the returned list. Useful if thoth is required for a phrase part way through a spell which needs to maintain a stack.
______________________________________________________________________________________________________
Inverse Screen Space Distance (vector → num)
Used instead of view angle relative to the crosshair because there's no native atan2 function, this doesn't require a conditional, is simple to calculate, and because it's monotonic with respect to view angle which is all we really want.
______________________________________________________________________________________________________
Argmax (list<num> → num)
Gets the index of the largest value in a list. Also saves a copy of that value to the ravenmind as a side effect, which can be useful.
______________________________________________________________________________________________________
Aim Assist (list<pattern>, num, list<entity> → )
Takes a list of patterns which are to be executed on an entity, a threshold value (where 0 is anything in front of you, 1 is a 90 degree cone, 2 is a 45 degree cone, etc.), and a list of entities. It then executes the patterns on an entity chosen by aim assist. Does nothing if no entity is within the given threshold. Patterns in red below are convenient examples; including them in the spell changes the type to (list<pattern> → ). Note that your own location in screen space is undefined, so this will throw a divide-by-zero mishap if you include yourself in the entity list!
Screen Space Aim Assist
Screen Space Aim Assist
Last edited by _ae on Thu Feb 23, 2023 10:48 am, edited 4 times in total.
Re: Screen Space Aim Assist
Finally had the opportunity to check what I had in-game; fixed any errors above and replaced escapes with parentheses since they're easier to keep track of when nested.
Re: Screen Space Aim Assist
I've used this to power a mist-dispersal hex, and wow it is so much easier to use than a raycast! Plus the Clean Thoth and Argmax will be very handy to have as well, so thanks for making this!
Re: Screen Space Aim Assist
Whoopsy I've opened a bug report, #422...there's no native atan2 function...
The creator of petrak@'s mods. Partially a test account, partially for me to chat in a non-admin capacity... probably just a test account.
Re: Screen Space Aim Assist
I wouldn't call that a bug, but if you add it I certainly won't complain!
Re: Screen Space Aim Assist
Issue report, then
It's good for me to have a bunch of small things I can implement to keep me from getting burned out on any one particular part of development. (Speaking of .... time to get back to work on the casting context refactor)
It's good for me to have a bunch of small things I can implement to keep me from getting burned out on any one particular part of development. (Speaking of .... time to get back to work on the casting context refactor)
The creator of petrak@'s mods. Partially a test account, partially for me to chat in a non-admin capacity... probably just a test account.
Re: Screen Space Aim Assist
Oh, now I see why you made it a bug report! I didn't know it was already supposed to be implemented, thought you just saw that offhand comment and decided to add it