28 Oct, 2008, Valo wrote in the 1st comment:
Votes: 0
Using PennMUSH version 1.8.3 patchlevel 3, I have set the +sheet to search for the active skill that are set on the sheet object which works fine, but I am having trouble with it not showing the values of the skill themselves. They'll show the skill name and that is all. If anyone has any advice I'd appreciate it. The current code that I am using is:


The skills are set up on the sheet object as:

Askill-<skill name>: <value>

Any advice?
28 Oct, 2008, David Haley wrote in the 2nd comment:
Votes: 0
Is it possible to get that split up on multiple lines to be more readable? I could probably grok it if it were written out more clearly but as-is it's very hard for me to parse. :wink:
28 Oct, 2008, Valo wrote in the 3rd comment:
Votes: 0
28 Oct, 2008, quixadhal wrote in the 4th comment:
Votes: 0
It reminds me of lisp… or as I always liked to call it, (L(I(S(P]
[setq( 0,
get(%#/db) / askill-*
[ iter( %q0,
[ ljust(
mid( ##, strlen( %0 / askill-), strlen( ## ) )
, _, %b
, 24
[ switch( mod( #@, 3 ), 0, %r%b ) ]

Not knowing that language, that's the best guess I can make. Unfortunately, I'm not a MUSH person, so I have no clue what the various "magic symbols" like %# and #@ actually do.
28 Oct, 2008, Sandi wrote in the 5th comment:
Votes: 0

[setq(0,lcstr(sort(lattr(get(%#/db)/askill-*))))][iter(%q0,[ljust(edit(capstr(mid(##,strlen(%0/askill-),strlen(##))),_,%b),24)] : [get(get(%#/db)/##)][switch(mod(#@,3),0,%r%b)])]
29 Oct, 2008, Sandi wrote in the 6th comment:
Votes: 0
To be a bit more verbose, your problem is there's nothing in the code you posted that gets the contents of the attributes you're listing. Hence, I added get(get(%#/db)/##), after you edit the attribute name for display, hoping that will work.

Once you get it working, you might try putting get(%#/db) in setq1, as you're iterating it a few times (then it would be simply 'get(%q1/##)' ).
I'd also replace the last switch() with ifelse(). That would look like:

setq(1,get(%#/db))[setq(0,lcstr(sort(lattr(%q1/askill-*))))][iter(%q0,[ljust(edit(capstr(mid(##,strlen(%0/askill-),strlen(##))),_,%b),24)] : [get(%q1/##)][ifelse(mod(#@,3),,%r%b)])]
29 Oct, 2008, David Haley wrote in the 7th comment:
Votes: 0
Wasn't it recently claimed that MUSH code was fairly easy on beginners? Even after seeing an "expanded" version I still find that pretty hard to read… maybe it's just the magic symbols that aren't terribly obvious.
29 Oct, 2008, Sandi wrote in the 8th comment:
Votes: 0
Well, a "beginner" would be one who's never taken a programming course. :)

And this code is hardly "beginner level". The use of mid() is just too cute to live.

It's easier to write unreadable mushcode than not, truth be told, and I see no way around this that wouldn't make it harder for beginners and pros, so you just have to suck it up and scale the sheer rock face that lies between the newbie and the psychocoder. Mushcode works best for people with no knowledge of structured programming and no beliefs about object orientation. Of course it's easier to read when pretty printed, but it's not used that way.
29 Oct, 2008, quixadhal wrote in the 9th comment:
Votes: 0
Oh, I understood the functions themselves… but not knowing the magic words, I couldn't tell what was being manipulated. I suspect many would have the same issues with me posting perl code filled with things like $+, $!, $?, %$$foo, and the like.

At least the perl folk recognize this and have a "use English;" statement that gives you expanded names for all those nasty litlte shortcuts. Of course, the person writing the code still has to use them. :)