Highlighting targets?

ErebosErebos Member Posts: 68 Capable
I'm fairly inexperienced in Mudlet coding, beyond very simply basics.

How would I set the system to highlight my target in red, so that I can easily track it?

My variable is 'target', and I'm just trying to make it highlight it in every output, for ease of it all.

Also, is there a very simple curing system (that is free) and up to date (mostly) that I could use for bashing in areas like Shallach Ruins and the like?
image

Comments

  • DaganevDaganev Member Posts: 755 Master
    It has been a while, but I believe there is a trigger type called "highlight" which will highlight the matched words in the trigger.  Should be a drop down menu option.
  • ErebosErebos Member Posts: 68 Capable
    Interesting, that worked, but how do I make it highlight 'target' variable?  Right now, it only highlights the word 'target'
    image
  • TarkentonTarkenton Traitor Bear Member Posts: 2,555 Transcendent
    edited October 2014
    according to the mudlet wiki, put the following in your target alias, http://wiki.mudlet.org/w/Manual:Scripting#How_to_highlight_my_current_target.3F is the page in question.

    target = target:title()
    if id then killTrigger(id) end
    id = tempTrigger(target, [[selectString("]] .. target .. [[", 1) fg("gold") deselect() resetFormat()]])

    Edit: Assuming you're targeting players.  If you're targeting denizens by something like fink, snake, etc, then you'd want to get rid of the first line.  Ideally, run a target alias for pvp, one for pve, that way you can highlight both.
    image
  • ErebosErebos Member Posts: 68 Capable
    Man, thanks!  Life saver!
    image
  • ShaddusShaddus , the Leper Messiah Outside your window.Member Posts: 7,653 Transcendent
    I've probably seen four different ways of doing this, and this is by far the easiest way of doing it. Thank you!
    If I'm not good enough for Lusternia, then it is no longer good enough for me.
  • TarkentonTarkenton Traitor Bear Member Posts: 2,555 Transcendent
    I take zero credit for this, other than putting "highlight target in mudlet" into Google :p
    image
  • LysistrataLysistrata Member Posts: 30 Capable
    when I do this, my highlighted target seems to stay highlighted, even after I change targets. suggestions?
  • VeyilsVeyils Member Posts: 1,460 Mythical
    edited May 2017
    Not sure if the old code isnt working for some reason but I tried making one based on what that thingy said and this works:

    https://pastebin.com/i9uSFcmN

    or

    target = string.lower(matches[2])

    cecho("\n<red>MY TARGET IS: <white>"..string.title(target))

    if (colourtarget) then killTrigger(colourtarget) end

    colourtarget = tempTrigger(target, [[selectString("]] .. target .. [[", 1) fg("gold") deselect() resetFormat()]])



  • VeyilsVeyils Member Posts: 1,460 Mythical
    Hmm this works but  mm name database seems to over write it.
  • ValyshaValysha Member Posts: 4 Novice
    Highlights your target red and capitalizes the name for you. The color does go away once you target someone else or target nothing at all. Also, it overrides NDB.  Hope it helps! :D



    ALIAS IS AS FOLLOWS:

    pattern is: ^t (.*)

     Big White Box:
                                 
    setTarget(matches[2]:title())






    SCRIPT IS AS FOLLOWS:

    function setTarget(tar)
       target = tar
       if id then killTrigger(id) end
       id = tempRegexTrigger("\\b(?i)" .. target .. "\\b", [[colorAllInLine(matches[1], "red")]])
       cecho("<white>=<gold>)_)_)_)_)_)_)_)_)_)_)_<white>@<;red> " .. target:title())
        
       send(" ")
    end
    --coloring script for targetting
    function colorAllInLine(word, color)
       local i = 0
       for _ in string.gmatch(line, word) do
          i = i + 1
          selectString(word, i)
          fg(color)
       end
    end

  • ValyshaValysha Member Posts: 4 Novice
    Feel free to edit the colors and wand I drew. hehe
  • CiaranCiaran Member Posts: 772 Mythical
    I recommend making a little table for this script, just for tidiness.  (Global variables proc my OCD)

    So I'd add above the function:

    valScript = valScript or {}

    and replace all instances of tar or id with valScript.tar and valScript.id!

    Nice work :)
    To me you're forever the kick runner from 3 years ago, the guy who does domoths when no one is online and whines that he's got no competition, and the guy that use to only turn up to fights when the numbers favoured him.
  • ValyshaValysha Member Posts: 4 Novice
    Ciaran said:
    I recommend making a little table for this script, just for tidiness.  (Global variables proc my OCD)

    So I'd add above the function:

    valScript = valScript or {}

    and replace all instances of tar or id with valScript.tar and valScript.id!

    Nice work :)
    Ooohh! Getting fancy on me! Thanks for that. :smile:
  • CiaranCiaran Member Posts: 772 Mythical
    edited September 2017
    You can also put the functions within that table if you like. (Just make sure to define your table before trying to define the function!)

    So it'd look like this:

    valScript = valScript or {}


    function valScript.setTarget(tar)
    ......blah......
    end

    The more you know! :)
    To me you're forever the kick runner from 3 years ago, the guy who does domoths when no one is online and whines that he's got no competition, and the guy that use to only turn up to fights when the numbers favoured him.
Sign In or Register to comment.