Difference between revisions of "Code"

From Masq
Line 4: Line 4:
 
{|
 
{|
 
|-
 
|-
|'''This code is for sending IC text messages from a phone.  You'll need all three attributes. Syntax: ''+text name=message'''''
+
|'''This code is for sending IC text messages from a phone.  You'll need all three attributes.{{pad|3em}} Syntax: ''+text name=message'''''
 
|-
 
|-
 
|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!)
 
|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 13: Line 13:
 
|-
 
|-
 
|Original code by [[Zack]], modified by [[Jai]].
 
|Original code by [[Zack]], modified by [[Jai]].
|-
 
 
|}
 
|}
  
Line 19: Line 18:
 
{|
 
{|
 
|-
 
|-
|'''This code works like +where, but for a specific person. Syntax: ''+where name'''''
+
|'''This code works like +where, but for a specific person.{{pad|3em}} Syntax: ''+where name'''''
 
|-
 
|-
 
|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.)]
 
|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.)]
 
|-
 
|-
 
|Original code by [[Petra]], modified by [[Jai]]
 
|Original code by [[Petra]], modified by [[Jai]]
|-
 
 
|}
 
|}
  
Line 30: Line 28:
 
{|
 
{|
 
|-
 
|-
|'''This code reports how long a specific person has been idle. Syntax: ''+idle name'''''
+
|'''This code reports how long a specific person has been idle.{{pad|3em}} Syntax: ''+idle name'''''
 
|-
 
|-
 
|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.)]
 
|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.)]
 
|-
 
|-
 
|Original code by [[Petra]], modified by [[Jai]]
 
|Original code by [[Petra]], modified by [[Jai]]
|-
 
 
|}
 
|}
  
Line 41: Line 38:
 
{|
 
{|
 
|-
 
|-
|'''This code prepends the desc of the person you're looking at with a line identifying whose desc it is. Syntax: ''+l name'''''
+
|'''This code prepends the desc of the person you're looking at with a line identifying whose desc it is.{{pad|3em}} Syntax: ''+l name'''''
 
|-
 
|-
 
|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
 
|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
 
|-
 
|-
 
|Code by [[Petra]], with some awesome help refining it from [[Jai]]
 
|Code by [[Petra]], with some awesome help refining it from [[Jai]]
|-
 
 
|}
 
|}
 +
 +
== Random @Doing Picker ==
 +
{|
 +
|-
 +
|'''This code sets an @doing chosen randomly from your list.{{pad|3em}} Syntax: ''+doing'''''
 +
|-
 +
|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)]
 +
|-
 +
|<br />
 +
'''This code adds an @doing to your list of available @doings.{{pad|3em}} Syntax: ''+doing/add yourdoing'''''
 +
|-
 +
|style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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)]
 +
|-
 +
|<br />
 +
'''This code lists the @doings in your list.{{pad|3em}} Syntax: ''+doing/list'''''
 +
|-
 +
|style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&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 been: [strtrunc(%0,45)])
 +
|-
 +
|Original random doing/doing adding code by [[Haruspex]], modified and +doing/list added by [[Jai]].
 +
 
[[Category:Help]]
 
[[Category:Help]]

Revision as of 22:49, 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_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)]

This code lists the @doings in your list.  Syntax: +doing/list

&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 been: [strtrunc(%0,45)])
Original random doing/doing adding code by Haruspex, modified and +doing/list added by Jai.