d12 Core
d12 is a softcoded RPG stat-handling system based on the Cortex System RPG Engine. It is designed to be lightweight, modular, and easily configurable, as well as adding to RP rather than taking it over. d12 only handles the numbers, the idea being that the players or GM should interpret the rules for themselves. Traits, Skills, 'Levels,' and rules are stored on separate objects for easy configuration and sharing between MUSHes or even sessions.
Functions:
after(),
before(),
create(),
default(),
edit(),
elements(),
get(),
grab(),
hasattrval(),
if(),
isnum(),
iter(),
lattr(),
lcstr(),
lflags(),
locate(),
map(),
match(),
not(),
replace(),
set(),
setdiff(),
setq(),
setr(),
switch(),
t(),
u(),
v(),
wipe().
Features:
#lambda.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for d12 Core
@@ Project Trelane_FV_d12_Core
@@ Version 2
@@
@@ Description:
@@ d12 is a softcoded RPG stat-handling system based on the
@@ Cortex System RPG Engine. It is designed to be lightweight,
@@ modular, and easily configurable, as well as adding to RP
@@ rather than taking it over. d12 only handles the numbers,
@@ the idea being that the players or GM should interpret the
@@ rules for themselves. Traits, Skills, 'Levels,' and rules
@@ are stored on separate objects for easy configuration and
@@ sharing between MUSHes or even sessions.
@@
@@ Version log:
@@ Author: Trelane <Mush>
@@ Date: Sat Mar 14 01:29:37 2009 -0700
@@ v2v
@@
@@ Initial d12 Core commit
@@
@@ Readme:
@@ Currently, no user-friendly interface exists other than what
@@ you code. The code is the basest of bases. Functions to
@@ handle characters' stats (referred to collectively as a
@@ character's sheet from now on) and modify database objects
@@ exist, documentation pending. That aside, in order to
@@ properly handle a character's sheet, the d12 Core object
@@ must be able to set and read attributes on the object
@@ storing the information. As of right now, it is possible for
@@ the system to use separate objects for the information, so
@@ this should not be a problem. Plans exist for handling of
@@ rules, separate sheets per object, and obviously a more
@@ useable interface. A database object for the Serenity RPG
@@ will become available shortly.
@@
@@ Language: MushCode
@@ Installer file created by RubySVC (Softcode Version Control)
@@
@@
@@
@@ Creating Rooms, Things and Exits.
@@
@@
@set me=SVC`T636e641fc648aa37b30f:[default(SVC`T636e641fc648aa37b30f,create(T636e641fc648aa37b30f))]
@@
@@
@@ Objects created, now setting attributes, locks, etc.
@@
@@
@@
@@ Filling out d12 Core
@@
@name [v(SVC`T636e641fc648aa37b30f)]=d12 Core
@tel [v(SVC`T636e641fc648aa37b30f)]=v(SVC`owner)
@set [v(SVC`T636e641fc648aa37b30f)]=iter(setdiff(lflags([v(SVC`T636e641fc648aa37b30f)]),NO_COMMAND),!##) [setdiff(NO_COMMAND,lflags([v(SVC`T636e641fc648aa37b30f)]))]
&LFUN`MVATTR [v(SVC`T636e641fc648aa37b30f)]=if(hasattrval(%0),set(before(%1,/),[after(%1,/)]:[get(%0)])[if(not(match(%0,%1)),wipe(%0))])
&LFUN [v(SVC`T636e641fc648aa37b30f)]=
&FUN`VALUE [v(SVC`T636e641fc648aa37b30f)]=if(isnum(%2),set(locate(%!,%0,PT*),D12`[grab(ATTRPOINTS SKILLPOINTS PLOTPOINTS ADVPOINTS LEVEL,%1*)]POINTS:%2),get(locate(%!,%0,PT*)/D12`[grab(ATTRPOINTS SKILLPOINTS PLOTPOINTS ADVPOINTS LEVEL,%1*)]))
&FUN`TRAITS [v(SVC`T636e641fc648aa37b30f)]=switch(t(%1)[t(%2)][setq(0,get(locate(%!,%0,PT*)/D12`TRAITS))],00,%q0,10,after(grab(%q0,%1*),:),11,if(setr(1,grab(%q0,%1*)),set(%0,D12`TRAITS:[edit(%q0,%q1,switch(%2,remove,,elements(%q1,1,:):[edit(lcstr(%2),minor,0,major,1)]:[if(t(%3),%3,elements(%q1,3,:))]))]),set(%0,D12`TRAITS:%q0 %1:%2:%3))
&FUN`SKILLS [v(SVC`T636e641fc648aa37b30f)]=switch(t(%1)[t(%2)][setq(0,get(locate(%!,%0,PT*)/D12`SKILLS))],00,%q0,10,after(grab(%q0,%1*),:),11,if(t(setr(1,grab(%q0,%1*))),set(%0,D12`SKILLS:[edit(%q0,%q1,switch(%2,remove,,before(%q1,:):%2))]),set(%0,D12`SKILLS:%q0 %1:%2)))
&FUN`ATTRVAL [v(SVC`T636e641fc648aa37b30f)]=if(t(%2),set(setr(0,locate(%!,%0,PT*)),D12`ATTRIBUTES:[replace(get(%q0/D12`ATTRIBUTES),match(AGILITY STRENGTH VITALITY ALERTNESS INTELLIGENCE WILLPOWER,%1*),%2)]),elements(get(setr(0,locate(%!,%0,PT*))/D12`ATTRIBUTES),match(AGILITY STRENGTH VITALITY ALERTNESS INTELLIGENCE WILLPOWER,%1*)))
&FUN [v(SVC`T636e641fc648aa37b30f)]=
&DBFUN`TRAITS [v(SVC`T636e641fc648aa37b30f)]=map(#lambda/edit(before(setr(0,after(\%0,TRAITS`)),-),_,\%b,+,-)-\[after(\%q0,-)\],lattr(%va/TRAITS`*),,if(%0,%0,%b))
&DBFUN`TRAIT [v(SVC`T636e641fc648aa37b30f)]=switch(isnum(%1)[t(%2)][setq(0,grab(lattr(%va/TRAITS`*),TRAITS`[edit(%0,%b,_,-,+)]*))],00,get(%va/%q0),10,u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)]),01,if(match(%2,remove),wipe(%va/%q0),set(%va,%q0:%2)),11,if(match(%2,remove),wipe(%va/%q0),if(hasattrval(%va,%q0),set(%va,%q0:%2)[u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)])],set(%va,TRAITS`%0-%1:%2))))
&DBFUN`SKILLS [v(SVC`T636e641fc648aa37b30f)]=map(#lambda/edit(before(setr(0,after(\%0,SKILLS`)),-),_,\%b,+,-)-\[after(\%q0,-)\],lattr(%va/SKILLS`*),,if(%0,%0,%b))
&DBFUN`SKILL [v(SVC`T636e641fc648aa37b30f)]=switch(isnum(%1)[t(%2)][setq(0,grab(lattr(%va/SKILLS`*),SKILLS`[edit(%0,%b,_,-,+)]*))],00,get(%va/%q0),10,u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)]),01,if(match(%2,remove),wipe(%va/%q0),set(%va,%q0:%2)),11,if(match(%2,remove),wipe(%va/%q0),if(hasattrval(%va,%q0),set(%va,%q0:%2)[u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)])],set(%va,SKILLS`%0-%1:%2))))
&DBFUN [v(SVC`T636e641fc648aa37b30f)]=
@@
@@ Triggering all startups, oncreates, onupdates.
@@
@@ Version 2
@@
@@ Description:
@@ d12 is a softcoded RPG stat-handling system based on the
@@ Cortex System RPG Engine. It is designed to be lightweight,
@@ modular, and easily configurable, as well as adding to RP
@@ rather than taking it over. d12 only handles the numbers,
@@ the idea being that the players or GM should interpret the
@@ rules for themselves. Traits, Skills, 'Levels,' and rules
@@ are stored on separate objects for easy configuration and
@@ sharing between MUSHes or even sessions.
@@
@@ Version log:
@@ Author: Trelane <Mush>
@@ Date: Sat Mar 14 01:29:37 2009 -0700
@@ v2v
@@
@@ Initial d12 Core commit
@@
@@ Readme:
@@ Currently, no user-friendly interface exists other than what
@@ you code. The code is the basest of bases. Functions to
@@ handle characters' stats (referred to collectively as a
@@ character's sheet from now on) and modify database objects
@@ exist, documentation pending. That aside, in order to
@@ properly handle a character's sheet, the d12 Core object
@@ must be able to set and read attributes on the object
@@ storing the information. As of right now, it is possible for
@@ the system to use separate objects for the information, so
@@ this should not be a problem. Plans exist for handling of
@@ rules, separate sheets per object, and obviously a more
@@ useable interface. A database object for the Serenity RPG
@@ will become available shortly.
@@
@@ Language: MushCode
@@ Installer file created by RubySVC (Softcode Version Control)
@@
@@
@@
@@ Creating Rooms, Things and Exits.
@@
@@
@set me=SVC`T636e641fc648aa37b30f:[default(SVC`T636e641fc648aa37b30f,create(T636e641fc648aa37b30f))]
@@
@@
@@ Objects created, now setting attributes, locks, etc.
@@
@@
@@
@@ Filling out d12 Core
@@
@name [v(SVC`T636e641fc648aa37b30f)]=d12 Core
@tel [v(SVC`T636e641fc648aa37b30f)]=v(SVC`owner)
@set [v(SVC`T636e641fc648aa37b30f)]=iter(setdiff(lflags([v(SVC`T636e641fc648aa37b30f)]),NO_COMMAND),!##) [setdiff(NO_COMMAND,lflags([v(SVC`T636e641fc648aa37b30f)]))]
&LFUN`MVATTR [v(SVC`T636e641fc648aa37b30f)]=if(hasattrval(%0),set(before(%1,/),[after(%1,/)]:[get(%0)])[if(not(match(%0,%1)),wipe(%0))])
&LFUN [v(SVC`T636e641fc648aa37b30f)]=
&FUN`VALUE [v(SVC`T636e641fc648aa37b30f)]=if(isnum(%2),set(locate(%!,%0,PT*),D12`[grab(ATTRPOINTS SKILLPOINTS PLOTPOINTS ADVPOINTS LEVEL,%1*)]POINTS:%2),get(locate(%!,%0,PT*)/D12`[grab(ATTRPOINTS SKILLPOINTS PLOTPOINTS ADVPOINTS LEVEL,%1*)]))
&FUN`TRAITS [v(SVC`T636e641fc648aa37b30f)]=switch(t(%1)[t(%2)][setq(0,get(locate(%!,%0,PT*)/D12`TRAITS))],00,%q0,10,after(grab(%q0,%1*),:),11,if(setr(1,grab(%q0,%1*)),set(%0,D12`TRAITS:[edit(%q0,%q1,switch(%2,remove,,elements(%q1,1,:):[edit(lcstr(%2),minor,0,major,1)]:[if(t(%3),%3,elements(%q1,3,:))]))]),set(%0,D12`TRAITS:%q0 %1:%2:%3))
&FUN`SKILLS [v(SVC`T636e641fc648aa37b30f)]=switch(t(%1)[t(%2)][setq(0,get(locate(%!,%0,PT*)/D12`SKILLS))],00,%q0,10,after(grab(%q0,%1*),:),11,if(t(setr(1,grab(%q0,%1*))),set(%0,D12`SKILLS:[edit(%q0,%q1,switch(%2,remove,,before(%q1,:):%2))]),set(%0,D12`SKILLS:%q0 %1:%2)))
&FUN`ATTRVAL [v(SVC`T636e641fc648aa37b30f)]=if(t(%2),set(setr(0,locate(%!,%0,PT*)),D12`ATTRIBUTES:[replace(get(%q0/D12`ATTRIBUTES),match(AGILITY STRENGTH VITALITY ALERTNESS INTELLIGENCE WILLPOWER,%1*),%2)]),elements(get(setr(0,locate(%!,%0,PT*))/D12`ATTRIBUTES),match(AGILITY STRENGTH VITALITY ALERTNESS INTELLIGENCE WILLPOWER,%1*)))
&FUN [v(SVC`T636e641fc648aa37b30f)]=
&DBFUN`TRAITS [v(SVC`T636e641fc648aa37b30f)]=map(#lambda/edit(before(setr(0,after(\%0,TRAITS`)),-),_,\%b,+,-)-\[after(\%q0,-)\],lattr(%va/TRAITS`*),,if(%0,%0,%b))
&DBFUN`TRAIT [v(SVC`T636e641fc648aa37b30f)]=switch(isnum(%1)[t(%2)][setq(0,grab(lattr(%va/TRAITS`*),TRAITS`[edit(%0,%b,_,-,+)]*))],00,get(%va/%q0),10,u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)]),01,if(match(%2,remove),wipe(%va/%q0),set(%va,%q0:%2)),11,if(match(%2,remove),wipe(%va/%q0),if(hasattrval(%va,%q0),set(%va,%q0:%2)[u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)])],set(%va,TRAITS`%0-%1:%2))))
&DBFUN`SKILLS [v(SVC`T636e641fc648aa37b30f)]=map(#lambda/edit(before(setr(0,after(\%0,SKILLS`)),-),_,\%b,+,-)-\[after(\%q0,-)\],lattr(%va/SKILLS`*),,if(%0,%0,%b))
&DBFUN`SKILL [v(SVC`T636e641fc648aa37b30f)]=switch(isnum(%1)[t(%2)][setq(0,grab(lattr(%va/SKILLS`*),SKILLS`[edit(%0,%b,_,-,+)]*))],00,get(%va/%q0),10,u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)]),01,if(match(%2,remove),wipe(%va/%q0),set(%va,%q0:%2)),11,if(match(%2,remove),wipe(%va/%q0),if(hasattrval(%va,%q0),set(%va,%q0:%2)[u(LFUN`MVATTR,%va/%q0,%va/[replace(%q0,2,%1,-)])],set(%va,SKILLS`%0-%1:%2))))
&DBFUN [v(SVC`T636e641fc648aa37b30f)]=
@@
@@ Triggering all startups, oncreates, onupdates.
@@