Help with creating a target alias in mudlet

I had some help in the game and have created a targeting alias which has this pattern: ----^t (.+)$---- and this in the big box: ----target = matches[2]----

It is saved and activated. I then have a key binding for my drawslash ability: ------send("drawslash " ..target)---- to F1 and this also is saved and activated. When I attempt to target something, a stirge for example, I get this message: Target TAR = stirge.

After this, when I type drawslash target or hit F1 I get this message: You cannot see that being here.

Anyone know what I'm doing wrong? I'd really appreciate the help. 

Comments

  • Twy said:
    I had some help in the game and have created a targeting alias which has this pattern: ----^t (.+)$---- and this in the big box: ----target = matches[2]----

    It is saved and activated. I then have a key binding for my drawslash ability: ------send("drawslash " ..target)---- to F1 and this also is saved and activated. When I attempt to target something, a stirge for example, I get this message: Target TAR = stirge.

    After this, when I type drawslash target or hit F1 I get this message: You cannot see that being here.

    Anyone know what I'm doing wrong? I'd really appreciate the help. 
    Sounds like you're targeting with the in game SETTARGET command rather than your mudlet alias. With what you have, to set your target, type "t stirge", and then drawslash with F1
  • Thanks but I've tried it with just t and it doesn't make any difference.
  • use

    ^tt (.+)$

    as your targeting alias (you need to enter tt thingireallywantokill to set the variable)
    Hiroma tells you, "I just got to listen to someone complain about your deadly axekick being the bane of their existence."
    Archdragon Mizik Corten, Herald of Ruin says, "Man, that was a big axk."
    Hellrazor Cain de Soulis, Sartan's Hammer says, "Your [sic] a beast."
  • I gave it a go but that just brings up the kind of message you get when you type something the game doesn't understand e.g. 'Interesting...' or 'I missed that all together.'
  • Sounds like Mudlet isn't recognising your alias then. Possible explanations: the pattern is wrong (that doesn't appear to be the case), the alias itself is disabled (you've said it's not), the alias is inside a group that's disabled, or you have the emergency stop turned on.
  • Okay, I haven't got the emergency stop turned on, but what do you mean when you say the alias could be in a group that's disabled? And how would I fix this if it happens to be the case?
  • A group is a folder, so it should be pretty obvious from the alias interface whether the alias is inside a group (it will be indented and underneath a folder icon) and whether the group is disabled (has a padlock on it if it is). To fix it you'd either activate the group (click on it, then click the activate button) or move the alias out of that group (you can drag and drop to another group, or out of any group whatsoever).
  • use ^tt (\w+)$ instead of ^tt (.+)$ for a more efficient pattern

    /ocd
  • If you use ^tt (\w+)$ you can't target a denizen with an apostrophe in its name.
  • YueYue
    edited April 2013
    tsol'aa

    tt tsol

    edit: doesn't everyone use gmcp for denizen targeting now anyway?
  • edited April 2013
    If you use ^tt (\w+)$ you can't target a denizen with an apostrophe in its name.
    ^\s*tt\s*([\w'-]+)\s*$
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • Yue said:
    tsol'aa

    tt tsol

    edit: doesn't everyone use gmcp for denizen targeting now anyway?
    Partial words don't work for targeting denizens.
  • Trevize said:
    If you use ^tt (\w+)$ you can't target a denizen with an apostrophe in its name.
    ^\s*tt\s*([\w'-]+)\s*$
    ^\s*tt\s+([\w'-]+)\s*$ would be preferable, imo.
  • edited April 2013
    Eh, I have a habit of not hitting my spacebar hard enough, or bumping it when I shouldn't, so my aliases tend to look like that. ^_^ Yours is better, yes.

    (need a new keyboard, this one sucks)

    If you want it to look reallllly complicated:


    ^\s{0,}?t{2}\s{1,}?([A-Za-z0-9'-]{1,}?)\s{0,}?$
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • Eld said:
    Yue said:
    tsol'aa

    tt tsol

    edit: doesn't everyone use gmcp for denizen targeting now anyway?
    Partial words don't work for targeting denizens.
    I could be wrong, but I believe tsol does work for some of the tsol'aa? A few others are like that. But it has to be explicitly set up to be a keyword for them, yeah.
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • Trevize said:
    Eld said:
    Yue said:
    tsol'aa

    tt tsol

    edit: doesn't everyone use gmcp for denizen targeting now anyway?
    Partial words don't work for targeting denizens.
    I could be wrong, but I believe tsol does work for some of the tsol'aa? A few others are like that. But it has to be explicitly set up to be a keyword for them, yeah.
    Hm, never tried tsol specifically, I don't think. The point stands, anyway.

    In any case, I think I can just barely make out the rails this thread used to be on from here. @Twy, did you ever get it working?
  • NizarisNizaris The Holy City of Mhaldor
    edited April 2013
    @Twy: If you haven't gotten it working yet, you need to make sure to define the variable target in a separate script from the alias.

    So, alias with your above regex. Also create a script with target = "none" as a placeholder.

    Without it, the target variable doesn't exist, or is local to the alias's name space, and therefore not available to the F1 macro.
    image

  • Nizaris said:
    @Twy: If you haven't gotten it working yet, you need to make sure to define the variable target in a separate script from the alias.

    So, alias with your above regex. Also create a script with target = "none" as a placeholder.

    Without it, the target variable doesn't exist, or is local to the alias's name space, and therefore not available to the F1 macro.
    It's not necessary to define it in a separate script. If it's not explicitly declared local in the alias, it will be global.
  • If you were going to forwardly declare your target variable, it makes more sense to initialize it with something like target = target or nil
  • I got there in the end. I was typing the hyphens around the commands like ---- (pattern) ----

    But now I know you just type that to indicate something. Silly really, but there we are, now I know!
  • Yue said:
    If you were going to forwardly declare your target variable, it makes more sense to initialize it with something like target = target or nil
    That doesn't initialize the variable whatsoever. If its already defined, then it remains the same. If it hasn't been defined, then it remains undefined. Any code that would break without target being defined would still break after that code was run. 

    Initializing a variable is more like what Nizaris said combined with what you said. target = target or "None" initializes the variable, prevents breaking code, and doesn't change the variable if you open the script for editing.
    image
  • yeah, okay..

    except I can use if not target then cecho("<white>[NO TARGET]\n") or something of that sort, as opposed to if target == "none" then which I like better..

    a little pedantic about the term "initialize" but yes, you are correct
  • Its not pedantic just because you disagree with it. Setting a variable equal to nil in lua -is- uninitializing it. That variable no longer exists in the code until it is reinitialized. 

    Besides, I think the more common case is echo("blah blah " .. target) which won't run if target is set to nil
    image
  • YueYue
    edited April 2013
    disagree with it? hmmm

    trying to echo an uninitialized variable throws an error.. of course, that's not a problem in this context but it is a sloppy practice IMO

    "none" -/- nil .. either way, the programmer is making a forward declaration of a variable and dictating its initial value, in my case, nil unless it has been initialized (within scope) elsewhere

    when I used the word 'initialize' earlier (as opposed to how I have used it in this post), I was taking its meaning from the common vernacular and not the strictly technical definition from the programming world

    I apologize if that wasn't apparent
  • Yue said:
    disagree with it? hmmm

    trying to echo an uninitialized variable throws an error.. of course, that's not a problem in this context but it is a sloppy practice IMO

    "none" -/- nil .. either way, the programmer is making a forward declaration of a variable and dictating its initial value, in my case, nil unless it has been initialized (within scope) elsewhere

    when I used the word 'initialize' earlier (as opposed to how I have used it in this post), I was taking its meaning from the common vernacular and not the strictly technical definition from the programming world

    I apologize if that wasn't apparent
    Careful definition of "initialize" aside, I think the main point was that
        target = target or nil
    doesn't DO anything, except in the case that target has been defined elsewhere as false, in which case this changes it to nil.
Sign In or Register to comment.