Best way to do something only once, in the same way as ofKeyPressed etc

Hi all,

What would be the best way to recreate something like ofGetKeyPressed within my code, where a unique event happens only once and doesn’t get caught in the program loop?

Do I need to look into ofEvent?

In the past I’ve concocted a series of conditions for this sort of thing, which can get messy and confusing.

Just seeing if there is a simple way?

Thanks

You can do a fast version (fast to do) with

ofSendMessage("messagehere");

and do your action in

void ofApp::gotMessage(ofMessage msg){
}

Hi, sorry for the slow response. I’m gonna try this out! Thanks!