/loaded abegreet.tf ;;; ;;; Say Hi triggers ;;; ; Old one from when I used who friend rather than friend online ;/set friend_flags=^[[]([^]]+)[]] ([(]Wanted[)] )?([(]TRAITOR[)] )?([(]Laser[)] )?([[]Helper[]] )?([[]Advisor[]] )?([(]RAIDER[)] )? ;format of "friend online" line is 0 or more spaces, one or more digits, closed parenth, space, hyphen, space, then name /set friend_flags=^ *[0-9]+[)] - ;initialize the list variable /set current_friends= ;high priority non-fallthrough trig for myself...no need to greet self /eval /def -p4 -mregexp -t"$[friend_flags]Abelinc +[(]Online[)] +$$" hi_myself = ;lowish priority trigger for "anyone in the output" /eval /def -p2 -mregexp -t"$[friend_flags]([A-Za-z]+) +[(]Online[)] +$$" hi_generic = /add_friend %%P1 ;function to create a mid-priority trigger to override the normal one, used for nicknames /def create_friend_trig = \ /if ({L}=~"nick") \ /eval /def -1 -p3 -mregexp -t"$[friend_flags]%%{-L2} +[(]Online[)] +$$$" hi_%%{-L2} = /add_friend %%{L2}%;\ /endif ;iterate through that function on each line of the textfile "abe.friends.tf". Format is: ;Darktears Darkie nick ;Eureka Rikki nick /quote -S -dexec /create_friend_trig '"abe.friends.tf" ;trig to signify the end of the friend online output /def -1 -mglob -t"'Friend wannabe' will show people who want to be your friend." hi_done = /send_hi_friend ;function that the triggers call, to add names to the variable in a comma-separated list /def add_friend = \ /if (current_friends=~"") /eval /set current_friends=%{1} %; \ /else /eval /set current_friends=%{current_friends}, %{1} %; \ /endif ;actually send the greeting, and undefine the triggers /def send_hi_friend = \ ftalk %{friend_salutation} %{current_friends} :) %; \ /quote -S /untrig_friends `"/list -s hi_*" /def untrig_friends = /undef %{L1} ;determine what to say in greeting, based on time of day /if ((5<(ftime("%H", time())))&((ftime("%H", time()))<=11)) \ /set friend_salutation=Morning %; \ /elseif ((12<=(ftime("%H", time())))&((ftime("%H", time()))<16)) \ /set friend_salutation=Afternoon %; \ /else /set friend_salutation=Evening %; \ /endif