Code

From Masq
Revision as of 14:51, 22 November 2010 by Jai (Talk | contribs)

Various snippets of code can make one's life easier (or more complicated), and this is where you can grab them for your character.

Texting Code

This code is for sending IC text messages from a phone. Copy and paste all three attributes onto yourself, then use +text whoever=whatever to send your messages.
&cmd-text me=$+text *=*:think if(isdbref(num(*%0)),[if(lte(strlen(%1),160),[u(fun-text_send,%0,%1)],[u(fun-text_proc,%0,%1)])],"%0" doesn't seem to be a valid player. Please try again!)
&fun-text_proc me=[setq(0,%1)][setq(1,mid(%q0,0,160))][if(match(mid(%q0,160,1), ),[setq(0,mid(%q0,160,strlen(%q0)))],[setq(2,[strtrunc(%q1,sub(strlen(%q1),strlen(last(%q1))))])][setq(1,%q2)][setq(0,mid(%q0,strlen(%q2),strlen(%q0)))])][u(fun-text_send,%0,%q1)][if(strlen(%q0),u(fun-text_proc,%0,%q0))]
&fun-text_send me=[pemit(%#,You text to [name(*%0)]: %1)][pemit(num(*%0),You receive a text from %N: %1)]
Original code by Zack, modified by Jai.