Talker Page

From Gwen Morse's Wiki
Jump to: navigation, search
; talker-page.tf - Convert MUSH-style page commands to talker-style tell commands.


/loaded __OWNLIB__/talker-page.tf

/def -i -T'lpp.talker' -h'SEND page' talker-page = /echo -w %% You last paged: %talker_lastpaged
/def -i -T'lpp.talker' -h'SEND p' talker-p = /talker-page
/def -i -T'lpp.talker' -h'SEND page *' talker-page_witharg = /talker_page %-1
/def -i -T'lpp.talker' -h'SEND p *' talker-p_witharg = /talker_page %-1

/def -i talker_page = \
	/split $(/escape \{\} %{*}) %; \
	/if ({P2} !/ "") \
		/let tell_player=%P1 %; \
		/let tell_message=%P2 %; \
		/set talker_lastpaged %P1 %; \
	/else \
		/if ({talker_lastpaged} !/ "") %; \
			/let tell_player=%talker_lastpaged %; \
			/let tell_message=%P1 %; \
		/else \
			/echo -w %% You haven\'t used \'page\' on a talker yet. %; \
			/return 1 %; \
		/endif %; \
	/endif %; \
	/if (substr({tell_message},0,1) =~ ':') \
		/let tell_cmd=, %; \
		/let tell_message=$[substr({tell_message},1)] %; \
	/else \
		/let tell_cmd=. %; \
		/let tell_message=%tell_message %; \
	/endif %; \
	/send %tell_cmd%tell_player %tell_message