The ialmark you're using is basically like the hashtable in the threads I mentioned.
But unfortunately the ialmark is not always as robust as hashtables are. For example, your method requires a timer to unset the ialmark after N seconds. In a hashtable, the item can be easily saved-to-disk loaded-from-disk matched with wildcards created with limited lifetime etc. The 1 big advantage the ialmark has is that the tag follows them when they change nick. Unfortunately the timer is still going to perform a command against a nick that doesn't exist anymore
You can have a hashtable with items that cool down the 1 nick for 30 sec
hadd -mu30 table $+(greet.,$nick) 1
or
hadd -z table $+(greet.,$nick) 30
then in the on text event
if ($hget(table,$+(greet.,$nick)) goto ignore-this
To handle during a nick change, the latter makes it a little easier, since the item value has the countdown time in it, so in the ON NICK event:
if ($hget(table,$+(greet.,$nick)) {
hadd -z table $+(greet.,$newnick) $v1
hdel table $+(greet.,$nick)
}
The above applies to each nick across all channels and all networks, so to prevent collisions, the itemname would need to be named something like
$+(greet.$network,$chan,.,$nick)
for a per channel global you just have it be an item named
$+(greet.$network,$chan)
Since ialmark is taking care of by having a separate $ial per network, you just put an ialmark on yourself that's checked against everyone
$ialmark($me,$+($chan,.greeted)
.ialmark -n $me $+($chan,.greeted) 1
Obligatory reminder that $ial has the behavior that each time you get disconnected that the IAL vanishes, and so do all the marks, which is fine for this use case. However the ialmark also goes away each time that nick no longer shares any channels with you. So that means if you get kicked from your only channel, then $ial is now empty and all marks are gone. Likewise if the 1 person /part the only channel they share with you, the ialmark goes byebye along with their address in the $ial