Actually, as I described above, I think you're just seeing how how lock codes in rules are designed to work. The truth evaluation will only change if the last lock code entered is different from the previous lock code. If you want something to happen (or at least be evaluated) every time a lock code is used regardless of whether it's different from the last one, you need a trigger (or a triggered rule).
I'm not sure if there's a lot of documentation on the behavior of lock codes in rules, but this post from Bruce in another thread does touch on the subject (this post plus a few more he made later in this thread): RM - Notification based on Lock code user - Help - #3 by bravenel
I'm not sure how using a virtual device or global variable would help, but maybe I just don't understand part of what you'd be trying to evaluate. You can still use rules/conditions in a triggered rule, though I'm not sure that's even necessary for the original poster's case.