boomninjavanish / twitchPlaysTheSynth

0 stars 0 forks source link

tps.main - crash when a number is included in custom !bang inside the mapper #33

Closed memorecks closed 3 years ago

boomninjavanish commented 3 years ago

Problem begins here: https://github.com/boomninjavanish/twitchPlaysTheSynth/blob/cda752cb9aee6f6ebeb8610e71a68debb3156dee/tpts.main/node_content/parser.js#L16

let typeRegex = /^![a-zA-Z]+/; // the inputKey with exclamation point
let matches = inputMessage.match(typeRegex); // get the inputKey from the message
let noAhhh = ""; // input key with out the AHHHH!!! (exclamation point)

if(matches.length > 0){
    noAhhh = matches[0].slice(1); // strip the exclamation point from the key for paramamapper messages

No matches occur when numbers are included

boomninjavanish commented 3 years ago

Can be fixed when working on #16 and #31

Will need to consider adding testing for null--then output error indicating no matches found (the error message already exists on line 38.)

May also consider using regex for detecting sequence number or change syntax for indicating an optional sequence number. Maybe something like this:

!m[2] 0[0.5] 1[0.5] 2[0.5] -5[0.5]...

Where the number two contained within the brackets after the !m is the sequencer number.

memorecks commented 3 years ago

i prefer keeping it as !m2 and not !m[2] ... but if this needs to happen because of coding.. then all good! i think i've just trained myself to type !m1 and !m2 now lol

boomninjavanish commented 3 years ago

Just notating this here so I do not lose the idea. Solution to keep !m1, !m2, ... etc:

In tpts.paramamapper:

In parser.js: