A draft of some PROB tweaks I made for teletype

Hello All,
I built a firmware release based on me branching the latest for you all to play with if you want some probability tweaks

  • PROB can now use an ELSE Conditional
  • PRB is an alias of PROB
  • new OP WTOSS x ( 0-100) (alias WT x) works similar to PROB but returns a 1 if true or 0 if false

example/

// Simple PROB with ELSE
PRB 70:  TR.P 1
ELSE: TR.P 2

// Simple WTOSS (90 % chance triggering gate one ... if not, get 4
TR.P ? WT 90 1 4 

// Combining for Cascading

PRB 30: TR.P 1  // 30 % chance triggering gate 1
ELIF WT 70: TR.P 2 // now a 70% chance of triggering gate 2
ELSE: TR.P 3 // If no successful of probabilities then trigger gate 3 
6 Likes

What hapens if I have an IF statement before PROB? Is the ELSE adressing the PROB or the IF?

Nice, I could see myself using these all the time! My vote for a PR!

1 Like

It is a toplevel modulator, so that is why I added a WTOSS (WT). You can do something like:

IF EQ X 100: TR.P 1
ELIF WT 80: TR.P 2
ELSE: TR.P 3

the ELSE would be addressing the PROB in your statement based on the order of operations.

This is a tricky change because it modifies the behavior of existing scripts. Consider:

IF A: B + B 1
PROB 30: B - B 1
ELSE: SCRIPT B

Currently, the ELSE is triggered if the IF doesn’t fire. Your change would cause PROB to take over the else-state and now ELSE is controlled by the PROB.

I think WTOSS is a great idea and that by itself would allow you to accomplish the same thing; just use IF WTOSS instead of PROB, and now you have access to ELSE in a backwards-compatible way. Not quite as terse, but it doesn’t change behavior of existing scripts, and it also keeps the IF/ELSE, EV/OTHER pairing neat (following that pattern, PROB should get its own unique paired “other case” operator, but I don’t think it really needs one if you have something like WTOSS.)

4 Likes

Yeah, that’s exactly why I asked, the way ELSE is set up right now it doesn’t need to immediately follow the IF statement, and changing that would constitute a breaking change which seems to be a nono for updates.

I think WTOSS is a lovely addition and I agree with @Dewb, if it’s introduced then the requirement for ELSE to work with PROB is fully substituted, unless I’m missing something.

Also +1 to PRB as an alias for PROB

1 Like