Tradeskill Designs

by Felicia

Back to Ideas.

Lendren2010-04-26 00:06:15
QUOTE (Xavius @ Apr 25 2010, 06:04 PM) <{POST_SNAPBACK}>
Part of me wants to buy it just to see that code. suspicious.gif

What, the catalog dump command? It's 26 lines, and most of those are formatting stuff. It's easy-peasy, just looping over designs and dumping their attributes.

In fact, this is all there is to it:
CODE
#temp {^You begin to write in} {
  #send "*clear"
  #send "yes"
  #send %repeat( "=", 72)
  #send %3
  #send %repeat( "-", 72)
  craftquery %-4
  sCraftStr1 = ""
  #forall @sCraftStr5 {#if (not %ismember( @{%i.ID}, @lCraftExclude)) {#additem sCraftStr1 %i}}
  sCraftStr5 = @sCraftStr1
  sCraftStr1 = %numitems( @sCraftStr5)
  #forall @sCraftStr5 {
    #send @{%i.Appearance}
    #send ""
    #send @{%i.Dropped}
    #send ""
    #send @{%i.Examined}
    #add sCraftStr1 -1
    #if (@sCraftStr1 <> 0) {#send %repeat( "-", 72)}
    }
  #send %repeat( "=", 72)
  #send ""
  #send ""
  #send "*save"
  }
write %1 at desk on page %2

No big deal at all. (Though I did notice a very minor bug while posting this and just edited in a fix.)

(Feel free to buy it anyway!)
Sylphas2010-04-26 00:16:41
I feel a sudden urge to port that to Lua, even though I'm not going to actually use it.
Lendren2010-04-26 00:18:41
...there's nothing to port, really, it's just a bunch of send commands. The smarts are all elsewhere, in the database capture and upkeep and querying.
Xavius2010-04-26 00:54:39
QUOTE (Lendren @ Apr 25 2010, 07:06 PM) <{POST_SNAPBACK}>
What, the catalog dump command? It's 26 lines, and most of those are formatting stuff. It's easy-peasy, just looping over designs and dumping their attributes.

Actually, was thinking more of the pattern parser.

It's one of those things that would be ridiculously easily done in a controlled context. I could whip up a Python program that would happily process the text of all the recipes I have, store 'em in a dictionary-friendly XML file, and read them back in and check them for any criteria. Going from that to a catalog dump would be pretty trivial. The problem is that I have the worst logic blocks when I have to take multi-line input as essentially a single unit and feed it into a complex script at run-time. Pattern descs have line breaks, but MUSH processes things one line at a time. Somewhere in that mess, things slip past my creativity. I have a vague sense of what needs to be done (i.e. activate the class only from an alias, do nothing until you see the first line of a pattern, then log everything up to the prompt and turn the class off), but the finer details of that give me grief.
Aoife2010-04-26 00:58:49
QUOTE (Lendren @ Apr 25 2010, 08:18 PM) <{POST_SNAPBACK}>
...there's nothing to port, really, it's just a bunch of send commands. The smarts are all elsewhere, in the database capture and upkeep and querying.


How difficult would it be to convert the "smarts" part to Lua or something readable by MUSH?
Lendren2010-04-26 02:08:49
Don't know it well enough, but it wouldn't be converting, it would be redeveloping.