Hook Help


  • Coder

    Yes, I'm still beating this drum, because I'm still struggling. Sorry and thank you.

    I'm using TinyMUX. @Thenomain has told me he believes there's a way to have hook_cmd not only handle the before/after stuff, but also pass the data that is being sent in the hook through the hook object. I see there is a @hook/ARGS command, but I cannot seem to process how that works.

    What I'm looking to do is have a built-in command (such as pose), take everything that comes after 'pose' and ultimately store it on an object. This will ultimately be a means of pose logging. I had previously been told to set the hook_cmd to ignore the command (pose) and instead soft-code a 'pose' command. This might be a better way?

    What I'm trying to accomplish, in the simplest of examples, is this:

    &B_POSE @hook object <ho>=[pemit( *skew, %0)]

    I tried turning on @hook/args, I tried %1 instead of %0 ... Am I missing something obvious here?


  • Coder

    @skew

    I've honestly not done much with MUX's /args hook. Honestly I was not even aware of it. The help on it is not only.. minimal... it's practically worthless.

    To use the ARGS portion of MUX's hooks, you have to use a prefix of R_ before the attribute. So like R_pose to do ARGS processing on pose.

    And as the help was absolutely worthless to point this out, I had to dig into the source code to find that :)

    Also, I don't care much for how it's designed, and I don't think it buys much.

    What I personally would do is use %m for the last command the person typed and use that in the A_pose.

    if someone typed:
    pose scratches their head.

    The %m would be 'pose scratches their head'.

    So you would use rest(%m) for the string after 'pose'

    If you also want to hook on ':' and ';' I would alter the hook for A_POSE and B_POSE to be something like oh....

    [ifelse(member(; :,mid(%m,0,1)),delete(%m,0,1),rest(%m))]

    Good luck!


  • Coder

    @Ashen-Shugar said in Hook Help:

    use %m for the last command the person typed

    HAH! I was right! (Also, entirely guessed.)

    edit to note: I didn't have any problems finding 'b_', 'a_', etc., in the help files. I do note that sometimes coders will throw their hands up and look into source code to get the answer to what's in their heads, because damn, coders be coders.


  • Coder

    @Thenomain There's mention of /args in the '@hook' help, but not in the 'hook setup' help. I found somewhere online someone mentioned at 'hook setup3' which I do not have in my version of TinyMUX. In brief, the help for it simply doesn't exist in my version.

    @Ashen-Shugar That's awesome. Exactly what I needed, thank you. And yes, it is what Thenomain said, but his brain is old and leaky and he couldn't remember it.


  • Coder

    @skew

    I completely remembered it. While tired. And sick. And not anywhere near a login. And having played video games all day. I hope you're that capable when you're thirty, like me.


  • Coder

    @Thenomain said in Hook Help:

    @skew

    I completely remembered it. While tired. And sick. And not anywhere near a login. And having played video games all day. I hope you're that capable when you're thirty, like me.

    The answer of course is orange.


  • Coder

    @Thenomain I am thirty (one). >=|



  • @Thenomain said in Hook Help:

    @skew

    I completely remembered it. While tired. And sick. And not anywhere near a login. And having played video games all day. I hope you're that capable when you're thirty, like me.

    I'll be 31 soon, and dude, I can't even remember where I put my keys most days. Color me impressed.


  • Coder

    @skew said in Hook Help:

    @Thenomain I am thirty (one). >=|

    My nieces are older than you... all three of them. :)