if the coupon code in the discount rule "MGPS", then set the "realCode" session variable value to ""MGPS" the trigger for the set session value behavior for the realCode session variable should be Before Page load.
if you are having trouble, send me a copy of the page in a zip archive so I can see the code.