Difference between revisions of "Code"

From Masq
m
m
Line 5: Line 5:
 
|-
 
|-
 
|'''This code is for sending IC text messages from a phone.  You'll need all three attributes.'''
 
|'''This code is for sending IC text messages from a phone.  You'll need all three attributes.'''
|width=350px|'''Syntax: ''+text name=message'''''
+
|width=300px|'''Syntax: ''+text name=message'''''
 
|-
 
|-
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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!)
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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!)
Line 20: Line 20:
 
|-
 
|-
 
|'''This code works like +where, but for a specific person.'''
 
|'''This code works like +where, but for a specific person.'''
|width=350px|'''Syntax: ''+where name'''''
+
|width=300px|'''Syntax: ''+where name'''''
 
|-
 
|-
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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.)]
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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.)]
Line 31: Line 31:
 
|-
 
|-
 
|'''This code reports how long a specific person has been idle.'''
 
|'''This code reports how long a specific person has been idle.'''
|width=350px|'''Syntax: ''+idle name'''''
+
|width=300px|'''Syntax: ''+idle name'''''
 
|-
 
|-
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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.)]
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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.)]
Line 42: Line 42:
 
|-
 
|-
 
|'''This code prepends the desc of the person you're looking at with a line identifying whose desc it is.'''
 
|'''This code prepends the desc of the person you're looking at with a line identifying whose desc it is.'''
|width=350px|'''Syntax: ''+l name'''''
+
|width=300px|'''Syntax: ''+l name'''''
 
|-
 
|-
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&cmd-look me=$+l *:@pemit me=[repeat(*,78)]%r[center(Desc of [name([num(%0)])],78)]%r[repeat(*,78)]%r;l %0
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&cmd-look me=$+l *:@pemit me=[repeat(*,78)]%r[center(Desc of [name([num(%0)])],78)]%r[repeat(*,78)]%r;l %0
Line 53: Line 53:
 
|-
 
|-
 
|'''This code sets an @doing chosen randomly from your list.'''
 
|'''This code sets an @doing chosen randomly from your list.'''
|width=350px|'''Syntax: ''+doing'''''
+
|width=300px|'''Syntax: ''+doing'''''
 
|-
 
|-
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&cmd-doing me=$+doing:@doing/quiet [setr(0,pickrand(v(txt-doing_list),|))][pemit(me,@Doing set to: %q0)]
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&cmd-doing me=$+doing:@doing/quiet [setr(0,pickrand(v(txt-doing_list),|))][pemit(me,@Doing set to: %q0)]
Line 74: Line 74:
  
 
[[Category:Help]]
 
[[Category:Help]]
 +
__NOEDITSECTION__

Revision as of 23:05, 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.