Difference between revisions of "Code"

From Masq
m
Line 15: Line 15:
 
|Original code by [[Zack]], modified by [[Jai]].
 
|Original code by [[Zack]], modified by [[Jai]].
 
|}
 
|}
 +
  
 
== Directed +Where ==
 
== Directed +Where ==
Line 26: Line 27:
 
|Original code by [[Petra]], modified by [[Jai]]
 
|Original code by [[Petra]], modified by [[Jai]]
 
|}
 
|}
 +
  
 
== Idle Time Checker ==
 
== Idle Time Checker ==
Line 37: Line 39:
 
|Original code by [[Petra]], modified by [[Jai]]
 
|Original code by [[Petra]], modified by [[Jai]]
 
|}
 
|}
 +
 +
 +
== Time Connected Checker ==
 +
{|width=100%
 +
|-
 +
|'''This code tells you how long a person's been logged on.'''
 +
|width=300px|'''Syntax: ''+conn name'''''
 +
|-
 +
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&cmd-connected me=$+conn *:think ansi(hr,REPORT): [setq(0,pmatch(%0))][if(%q0,[name(%q0)] [if(hasflag(%q0,connect),has been connected for [exptime(conn(%0))].,is not currently online.)],"[capstr(%0)]" does not match any player.)]
 +
|-
 +
|colspan=2| Code by [[Petra]], mostly just a rewrite of the idle code which [[Jai]] helped make swanky.
 +
|}
 +
  
 
== Desc Identifier ==
 
== Desc Identifier ==
Line 48: Line 63:
 
|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 ==
 
== Random @Doing Picker ==
Line 79: Line 95:
 
|-
 
|-
 
|colspan=2|Original random doing code by [[Haruspex]]; +doing and +doing/add modified and +doing/del and +doing/list added by [[Jai]].
 
|colspan=2|Original random doing code by [[Haruspex]]; +doing and +doing/add modified and +doing/del and +doing/list added by [[Jai]].
 
== Time Connected Checker ==
 
{|width=100%
 
|-
 
|<br />
 
'''This code tells you how long a person's been logged on.'''
 
|<br />
 
'''Syntax: ''+conn name'''''
 
|-
 
|colspan=2 style="padding: 1em;border: 1px dashed #2f6fab;color: black;background-color: #f9f9f9;line-height: 1.25em;font-family: monospace;"|&cmd-connected me=$+conn *:think ansi(hr,REPORT): [setq(0,pmatch(%0))][if(%q0,[name(%q0)] [if(hasflag(%q0,connect),has been connected for [exptime(conn(%0))].,is not currently online.)],"[capstr(%0)]" does not match any player.)]
 
|-
 
|colspan=2| Code by [[Petra]], mostly just a rewrite of the idle code which [[Jai]] helped make swanky.
 
 
|}
 
|}
 
[[Category:Help]]
 
[[Category:Help]]
 
__NOEDITSECTION__
 
__NOEDITSECTION__

Revision as of 14:10, 2 March 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


Time Connected Checker

This code tells you how long a person's been logged on. Syntax: +conn name
&cmd-connected me=$+conn *:think ansi(hr,REPORT): [setq(0,pmatch(%0))][if(%q0,[name(%q0)] [if(hasflag(%q0,connect),has been connected for [exptime(conn(%0))].,is not currently online.)],"[capstr(%0)]" does not match any player.)]
Code by Petra, mostly just a rewrite of the idle code which Jai helped make swanky.


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 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)]

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 deletes a @doing from your list, using the reference number from +doing/list.


Syntax: +doing/del #

&cmd-doing_del me=$+doing/del *:think ifelse(setr(0,elements(setr(1,v(txt-doing_list)),%0,|,|)),set(me,txt-doing_list:[elements(%q1,setdiff(lnum(add(words(%q1),1)),%0),|,|)]) You have removed "%q0" from your list of @doings.,That is not a number corresponding to an @doing in your list.)
Original random doing code by Haruspex; +doing and +doing/add modified and +doing/del and +doing/list added by Jai.