Results 1 to 2 of 2

Thread: cli command prefixes?

  1. #1
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    The Unseelie Court

    Default cli command prefixes?

    I'm irritated. I'm working on a little script to harvest the advent calendar. I called it "advent.ash".

    > advent
    does not exist in the adventure database.
    Turns out that KoLmafiaCLI (the module which registers all the CLI commands) has the following:

    		new AdventureCommand().registerPrefix( "adv" );
    which means that ANY command you type that starts with "adv" is sent to the built in "adventure" command.

    > adviolaboogaloo
    does not exist in the adventure database.
    > moon
    December 1, 2019 - Jarlsuary 4
    Ronald: waxing gibbous
    Grimace: waxing crescent
    Mini-moon: far right
    Valentine's Day: 8 days
    St. Sneaky Pete's Day: 15 days
    Oyster Egg Day: 22 days
    El Dia De Los Muertos Borrachos: 30 days
    Festival of Jarlsberg: 32 days
    Generic Summer Holiday: 39 days
    Dependence Day: 48 days
    Arrrbor Day: 56 days
    Labór Day: 66 days
    Halloween: 76 days
    Feast of Boris: 83 days
    Yuletide: 88 days
    Mysticism bonus tomorrow (not today).
    > moonievision
    December 1, 2019 - Jarlsuary 4
    ...same stuff...
    Here are all the prefixes:

    		new AdventureCommand().registerPrefix( "adv" );
    		new CallScriptCommand().register( "verify" ).
    			register( "check" ).
    			register( "call" ).
    			register( "run" ).
    			registerPrefix( "exec" ).
    			register( "load" ).
    			register( "start" ).
    			register( "profile" );
    		new CampgroundCommand().registerPrefix( "camp" );
    		new ConditionsCommand().registerPrefix( "goal" ).registerPrefix( "condition" ).registerPrefix( "objective" );
    		new EditMoodCommand().registerPrefix( "trigger" );
    		new ForumCommand().registerPrefix( "forum" );
    		new MoodCommand().registerPrefix( "mood" );
    		new OlfactionCommand().registerPrefix( "olfact" ).register( "putty" );
    		new RecoverCommand().registerPrefix( "restore" ).registerPrefix( "recover" ).registerPrefix( "check" );
    		new ShowDataCommand()
    			.registerPrefix( "inv" ).register( "storage" ).register( "session" ).register( "summary" )
    			.register( "effects" ).register( "status" ).register( "skills" ).register( "locations" )
    			.register( "encounters" ).registerPrefix( "moon" );
    		new SlimeStackCommand().registerPrefix( "slime-stack");
    		new StickersCommand().registerPrefix( "sticker" );
    		new VisitURLCommand().register( "text" ).registerPrefix( "http://" ).registerSubstring( ".php" );
    		new WindowOpenCommand().register( "chat" ).register( "mail" ).registerPrefix( "opt" ).register( "item" ).register(
    		new CommandAlias( "skills", "buff" ).registerPrefix( "buff" );
    		new CommandAlias( "skills", "passive" ).registerPrefix( "pass" );
    		new CommandAlias( "skills", "self" ).registerPrefix( "self" );
    		new CommandAlias( "skills", "combat" ).registerPrefix( "combat" );
    Notice that you can assign as many exact (or prefix) strings as you want to a command.

    I think a lot of these make no sense; they declare a prefix rather than listing two exact commands, say. Or they register a whole word as a prefix - but I can't think of any ways you'd want to extend that word to have the same meaning.

    I think I will rationalize these this way:

    The following have a couple of reasonable variants:

    new AdventureCommand().register( "adv" ).register( "adventure" );
    new CallScriptCommand()....register( "exec" ).register( "execute" )....
    new CampgroundCommand().register( "camp" ).register( "campground" );
    new OlfactionCommand().register( "olfact" ).register( "olfaction" ).register( "putty" );
    ("putty"? Really? Why?)
    new RecoverCommand().register( "restore" ).register( "recover" ).register( "check" );
    (These were all prefixes. Why? I type "recover mp" but can't imagine typing "recovers mp" or even "recovery mp" )
    new ShowDataCommand().register( "inv" ).registerPrefix( "inventory" )
    (I use "inv", which is short for "inventory")
    new VisitURLCommand().register( "text" ).registerPrefix( "http://" ).registerSubstring( ".php" );
    (this is a fine use of registerPrefix. How about "https://"?)
    new WindowOpenCommand().register( "opt" ).registerPlural( "option" )

    The following could be either the base or plural form of the command: (registerPlural does not (yet) exist).

    new ConditionsCommand().registerPlural( "goal" ).registerPlural( "condition" ).registerPlural( "objective" );
    new EditMoodCommand().registerPlural( "trigger" );
    new ForumCommand().registerPlural( "forum" );
    new MoodCommand().registerPlural( "mood" );
    new ShowDataCommand().registerPlural( "moon" );
    new SlimeStackCommand().registerPlural( "slime-stack");
    new StickersCommand().registerPlural( "sticker" );

    I'm not sure why the following are useful.

    new CommandAlias( "skills", "buff" ).registerPlural( "buff" );
    new CommandAlias( "skills", "passive" ).register( "pass" ).registerPlural( "passive" );
    new CommandAlias( "skills", "self" ).registerPrefix( "self" );
    new CommandAlias( "skills", "combat" ).registerPlural( "combat" );
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  2. #2
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    The Unseelie Court


    I did those changes in revision 19626

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts