Does anybody know of a script/trigger/alias for setting targets and enemies?

edited April 2015 in Tech Support

Hello, it's me again. I wanted to ask if anyone knew a way of setting up Mudlet so it would, when someone Party Tells a list of enemies, automatically enemies them, or when someone Party Tells a target, do the same thing with Set Target. Also, is this considered automation? The reason I ask is that when I'm in combat, group combat especially, trying to type in manually the list of five or six or seven enemies with difficult to spell names takes a great deal of time which is preventing me from being useful in propping and other things I'm meant to be doing as a runewarden, and with targeting I have same problem, and even less time to try and spell people's names right...

I figure that even if setting up a whole "set target/enemy script" is considered automating which, bracketing the entire debate on the subject, is just not something I want to do, I also cannot figure out what the syntax is making an open-ended alias in Mudlet. That is, I can make "tg" send "Take gold from pack", but I cant make "en" do "enemy [whoever I type in]". I know I should just probably RTFM, but I wanted to ask on here first to see if I'm missing something obvious.

I'm also keen to find out what people think are essential scripts/triggers/aliases for playing runewarden (or just in combat more generally) I have some basic highlights and echoes set up, but I still have next to no idea what is going on at any given time.

Thanks in advance for any help.

Multon

P.S. Edit because I accidentally posted when I had only just started typing this.

