Rules for T-Display with TASMOTA firmware

Please use code fences, otherwise it’s impossible to understand your rule

And after that: What exactly are you trying?
I’ve understood that you want to have a rule that shall display different content on a certain value of your variable “contatore_pagina_display” correct?

Where shall the above code run? Is it a rule, is it a script? What is calling that script?
Are you running on openHAB 2 or openHAB 3?

Which userinterface (MainUI, BasicUI, Habpanel) are you using on your display?