So after reading some of my favorite guiatrist used this book I decided to find a pdf of it on the Internet I came across this
I know this is not the original one but its a lot easier to figure out etc.
So basically you play part of a scale Eg E string 5 8 and the pattern is 124 so it is E -5 7 8 8 11 12. Is this the idea ? But what if the notes don't fit the key
You can play any note against any other note (or chord). Some clash, some don't. Pro-players rarely stick 100% to the "correct" notes. This just means you need to know which notes aren't in the key of the moment (maybe the tune passes through many keys), and know how to resolve these to the nearest scale note, preferably one which itself doesn't have its own tendency to resolve also. This is basically what chromatic playing is all about. You need to combine this with a knowledge of strong (on-) and weak (off-) beats. Check out https://soundcloud.com/jerry-kramskoy-1/tips-for-using-chromaticism for more detail, and a few simple examples.

But it's really important to be able to handle the scale's inherent tendency tones (e.g. the 2, 6, 4 and 7 in major scale, with 7 having the strongest tendency, and normal resolutions (whihc can be ignored if you want to play games, are 2->1, 6->5, 4->3, 7up to 1.) Each common scale has its own tendency tones (those other than the pitches in the tonic triad).

There are tons of tricks to be learned here.