Additional contextual alternates inside pseudo random Mekkablue script

Hi,
I’m design a custom “handwritte” font for a comics artist and I was using the Mekkablue pseudorandom script but the font needs some additional contextual alternates.
Actually I have a group of initial “j”, a “r” that changes if is final or if it’s next to a b, l, h, etc., and a t_t ligature.
The thing I want to accomplish is add this contextual alternates to the pseudoramdon script, but I can’t get it to work.
At the moment, while I’m trying to make the Mekkablue script work, I use the old rotation trick and it works fine, but I prefer the pseudorandom. I suppose that a “lookup” will work, but I really don’t know where to add it.
I paste here the code I managed to work:

sub space @jota’ by @jini;
sub @erre@pared by @ralt;
sub t t by t_t;
lookup rotate {
sub @calt00 @calt00’ by @calt01;
sub @calt01 @calt00’ by @calt02;
sub @calt02 @calt00’ by @calt03;
} rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;
lookup rotate ;