Let's see if I can explain how I would do it.
First off you need to determine if this is a variable that needs to be remembered after a room change or if you need it to always start at 0 when reentering room. If you need it after a room change then it needs to be a global variable placed in the main script. If you need it to reset to the beginning at room change, then declaring it as a local variable in the roomscript is the way to go. The only difference is where the variable is declared, so lets throw a name out there.
iSayHello = 0
Now lets put the lil sucker to use. In a case like this with an integer counter, I would strongly suggest using a switch. So now we may as well use it to count and report. So let's take care of whenever the user types "hello"
(if(Said('hello'))
(switch(iSayHello)
(case 0 Print("Well hello to you too!"))
(case 1 Print("Man I heard you, I said hello too, geesh."))
(case 2 Print("I don't know why you say goodby, I say hello"))
(default Print("you are being ignored."))
)// end switch
++iSayHello // increase counter
)// end said helloAnd there you go. simple enough right? Of course, the process would be similar for counting anything.