Bolding a Captured Variable for Echo?

Hello,

Looking for help in regards to capturing a wildcard via a trigger and bolding that particular wildcard in an echo.

[ SnB PvP Guide | Link ]

[ Runewarden Sparring Videos | Link ]

Comments

  • ZahanZahan Valhalla
    Are you having trouble capturing the wildcard?  If so, let's see the pattern.

    Capturing it already?  Is it safe to assume you're on mudlet?

    There is a pretty easy way to do bold echos in mush, by setting a note style before the note.  Not sure about mid-line though, I haven't tried that yet.  Definitely not sure about mudlet.

    I usually just change the colour of the word in the sentence, but bolding stuff sounds fun.  I might try it myself.
    Click here for Nexus packages
    Currently available: Abs, Cnote, Keepalive, Lootpet, Mapmod
  • AhmetAhmet Wherever I wanna be
    edited January 2017
    selectCaptureGroup (2) setBold (true) deselect ()
    Huh. Neat.
  • edited January 2017
    I don't have any trouble with capturing it. It's the bolding in the echo part that I'm having trouble with.

    @Ahmet : Oh, what does selectCaptureGroup(2) do?

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • AhmetAhmet Wherever I wanna be
    selectCaptureGroup selects whatever text is in the matches group for your current trigger. 1 for the whole line, 2 for your first capture group, etc.
    Huh. Neat.
  • I tried this, still doesn't seem to work HMMM

    ^(\w+) leaves to the (\w+).   (perl regex)



    if target == matches[2] then

    direction = matches[3]:upper()

    selectCaptureGroup (3) setBold (true) deselect ()

    cecho("\n <GreenYellow> MOVED ::::::> [ >> " ..direction.. " << ]")

    cecho("\n <GreenYellow> MOVED ::::::> [ >> " ..direction.. " << ]")

    cecho("\n <GreenYellow> MOVED ::::::> [ >> " ..direction.. " << ]")

    cecho("\n <GreenYellow> MOVED ::::::> [ >> " ..direction.. " << ]")

    end




    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • You have the beginning anchor but not the end. Also you're not escaping your period at the end.

    ^(\w+) leaves to the (\w+)\.$

    Also, when you select the capture group, you may need to use matches[3] instead of just 3. I could be wrong on this one though.




    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • Thanks but capturing isn't the problem though. It captures both variables without the anchor.



    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • Try to select direction too?

    selectCaptureGroup(direction)
    setBold(true)
    deselect()

    no idea if you can do that or not 




    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • AhmetAhmet Wherever I wanna be
    Cant do that, no.
    Huh. Neat.
  • edited January 2017
    If you're trying to bold the echo, I'm pretty sure you can't. Could be wrong, though. Nothing I tried in the past worked at least.
  • AhmetAhmet Wherever I wanna be
    You can bold an echo by using setBold(true) before your echo. It's nearly indistinguishable from regular text unless you highlight it or use a very large font size, though.
    Huh. Neat.
  • edited January 2017
    Ok well, thanks anyways, guys. I'll just pay more attention to the unbolded stuff.

    setBold(true) works on echoes but not on specific variables, I think?

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • AhmetAhmet Wherever I wanna be
    Setbold should work on your trigger as well as long as you've selected the text (which selectCaptureGroup does)
    Huh. Neat.
  • The setBold function doesn't work with cecho, only with standard echo or insertText. That's why it's not working.
  • Is there a way to make it work with cecho?

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • Is there a way to make it work with cecho?
    There's a workaround. Try this:
    cecho("\n <GreenYellow> MOVED ::::::> [ >> ")<br>setBold(true)<br>fg("GreenYellow")<br>echo(direction)<br>resetFormat()<br>cecho("<GreenYellow>&nbsp;<< ]")

    You can put it all on one line, like so, for easy reading:
    cecho("\n <GreenYellow> MOVED ::::::> [ >> "); setBold(true); fg("GreenYellow");&nbsp;echo(direction); resetFormat();&nbsp;cecho("<GreenYellow>&nbsp;<< ]")
    Testing this, it works, and the text definitely bolds, though how easy it is to tell remains dependent on your font and font size.
  • edited January 2017
    Awesome, thanks!! That worked.

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
Sign In or Register to comment.