Based on recent experimentation, SetGlobal(), IncrementGlobal(), and SetGlobalTimer() all force the character out of stealth.
Perhaps it's old news, but it surprised me. Sample script code was as follows:
IF
ActionListEmpty()
!GlobalTimerNotExpired("TEST","LOCALS")
THEN
RESPONSE #100
SetGlobalTimer("TEST","LOCALS",THREE_ROUNDS)
END
Run that as your script, and then click on the stealth button until the character hides. He will un-hide as soon as the timer expires. Similar tests can be done with SetGlobal() and IncrementGlobal().
I was running a "try to hide" counter for the character, so that he could initially try frequently, and then try less frequently as he continued failing.
However, once the PC succeeded and hid, resetting the counter to zero forced the character out of hiding. Experimentation revealed the cause as listed above.
My ultimate workaround was to have non-hidden PC characters reset the "try to hide" global variable per PC as appropriate if hidden. Works OK.