Hey,
Are there any options to do more advanced CaseBranch matchings?
Either by using regexp or maybe there are some string search/manipulation functions?
I’m programming Matrix, 8×8 grids, usually rows are different functions and columns are for each of 8 tracks.
Functionalities are exactly the same for each track.
With your previous help, I managed to cut a lot of code redundancy, but I’m still left with these annoying repetitions.
If I could regexp match or search CurrentCaseValueString(), I could probably extract the track value from the caseValue, and cut even more.
Example:
// Case catchers
// Orbit choice
CaseBranch "[1] Orb"
SetCurrentCaseValue "TR Orbit" 1 {currentCaseOptionValueFloat(0)}
MacroRestart
BreakCaseBranch
CaseBranch "[2] Orb"
SetCurrentCaseValue "TR Orbit" 2 {currentCaseOptionValueFloat(0)}
MacroRestart
BreakCaseBranch
// ^^^ this goes all the way to 8 repetitions ^^^
// Then there's a specific function it performs:
CaseBranch "TR Orbit"
// params: track id; value
$tr$ = {currentCaseOptionValueInt(0)} // track id
$tr_i$ = {floor(scale(currentCaseOptionValueFloat(1), 3, 124, 0, $tr_orbits_count$))} // which trajectory
$tr_orbit$ = {$tr_orbits[tr_i]$} // trajectory string
$tr_msg$ = {"" + $tr$ + "_TrajectoryBoundaries"} // construct message to send
InsertSendMessage dt1 $tr_rank$ $tr_msg$ $tr_orbit$
BreakCaseBranch