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?
i would suggest try go to regex101.com 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.
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:
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:
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.
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.
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.
So:
The function that creates a tab/window.
The function to push a line of text (and/or to update the html so we can use images) to the tabbed window.
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.
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.
But:
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).
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.
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?
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:
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.
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.
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:
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.
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.
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.
1
healthcheck is an aliases I made, which does this 500 ms after the onGMCP has been called.
2
oldhealth becomes curhp (and when onGMCP gets called curhp changes to the newest HP (if its changed)
Comments
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?
is equivalent to
^\(Party\): \w+ says, "T(?:arget|ARGET)(?:ing|ING)?:? (\w+)\."$
Unfortunately, this seems to do nothing. Not sure what it needs or where.
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:
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:
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.
So:
- The function that creates a tab/window.
- The function to push a line of text (and/or to update the html so we can use images) to the tabbed window.
- 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.
Well. I know what I'll be working on for the next few days then.
This is the test code I've been running:
I expect that to add a tab to the Room/Inventory container (container_1). And it does.
But:
- 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).
- 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.
- 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.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:
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:
Perhaps it's a problem with my Perceive line?
Tried switching the ([0-7]) to (\d+) and (\d), didn't fix it. Or maybe it's the triggered code?
Halp?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.
Ideas?Results of disembowel testing | Knight limb counter | GMCP AB files
Results of disembowel testing | Knight limb counter | GMCP AB files
So you can do things like:
client.display_notice("PROBABLE THEFT ATTEMPT", "red");
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof
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.