paissaheavyindustries / Triggernometry

Triggernometry is a plugin for Advanced Combat Tracker, intended to extend its built-in trigger system with a variety of different actions and configuration options.
MIT License
253 stars 48 forks source link

Add new functions: "switch" and "roundir" #97

Closed MnFeN closed 11 months ago

MnFeN commented 11 months ago

· Add switch function for string: switch(index, [charcode]) ${func:switch(2):north,west,south,east} = south ${func:switch(2, 48): 1022033304444} = 333 (charcode of "0" is 48)

· Add roundir function: roundir(θ, n) or roundir(dx, dy, n) Matches the given direction (in radian or as dx/dy offsets) to the direction in a circle divided into |n| segments, and returns the index of the direction. The sign of n indicates 2 division modes: north is the segment point or the border of 2 segments. roundir(-1.57,4) = 1 roundir(8,-6,-4) = 3 image

· Considering that Triggernometry could not parse function parameters with a minus sign after a space like function(1, -1) correctly, the spaces before function parameters in autofill are deleted, like roundir(θ,n).

MnFeN commented 11 months ago

Adding more features and some of them conflict with this one. Will reopen later.