System CommandParser

Discussion in 'Systems and Snippets' started by quraji, Nov 21, 2009.

  1. quraji

    quraji zap

    +143 / 0 / -0
    Not sure why you'd need that. But, the Args struct is public so you could make your own if you like the interface.

    [ ljass] [ /ljass] without the spaces.
  2. quraji

    quraji zap

    +143 / 0 / -0
    I'm thinking of changing the way to use this from:
    // uses eval
    function onCmd takes Args args returns nothing
        // do stuff
    // to :
    // uses exec
    function onCmd takes nothing returns nothing
        local Args args = GetCommandArgs() // or something
        // stuff
        call DestroyArgs(args) // call args.destroy()
    // I haven't actually looked at this system since it got approved so 
    // there might be a reason why it's not like this, but probably not.

    Not sure why I did the first to begin with, it's kinda weird (as far as the takes Args args thing).

    Anyone actually use this yet? (or try it?) :p
  3. Jesus4Lyf

    Jesus4Lyf Good Idea™

    +394 / 0 / -0
    Alternative is:
    struct MyCommandStruct extends Args
        implement Command
        private method onCommand takes nothing returns nothing
            // do things with "this", which is your args.
            // it is possible, like this, to fire it with execute AND destroy args when the method
            // finishes firing, even if it uses TriggerSleepAction.
        private static method onInit takes nothing returns nothing
            set this.triggerString="give"

    Up to you. I don't like the idea of manually destroying.
  4. quraji

    quraji zap

    +143 / 0 / -0
    If anyone at all is using or has used this I'd like some feedback on the interface...I'm kind of torn about whether to change it or not.
  5. tooltiperror

    tooltiperror Super Moderator Staff Member

    +233 / 0 / -0
    This is such an awesome system, I love it. Even though I plan on remaking it in Vanilla JASS :thup:

Share This Page