On that, you are very correct @LUCKMCFLY.
I do believe that emotions is something that will always arise no matter how one tries to control it but one good way to control it is to have a set up rule that the gambler must follow, like the aspect of controlling how much that the player is willing to lose, just as you said. I think if a player do write down those rule and always read it out loud to themselves before going to the casino, it could help.
You know I’m trying to visualize and picture this, a gambler reciting his gambling rules like a country’s national anthem every single time he wants to go to the casino

it sounds kinda hilarious, but it could actual turn out to have quite an effective result, though this may not completely make a gambler gain total control over his emotions when gambling, but setting gambling limits and rules and memorizing those rules could actually help in somewhat way. When it comes to emotions, not just in gambling, it is something that sometimes have a mind of its own, more like a reflex and you don’t just know when it kicks in, but we can train ourselves to try to control those emotions (though not completely) especially when it comes to making decisions that concerns our personal finances.