HTML5 Client Questions and Such



  • Alright.  I have an alias called pa.  The format is:

    pa target limb

    If I type into my console 'pa valur head' then it executes the script within the alias correctly.  However, I'm attempting to keybind this alias such that, for instance, F4 does 'pa @tar torso' and this is not working.

    How do I pass my client target to an alias?  Do I need the script to use client.current_target() instead? 
    ~Kresslack's obsession~
  • If your target is set into @tar, you do not need it in the command. 

    > strike Addama chest

    is equivalent to

    > target Addama
    > strike chest
  • Alright, I'll try that out - I assumed DSL was an exception to that.
    ~Kresslack's obsession~
  • Trying to do a PT targeting trigger.  Tael offered his version earlier:

    ^\(Party\): \w+ says, "T(?:arget|ARGET)(?:ing|ING)?:? (\w+)\."$

    Unfortunately, this seems to do nothing.  Not sure what it needs or where.
    ~Kresslack's obsession~
  • i would suggest try go to online and try it there to see if your does trigger or not. it will provide you detail what each individual of your line will the regex finds.

    2015/01/12 Tecton, the Terraformer has bestowed His divine favour upon you. It will last for approximately 1 Achaean month.
  • edited December 2014

    1. Yes, if you want to retrieve your target, use client.current_target(). This isn't documented, but it's the thing you want (this is how I have my bashing thing set up to use either an explicit target or a tab target). While the thing @Orzaansyn is describing usually works, I've had a few instances in the past where it didn't (though they may be fixed now). It's also easier to maintain two targeting systems if you want to - your tab target and a "system" target (this is useful if, for instance, you want to just "t mhun" and continue bashing mhun without having to tab target to each one every time, or if you want to have a player as a target and tab to one of their ents until you kill it).

    2. As for the PT trigger, that regex is definitely right:
    ^\(Party\): \w+ says, "T(?:arget|ARGET)(?:ing|ING)?:? (\w+)\."$
    That will match people who call targets via "Target Tael", "Target: Tael", "Targeting Tael", "Targeting: Tael", and all of the same with TARGET/TARGETING in all caps. And it'll give you the name of the target in args[1].

    I think you can use emotes and emoticons and adverbs and other things in channels now, which might theoretically cause problems, though I doubt anyone is using those things when calling targets.

    So, troubleshooting:
    1. Are you sure you set the trigger to be a regex trigger? I have spent half an hour trying to find a mistake in my scripting only to realise I forgot to set the trigger type to regex.
    2. Comment out the script you're running right now. Replace it with a single print("MATCH"); so you can tell if it's the regex pattern that's the problem or the script it's running.
  • @Addama: You have a space after the $ there. If that space is in the regex in your client too, that's what's wrong.
  • Tael said:
    @Addama: You have a space after the $ there. If that space is in the regex in your client too, that's what's wrong.
    That did it.  Thanks!
    ~Kresslack's obsession~
  • edited December 2014

    Assuming the internals aren't too messy to deal with, is there any chance we could get the functions that create the tabs for things like room/inventory/channels so we could add our own new tabs to the existing containers?

    The thing that would absolutely catapult the HTML5 client to the very centre of my heart is being able to define my own tabs for things like affliction tracking and a limb-counter display.

    1. The function that creates a tab/window.
    2. The function to push a line of text (and/or to update the html so we can use images) to the tabbed window.
    3. The function to delete (and/or replace) a line in the tabbed window (allowing us to create "static" displays by replacing text rather than appending it).
    It would also be really nice to have the functions that switch between the tabs and enable/disable them. In fact, that would be independently nice. I can imagine a lot of people would love to be able to use an alias to swap between their channel tabs for instance.

    This is, right now, one of the killer features of Mudlet - the ability to make a custom UI. The default UI for this client is so nice though that having access to the framework itself would honestly make adding displays even easier than it is working with Mudlet.
  • TectonTecton The Garden of the Gods
    While not a client-side function, you should be able to do all of that with JQuery already!
  • Oh - these are just JQuery UI elements, aren't they?

    Well. I know what I'll be working on for the next few days then.
  • I've spent a few hours reading the source of the client now (since the tab html is generated rather than laid out, things are a bit more complicated than I expected), and I'm not entirely sure where I'm going wrong. I can get a tab into one of the containers, but it breaks some of the style and I can't seem to push anything into it.

    This is the test code I've been running:
    var tabs = $( "#container_1" ).tabs();
    var ul = tabs.find( "ul" );
    $( "<li><a href='#newtab'>New Tab</a></li>" ).appendTo( ul );
    $( "<div id='newtab'><p>Test</p></div>" ).appendTo( tabs );
    tabs.tabs( "refresh" );

    I expect that to add a tab to the Room/Inventory container (container_1). And it does.


    1. The border of the frame/widget/thing suddenly appears when I add the tab (obviously not a huge thing, but still irksome and I still can't quite figure out why).
    2. When I click the tab, it puts a heavy white border around the tab label instead of doing the nice tab+pane border styling that the tabs normally have.
    3. Most importantly, the <p>Test</p> isn't appearing in newtab. I'm not really sure what's wrong there.
    My guess is that some of this has to do with the fact that the container_1 id is on a parent div rather than on the contailer <ul> itself, but I'm not really clear what consequences that ends up having.
  • I'm trying to temporary shutdown a group of triggers, I read in the manual that it is possible, but its very confusing.
    Manipulating reflexes in functions or scriptsThe client allows you to fetch information about reflexes, and to modify it in various ways.First, you need to fetch the desired refles, using client.reflex_find_by_name(type, name, case_sensitive, enabled_only, package). The last three parameters are optional. For example: var el = client.reflex_find_by_name('alias', 'drop'); The name is entered into the Alias name / Trigger name / ... field that you haven't been using so far.The most useful option that this function provides is the ability to enable and disable various types of reflexes (including groups) in a script. To do this, you can use the client.reflex_enable and client.reflex_disable functions. For example:var el = client.reflex_find_by_name('alias', 'drop'); client.reflex_disable(el);.This functionality allows you to easily implement functionality such as one-time triggers. Simply use reflex_enable when you need to enable the trigger, and reflex_disable in the trigger itself, using the trigger's name so that the trigger disables itself.

    but there is no info on how shutting down a group entirely? I tried client.reflex_disable(defences);  this didn't work. anyone know if this is possible at all?

  • I believe you're looking for client.reflex_disable("defences")
    ~Kresslack's obsession~
  • The problem here is that you need to reference the group object. While you "name" them in the client, that isn't actually the name of the object, it's just the value of a "name" key inside the object. That's why client.reflex_find_by_name exists - it's a function that searches all of your triggers for the one with that value for the name key and returns the actual name of the object.

    So what you need to do is find the reflex (assuming your group is called "defences"):

    client.reflex_find_by_name("group", "defences")

    That will return the actual name of the group object. Note that, if this is a group in a reflex package outside of the default (--main package--), you need to specify the whole thing: client.reflex_find_by_name("group", "defences", false, false, "packageName")

    Then you have two choices:
    1. Just slap that function call in as the argument to client.reflex_disable: client.reflex_disable(client.reflex_find_by_name("group", "defences")). So the inner function will find the group object's name, output it, and pass that to the outer function, which will disable the group.
    2. Assuming you're going to do this more than once (and probably enable it sometimes too), there's no point in looking up the function name several times. So make a variable in onLoad: var defencesGroup = client.reflex_find_by_name("group", "defences"). Then whenever you want to disable it, just use the variable: client.reflex_disable(defencesGroup). This is the more technically correct way to do it.
  • Incidentally, if @Tecton or @Cromm can help me get a tab in there without breaking the styles and to get HTML in and out of the tab contents, I would be happy to write up a tutorial for doing it. I suspect a lot of people are hesitant about the HTML5 client because they don't want to give up their custom UIs - particularly the kind of coders who are confident enough to share their code with other players.
  • edited January 2015
    So this is an odd problem:

    12:54:28.779 [System]: Added UNDERHAND ALEKXZ CURARE to your balance queue.

    12:54:28.779 [System]: Running queued balance command: UNDERHAND ALEKXZ CURARE

    12:54:28.779 You rub some curare on a Delosian bastard sword.

    12:54:28.779 Bracing your feet, you lunge upward at Alekxz with a Delosian bastard sword.

    12:54:28.779 Wrists:0 Tendons:0||Ribs:02 Skull:0 Parry:Nothing

    12:54:28.779 Horror overcomes Alekxz's face as her body stiffens into paralysis.

    12:54:28.779 4737h 3311m eb 0-

    12:54:28.836 Alekxz eats a bloodroot leaf.

    12:54:28.836 4737h 3311m eb 0-

    12:54:28.969 Alekxz takes some elixir from an oaken vial and rubs it into her torso.

    12:54:28.969 Wrists:0 Tendons:0||Ribs:0 Skull:0 Parry:Nothing

    I cannot for the life of me understand why this variable (ribs) is being displayed as a two-digit number when it gets displayed from hitting, but as a single-digit number when displayed from sip, since both triggers have identical print lines:

    client.display_notice("Wrists:" + wrists + " Tendons:" + tendons + "||Ribs:" + ribs + " Skull:" + skulls + " Parry:" + parry, "black", "white");

    Perhaps it's a problem with my Perceive line?

    ^(?:He|She) suffers from ([0-7]) (skull|wrist|cracked|torn) (?:fractures|ribs|tendons).$

    Tried switching the ([0-7]) to (\d+) and (\d), didn't fix it.  Or maybe it's the triggered code?

    if (args[2].match(/skull/)){
        skulls = args[1];
    else if (args[2].match(/wrist/)){
        wrists = args[1];
    else if (args[2].match(/cracked/)){
        ribs = args[1];
    else if (args[2].match(/torn/)){
        tendons = args[1];
    client.current_line.gag = true;


    E: It has to be something in the Perceive code, since this wasn't happening yesterday, and it happens for any limb I hit, arm, leg, torso or head.
    ~Kresslack's obsession~
  • Okay, here's a log to demonstrate what I mean:

    15:07:14.616 [System]: Added BATTLEFURY PERCEIVE KELLONIUS to your balance queue.

    15:07:14.616 [System]: Running queued balance command: BATTLEFURY PERCEIVE KELLONIUS

    15:07:14.616 4737h 3461m exb 0-

    Gagged the lines

    15:07:14.698 [System]: Added BATTLEFURY FOCUS SPEED to your balance queue.

    15:07:14.698 [System]: Running queued balance command: BATTLEFURY FOCUS SPEED

    15:07:14.698 Channeling the fury of battle, you prepare to unleash a brutally swift stroke against your foe.

    15:07:14.698 4737h 3461m exb 0-

    15:07:14.759 [System]: Added OVERHAND KELLONIUS CURARE to your balance queue.

    15:07:14.759 [System]: Running queued balance command: OVERHAND KELLONIUS CURARE

    15:07:14.759 Your action causes the nearly invisible magical shield around you to fade away.

    15:07:14.759 You rub some curare on a Delosian bastard sword.

    15:07:14.759 Raising a Delosian bastard sword above your head, you bring it down upon Kellonius's head with terrible force.

    15:07:14.759 Wrists:0 Tendons:0||Ribs:0 Skull:01 Parry:Nothing

    15:07:14.759 Horror overcomes Kellonius's face as his body stiffens into paralysis.

    15:07:14.759 4737h 3461m eb 0-


    15:07:17.539 You have recovered balance on all limbs.

    15:07:17.539 [System]: Running queued balance command: BATTLEFURY PERCEIVE KELLONIUS

    15:07:17.539 [System]: Running queued balance command: BATTLEFURY FOCUS SPEED

    15:07:17.539 Channeling the fury of battle, you prepare to unleash a brutally swift stroke against your foe.

    15:07:17.539 [System]: Running queued balance command: OVERHAND KELLONIUS CURARE

    15:07:17.539 You rub some curare on a Delosian bastard sword.

    15:07:17.539 Raising a Delosian bastard sword above your head, you bring it down upon Kellonius's head with terrible force.

    15:07:17.539 Wrists:0 Tendons:0||Ribs:0 Skull:11 Parry:Nothing

    15:07:17.539 Horror overcomes Kellonius's face as his body stiffens into paralysis.

    15:07:17.539 Kellonius staggers as the blade strikes him in the side of the head.

    15:07:17.539 4737h 3461m eb 0-

    15:07:20.368 Kellonius takes some elixir from a birchwood vial and rubs it into his head.

    15:07:20.368 Wrists:0 Tendons:0||Ribs:0 Skull:9 Parry:Nothing

    15:07:20.368 4737h 3461m eb 0-

    15:07:26.845 Kellonius takes some elixir from a birchwood vial and rubs it into his head.

    15:07:26.845 Wrists:0 Tendons:0||Ribs:0 Skull:7 Parry:Nothing

    ~Kresslack's obsession~
  • When you get the value from the trigger it's a string rather than a number, so using the + operator is string concatenation rather than addition. Use parseInt(value, 10) to convert it to an integer.
  • edited January 2015
    So how would that look in practice?  Like this?

    skulls = parseInt(args[1], 10);

    ~Kresslack's obsession~
  • For the HTML5 client, is there a way to display a new line of text within a script? I want a script to give me a notification when it changes a certain variable.
  • Nevermind, someone gave me the answer. It's the print() function. Whodathunkit?
  • edited April 2015
    Theris said:
    Nevermind, someone gave me the answer. It's the print() function. Whodathunkit?
    client.display_notice(text, color) is also really useful - it lets you use colors and automatically adds line breaks.

    So you can do things like:

    client.display_notice("PROBABLE THEFT ATTEMPT", "red");
  • print(); function accepts the color argument too.
  • I needed a function that colorified certain parts of a message (like mudlet cecho). So I use "ow_Write("#output_main", colorify(str));" with colorify being
  • Does anyone know if there's a function like mudlet's expandAlias?
  • Even though the name doesn't suggest it, send_direct should expand aliases, if the second argument (no_expansion) is a falsy value.
  • So all my reflexes died  on me when I returned to the realms.. I'm trying to  safely get them back on a newbie alt, so I won't get robbed while doing so.

    I'm trying to get the system to print the difference between my old and my new hp (every time I take a hit, or sip health) this is what i have got so far.

    the result is.. rather weird.


    healthcheck is an aliases I made, which does this 500 ms after the onGMCP has been called.


    oldhealth becomes curhp (and when onGMCP gets called curhp changes to the newest HP (if its changed)

    onGMCP prints the value of change (1398)

    thing is..

    change = 0

    why is it pringint 1398?

  • TectonTecton The Garden of the Gods
    You'll want to assign oldhealth in your function, so oldhealth = client.get_variable('oldhealth'); 
Sign In or Register to comment.