Comments

  • SkyeSkye The Duchess Bellatere
    RE: auto-targetting

    Don't do it. It seems like a good idea, but really it's not. It is automation but it's not the big problem, something like that is very easily abusable by other people. You're gonna have to come up with something complex, take advantage of the tab-complete function or get good at typing names really fast.

    That said, how have you been targetting and killing things all this time without handling variables and wildcards?

    That said... I can't speak for auto-enemying because I'm really tired and I'm not that good (lol). But the principle also applies, your enemy list and targets should be something that's always within your immediate control, not something that could be illusioned or tricked by a clever raider forcing someone to PT blah.

    I think the most basic targetting alias would be something like this:

    Pattern: ^tt (.*)$

    target = matches[2]
    if id then killTrigger(id) end
    id = tempTrigger(target, [[selectString("]] .. target .. [[", 1) bg("light_cyan") fg ("saddle_brown") deselect() resetFormat()]])
    target = target:title()
    send("st " ..matches[2], false)

    The two bolded bits make up the base of it, while the code in the middle will help turn the first character of your target into an uppercase letter so you can pick up names (adventurer names especially) in your triggers for echoes.






  • SkyeSkye The Duchess Bellatere
    edited April 2015
    Oh yeah it doesn't just capitalise the first letter, it highlights the target too. So you can see what you're hitting.

    And a bad explanation to go with it, cause I only have half an idea of what the hell I'm doing most of the time:


    Your aliases are regular expressions and should always be sandwiched between ^ and $ because long ago people forgot to do that and they'd post awkward news posts since their sileris alias is usually 'as'. So every time they had the word 'as' in their post it'd be 'apply sileris' interspersed through their text. ^ and $ will ensure that doesn't happen by forcing mudlet to only recognise the alias when it's exactly as it appears without any extraneous stuff.

    You can make use of wildcards in your aliases and triggers:
     (.*) <- this thing like a tit with a tattoo on it means that it'll accept any number of characters. I use this because I don't have a fancy stormhammer script.
    (\w+) <- this thing will accept any one word. You tend to use this more for triggers
    (\d+) <- this thing denotes a numerical value. It's good for antitheft triggers when you get your gold from your pack and stuff.

    The more specific you are, the more specific the information you either receive or have to give. This information will change constantly as you play hence it's called a 'variable'. Typically mudlet automatically recognises these variables as 'matches'.

    matches[1] pertains to the entire alias/trigger. You usually use this if you're trying to grab an entire load of text for whatever reason (in this case 'tt rat12345') for example. If you're only looking to match that particular wildcard ('rat12345') you can specify matches[2]

    If your alias or a particular trigger has more than one variable, you can just increase the number in the square parenthesis accordingly. The nth variable is identified as matches[n+1]

    Bear in mind that these variables are 'unnamed' and Mudlet will just pick up and discard them as soon as new info comes along. That's not very useful so the first thing you gotta do is to give Mudlet a named variable it recognises. That way you can use it for your echoes and shit. In this case, I call mine 'target'. It could be 'Yourmom' for all anyone cares, but it's basically creating an empty box with a label you can stick information in and find it again easily.

    hence: target = matches[2]

    So at any time after this, you can refer to 'target' in your code and triggers and Mudlet will know who or what you're referring to.


    The second bit of 'send("st " ..matches[2], false)' it's just to take advantage of Achaea's internal targetting so you don't have to keep including ..target.. in all your attack aliases. Cause it's tedious and I'm lazy. Some people probably have better or more efficient recommendations though.



  • Thank you @Skye! That is really helpful, I'd had some help setting up targeting before, so I've sort of an echo thingy set up for it, it's

    ^st (.*)$

    target = matches[2]:title()

    cecho("<green>***Now targeting " .. target .. "!***")

    So, if I follow the same sort of format, I can do the same with enemies. Also, I had never even considered the potential manipulations of an targeting/enemying script. Thank you very much for the warning. I will steer well clear of that.

    Otherwise I suppose I just need to figure out what info I need to be able to see in combat and make it visible. I know the only other way of improving is just to practice and learn to process what is going on a bit faster myself. I was also recently very pleased to discover that the arena does not have an xp-penalty for dying, which means I'm going to be practising in there whenever I can. One minor frustration for me is my latency occasionally spiking which means that when the command is executed things are different from what I thought they were when I pressed a button, but that's more a universal problem of playing games on WiFi...

    Thanks very much for the help though! I'm still working on learning the essentials of combat, but I at least can feel like I am improving somewhat. (I die less quickly now! I still always die, but not instantaneously any more! Mostly...) Now I just need to figure out a strategy beyond, "Hit them with my sword, and then hit them with my shield" after basically varnishing the former with random venoms...

    Thanks again for the response!
  • P.S. Also, I just saw your second post @Skyeand your explanation is awesome! Thank you again!
  • JonathinJonathin Retired in a hole.
    I saw some regex here. Just thought I'd leave this here.
    I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
  • Multon said:

    Hello, it's me again. I wanted to ask if anyone knew a way of setting up Mudlet so it would, when someone Party Tells a list of enemies, automatically enemies them,
    Since no one answered this particular part yet...

    First you want a trigger... Which really depends on how people call enemies, but I'll try to provide an example or two. That'll look something like this: (Perl trigger, of course)

    ^\(Party\)\: (\w+) says, "Enemies: (.*)."$
    ^\(Party\)\: (\w+) says, "Enemies are: (.*)."$

    -or whatever, you get the idea-

    Next we have the code that goes along with it.

    local leaders = {"Xinna", "Hasar", "whoever"}              --edit this to add in whoever else you want to follow. This will prevent your enemies table updating whenever someone mentions their enemies on PT.

    if table.contains(leaders, matches[2]) then
         send("unenemy all")
         for token in string.gmatch(matches[3], "[^,|%s]+") do
              send("enemy "..token, false)
         end
    else
          enemiesstring = matches[3]
          cecho("\n<green>Leader not recognised. Use <white>eall<green> to enemy anyway.")
    end

    Finally we can make an alias to use the second portion of that trigger, like so:
    Pattern: ^eall$
    Code:
         send("unenemy all")
         for token in string.gmatch(enemiesstring, "[^,|%s]+") do
              send("enemy "..token, false)
         end
         enemiesstring = nil


    How does this work?

    Simple. You have a set table of leaders (Hasar, Xinna, whoever else), who calls out their enemies. Which ideally looks something like this:
    (Party): Xinna says, "Enemies: Rangor|Ellodin|Alrena|Seftin|Rom."

    The trigger will then capture Rangor, Ellodin, Alrena, Seftin, Rom as the enemies present, unenemy all your current enemies, then enemy all of those... If the caller was someone like... Elazar, who wasn't in the table, then it'd instead make a new variable, and set that variable as Rangor|Ellodin|Alrena|Seftin|Rom... Once that's done, you could then use an alias: eall, to do the exact same as the trigger does.

Sign In or Register to comment.