try with "on success"?

I have a script running that will not work 99.9% of the time. When it does succeed, I want it to display dialog. So, I’m looking for the opposite of “on error” any ideas?

There is no opposite, as progression from one line’s events to the next is the default behavior. Specify your dialog at any point that follows your attempted event(s), is prior to an “on error,” and is within a “try.” That said, if your script isn’t working 99% of the time, you probably don’t want to go sticking it in a try block, as that obscures the display of errors that can actually help you.

It’s not an error I need to debug, it’s trying different things until it finds the right one.

Can’t that happen at/near the end of the try block?

Example:

try
	set example to random number from 1 to 10
	-- An errors occurs for some reason.
	if example ≤ 5 then error "Random number was too low." number example
	
	display dialog example
on error errMsg number errNum
	return {errNum, errMsg} -- Just for viewing in Script Editor
end try