I tried that. Talking to myself like an army sergeant would work in the short term, sometimes, but it never lasted. And in the end, when the backslide came, it just made me feel like more of a loser (and not in a good way!
I've read a lot about coaching and, as counterintuitive as it may sound, positive reinforcement gets far better results than either negative reinforcement or even just pointing out where an athlete is going wrong. I know - it surprises me too, but then, we humans are complex.
Don't get me wrong: I don't kid myself or make excuses but I also talk to myself in a kind, supportive way now. For example, instead of saying, "Oh, you've had such a bad day; I understand why you want that chocolate; go for it" OR "Get your head in the game, goofus! Put down that chocolate!" I will say, "I think you're feeling is tired and stressed, not hungry. How about a bath? No? how about a cup of tea and phone a friend?" .... and so on.
If I overindulge, I don't beat myself up, not because I'm so delicate that I can't take it but because it is utterly counterproductive - it actually wastes energy. I ask, "What can I do now to move in the right direction?" I heard this the other day, which just seems genius to me: Losing weight, like so much of life, is a journey. If you get a flat tire on a road trip, you don't get out and slash the rest of the tires. You get the flat fixed and keep going.
This seems to be working a lot better for me but I know that becoming healthier is a dynamic situation. You never "get there." While I can have markers along the way, I am never going to reach a finish line, where I can say, "There! I've done it and now I can relax (or gloat!)." It's an ongoing process, day after day, year after year.
I think THE most challenging thing for the vast majority of people is to overcome inertia, to transition from doing nothing to doing something. What has worked for me is to find a couple of positive things, TINY LITTLE positive things, small enough that no matter how bad the day is, I can still do those things. And just keep on doing them. It seems useless at first but it's not: it builds self-confidence and restores faith in oneself. It gives me evidence that change is possible. And of course, when I do those tiny little things, 80 percent of the time, I do more than I set out to. But on the days when I can only do those tiny things, I've still succeeded.
Best wishes to all in your journeys.