Difference between revisions of "Code"

From Masq
m
m
Line 65: Line 65:
 
|-
 
|-
 
|<br />
 
|<br />
'''This code lists the @doings in your list.{{pad|12em}}'''
+
'''This code lists the @doings in your list.'''
 
|<br />
 
|<br />
 
'''Syntax: ''+doing/list'''''
 
'''Syntax: ''+doing/list'''''

Revision as of 23:07, 30 January 2011

Various snippets of code can make one's life easier (or more complicated), and this is where you can grab them for your character. Copy them from the page, then paste them into your MU* client, and enjoy!

Contents

Texting Code

This code is for sending IC text messages from a phone. You'll need all three attributes. Syntax: +text name=message
&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.

Directed +Where

This code works like +where, but for a specific person. Syntax: +where name
&cmd-where me=$+where *:think [ansi(hr,REPORT:)] [setq(0,pmatch(%0))][if(%q0,[name(%q0)] [if(hasflag(%q0,connect),[if(loc(%q0),is currently at: [name([loc(%q0)])],cannot currently be found.)],is not currently online.)],"[capstr(%0)]" does not match any player.)]
Original code by Petra, modified by Jai

Idle Time Checker

This code reports how long a specific person has been idle. Syntax: +idle name
&cmd-idle me=$+idle *:think [ansi(hr,REPORT:)] [setq(0,pmatch(%0))][if(%q0,[name(%q0)] [if(hasflag(%q0,connect),has been idle [exptime(idle(%0))].,is not currently online.)],"[capstr(%0)]" does not match any player.)]
Original code by Petra, modified by Jai

Desc Identifier

This code prepends the desc of the person you're looking at with a line identifying whose desc it is. Syntax: +l name
&cmd-look me=$+l *:@pemit me=[repeat(*,78)]%r[center(Desc of [name([num(%0)])],78)]%r[repeat(*,78)]%r;l %0
Code by Petra, with some awesome help refining it from Jai

Random @Doing Picker

This code sets an @doing chosen randomly from your list. Syntax: +doing
&cmd-doing me=$+doing:@doing/quiet [setr(0,pickrand(v(txt-doing_list),|))][pemit(me,@Doing set to: %q0)]

This code adds an @doing to your list of available @doings.


Syntax: +doing/add yourdoing

&cmd-doing_add me=$+doing/add *:think ifelse(lte(strlen(%0),45),set(me,txt-doing_list:[setunion(v(txt-doing_list),%0,|)]) The following new @doing was set: %0,That @doing is [setr(0,sub(strlen(%0),45))] character[if(eq(%q0,1),,s)] too long\, and has not been added.%rIt would have cut off at: [strtrunc(%0,45)])

This code lists the @doings in your list.


Syntax: +doing/list

&cmd-doing_list me=$+doing/list:think [center(Doings,49,=)][iter(v(txt-doing_list),%r[ifelse(lt(strlen(#@),strlen(words(v(txt-doing_list),|))),0#@,#@)]. ##,|)]%r[repeat(=,49)]
Original random doing/doing adding code by Haruspex, modified and +doing/list added by Jai.