Re: counting characters in lua

I'm not sure all the complexity in post two is required. Simply create a regular _expression_ trigger that does some substitutions.
Assuming your text string, make your regular _expression_ trigger like this:
^(.+)\: (#+)$

This trigger assumes that the skill/spell names may change, but the counter symbol afterwards will not -- it will always be using number signs. The karet at the beginning means this trigger can only match on a new line, and the dollar sign at the end means that this trigger is only valid if the line ends right after the text. If there are any white spaces before or after, you may want to add \s* to your trigger, either right after the karet if blank spaces might appear at the beginning of the line, or right before the dollar sign if there might be trailing blank spaces on the line after the counter symbols.

Make sure the regular _expression_ and omit from output check boxes for the trigger are enabled. Make sure the Send To combo box is set to script after omit. In the Send text field, put the following:
Note(Trim("%1") .. ": " .. string.len(Trim("%2")))

This little script says Note to the output window the following: First trim the contents of the first wildcard of any blank spaces, then append a colon followed by a space. Next, determine and include the length of the contents of the second wildcard, but only after we've trimmed it of blank spaces.

Kai

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : goran via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Xoren via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Xoren via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Xoren via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Xoren via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Xoren via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : goran via Audiogames-reflector

Reply via email to