Difference between revisions of "User:Felix"
imported>Felix (→+doing) |
imported>Felix m |
||
Line 4: | Line 4: | ||
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! | 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:<br/> | + | <font color="red">Before you begin, be sure to do the following:<br/> |
@lock me=me<br/> | @lock me=me<br/> | ||
'''@lock/use me=me''' — this is the most important; it prevents other people from triggering your commands.<br/> | '''@lock/use me=me''' — this is the most important; it prevents other people from triggering your commands.<br/> | ||
− | @lock/enter me=me&!me<br/> | + | @lock/enter me=me&!me</font><br/> |
----- | ----- | ||
===Shifting Code=== | ===Shifting Code=== |
Revision as of 16:47, 26 March 2017
Player, oddly enough, of Felix. :)
Contents
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)$:@switch match(v(NOW_FORM),%1)=1,think You're already in %1 form.,{+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,=)]
Specific +where
Reports where a single person is, for those times you aren't looking for anyone else.
Syntax: +where <name>
>>> Person (P) is at Some Specific Room.
Code:
&CMD_WHERE-NAME me=$+where *:think >>> [switch(match(setr(0,pmatch(%0)),#-1)[gte(conn(%q0),0)],1?,'%0' is not a player.,00,[name(%q0)] \([get(%q0/ALIAS)]\) is not currently online.,name(%q0) \([get(%q0/ALIAS)]\) is [ifelse(match(setr(1,loc(%q0)),#-1),currently unfindable,at [name(%q1)])].)]
+here
Reports how many people are in the room, and their names.
Syntax: +here
>>> People in room: 3 (A_Person, Another_Person, and That_Person)
Code:
&CMD_HERE me=$+here:think >>> People in room: [words(setr(0,iter(lcon(here),ifelse(hasflag(##,connected),##,))))] ([itemize(sort(iter(%q0,name(##),,|),,|),|)])
+friends
A +who/w replacement. Slightly more compact.
=[+friends]=============[idle]=[con]==[where]================================= A-Friend (AF) 11m 00:20 ??? AnotherFriend (Ann) 6m 07:56 Somewhere You Can See Friend (F) 0s 01:55 Another Place You Can See ==============================================================================
Syntax: +friends
Code:
&SORT_NAME me=comp(stripansi(name(%0)),stripansi(name(%1)))
&CMD_FRIENDS me=$+friends:@pemit me=trim(iter(sortby(SORT_NAME,v(LIST_WATCHFOLLOW)),ifelse(andflags(##,c),setq(5,%q5 ##),)))[ifelse(words(%q5),=\\[+friends\\][repeat(=,13)]\\[idle\\]=\\[con\\]==\\[where\\][repeat(=,33)][iter(%q5,ifelse(andflags(##,c),%R%B[ljust(ifelse(gt(add(strlen(setr(0,name(##))),setr(2,strlen(setr(1,get(##/alias))))),20),strtrunc(name(##),20),name(##))[ifelse(%q1,%B\(%q1\),)],24)][rjust(switch(1,lt(setr(4,idle(##)),60),etimefmt($xs,%q4),lt(%q4,3600),etimefmt($xm,%q4),lt(%q4,86400),etimefmt($xh,%q4),etimefmt($xd,%q4)),4)]%B%B[etimefmt($2H:$2M,conn(##))]%B%B[ljust(ifelse(match(setr(3,loc(##)),#-1),???,name(%q3)),39)],))]%R[repeat(=,78)],None of your friends are on. Alas!)]
+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,45)])
&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.)