NumTimesTalkedToGT(0) is what you need, yes. It definitely works for me in Assassinations, for one. However, while it works well for non-joinable quest NPCs, with a joinable NPC, you might run into problems with keeping score later(not to mention your current problem). I would rather advise you
1) to use a Global variable for that:
IF ~Global("PrefixedVariableFirstDLG","GLOBAL",0)~ f
SAY ~Hello~
++ ~Hi.~ DO ~SetGlobal("PrefixedVariableFirstDLG","GLOBAL",1)~ + control
++ ~Go away.~ DO ~SetGlobal("PrefixedVariableFirstDLG","GLOBAL",1)~ + gamble
IF ~~ THEN REPLY ~I don't have time for such a stupid person.~ DO ~SetGlobal("PrefixedVariableFirstDLG","GLOBAL",1)~ EXIT
END
IF ~Global("PrefixedVariableFirstDLG","GLOBAL",0)~ second
...
2) Try use shorthand for scripting(the sort I wrote above; also, if you go to
http://www.pocketplane.net/oneday and download, say, Coran, his code is a good template, too).
3) If you're serious about your NPC, at some point you might need to register a unique prefix for ALL your filenames and variable names here to prevent incompatibilities:
http://forums.blackwyrmlair.net/index.php?showtopic=113 You definitely shouldn't be using M#, because it's a conflicting prefix, unfortunately.
EDIT: And you probably will get better results if you post EXACT code you have a problem with, because rephrasing it probably loses something in the process(perhaps the very error).