Difference between revisions of "User:Felix"

From City of Hope MUSH
Jump to navigation Jump to search
imported>Felix
imported>Felix
Line 76: Line 76:
 
'''Code:'''
 
'''Code:'''
  
&cmd_look me=$\+lo?o?k? (.+):@pemit me=center(%[ Desc: [name(%1)] %],78,=);l %1;@pemit me=repeat(=,78)
+
&CMD_LOOK me=$\+lo?o?k? (.+):@pemit me=center(%[ Desc: [name(%1)] %],78,=);l %1;@pemit me=repeat(=,78)
  
 
Once you've set it, you'll also need to:<br/>
 
Once you've set it, you'll also need to:<br/>
@set me/cmd_shift=regexp
+
@set me/CMD_LOOK=regexp
  
 
-----
 
-----
 +
 
===+doing===
 
===+doing===
 
Maintains a list of @doings and sets one randomly when desired.  If you want a random one each time you log in, add +doing to your @aconnect.
 
Maintains a list of @doings and sets one randomly when desired.  If you want a random one each time you log in, add +doing to your @aconnect.

Revision as of 22:54, 12 September 2016

Player, oddly enough, of Felix. :)

Code

Feel free to use any of this code on the game if you find it useful. Except where noted, you should just have to copy and paste. Be sure to get all the attributes in a given section, though!

Before you begin, be sure to do the following:
@lock me=me
@lock/use me=me — this is the most important; it prevents other people from triggering your commands.
@lock/enter me=me&!me


Shifting Code

This code changes your name (normal in homid and glabro, ritename in crinos, hispo, and lupus), desc, and short-desc along with your actual form. Separating the code from the data makes it easy to update the names and descs later.

It's set up specifically for Garou; if you want to use it for anything else, you'll need to adjust the form names everywhere they appear. I'm willing to help customize it to other shifter types if you need a hand.

Syntax: +homid, +glabro, +crinos, +hispo, +lupus

Code:
Command:
&CMD_SHIFT me=$\+(homid|glabro|crinos|hispo|lupus):+shift [ifelse(match(%1,homid),shifter-homid,garou-%1)];&NOW_FORM me=%1;@name me=ifelse(member(homid glabro,%1),v(NAME_MAIN),v(NAME_RITE))

Once you've set it, you'll also need to:
@set me/cmd_shift=regexp

Setup:
@desc me=[u(FORM_[v(NOW_FORM)])]

&SHORT-DESC me=[v(FORM_[v(NOW_FORM)]-SHORT)]

&NAME_MAIN me=<Name>
For example: &NAME_MAIN me=Bob

&NAME_RITE me=<Ritename>
For example: &NAME_RITE me=Verbs-the-Noun

&FORM_<form> me=<Desc>
For example: &FORM_LUPUS me=Many words about me being a wolf!

&FORM_<form>-short me=<Shortdesc>
For example: &FORM_LUPUS-SHORT me=Look, a wolf!

You'll need a &FORM_<form> for each of your forms, and a &FORM_<form>-short for each form you want to have a shortdesc. If you want to change anything aside from name, desc, and short-desc, you can still use the built-in &DATA_ASHIFT set of attributes to do so.


+where

Lists people by rooms, instead of rooms by people. For example:

==================================[ +Where ]==================================
 A Place..................................... Person1 and Person2                         
 Another Place............................... Person3                        
 Yet Another Place........................... Person4                        
 UNFINDABLE.................................. Person5, Person6, Person7,     
                                              Person8, Person9, Person10, 
                                              Person11, and Person12     
===========================[ 12 Players Connected ]===========================

Syntax: +where

Code:

&SORT_DB me=sort(%0,d)

&SORT_NAME me=comp(stripansi(name(%0)),stripansi(name(%1)))

&FUN_WHERE-NAMES me=wrap(itemize(setunion(sort(elements(%q1,matchall(%q0,%0),|),i,|,|),,|,|),|),31,,,,46)

&CMD_WHERE me=$+where:@pemit me=center(%[ +Where %],78,=)[setq(2,munge(SORT_DB,setr(0,iter(setr(3,lwho()),loc(##))),setr(1,iter(%q3,name(##),,|))))][iter(sortby(SORT_NAME,setunion(%q0,,,,d)),ifelse(match(##,#-1),,ljust(left(%B[name(##)],45),45,.) [u(FUN_WHERE-NAMES,##)]),,%R)][ifelse(member(%q0,#-1),%R[ljust(%BUNFINDABLE,45,.)] [u(FUN_WHERE-NAMES,#-1)],)]%R[center(%[ [setr(4,words(%q3))] Player[ifelse(eq(%q4,1),,s)] Connected %],78,=)]


+look

Just adds a border and the name of who/what you're looking at. Handy for keeping things separate, especially if you read logs later.

===============================[ Desc: Person ]===============================
Look, it's a desc!
==============================================================================

Syntax: +look <name>
Like look, you can abbreviate it -- anything between +l and +look will work.

Code:

&CMD_LOOK me=$\+lo?o?k? (.+):@pemit me=center(%[ Desc: [name(%1)] %],78,=);l %1;@pemit me=repeat(=,78)

Once you've set it, you'll also need to:
@set me/CMD_LOOK=regexp


+doing

Maintains a list of @doings and sets one randomly when desired. If you want a random one each time you log in, add +doing to your @aconnect.

Syntax:
+doing— sets a random @doing.
+doings— lists your doings.
+doing/add <a doing>— adds a doing to your list.
+doing/del <#>— removes a doing from your list, by number.

Code:

&CMD_DOING me=$+doing:@doing/quiet [setr(0,elements(v(TXT_DOING-LIST),add(rand(sub(words(v(TXT_DOING-LIST),|),1)),1),|))][pemit(%#,@Doing set to: %q0)]

&CMD_DOING-LIST me=$+doings:@pemit %#=[center(%[ Doings %],51,=)][setq(1,strlen(words(setq(0,v(TXT_DOING-LIST)),|)))]%r%b[iter(%q0,ifelse(lt(strlen(#@),%q1),0#@,#@). ##%r,|)][repeat(=,51)]

&CMD_DOING-ADD me=$+doing/add *:@pemit %#=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[ifelse(eq(%q0,1),,s)] too long\, and has not been added.%rIt would have cut off at: [strtrunc(%0,40)])

&CMD_DOING-DEL me=$+doing/del *:@pemit %#=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.)