|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Mar 21, 2010 2:40 am
Trigger on Blank Line? |
So, I have a trigger that highlights names, and uses a bunch of #sayadds as well.
The trigger is off most of the time, as its interference in the game would be annoying. However, specific lines will turn it on. After those lines have executed, it turns back off. The problem is that, some of the lines display multiple names which all need to be highlighted, example:
The following players are near you:
Someone something
Blah blue
Dee dah
< prompt >
Everything below "The following players..." and above "< prompt > needs to be highlighted. The trigger does that. And, I have a trigger that patterns after my prompt to stop it.
That would be perfect, if I didn't want to share this trigger. But I do. And people have different prompts, so I can't make a "one fits all" for the prompt. I suppose I could require them to have one particular thing in their prompt like #/#hp for their hp or something like that. But the ideal situation would be to have a trigger on a blank line, only turned on when the others are, that turns the other triggers and itself off when a blank line happens. Is that possible? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Mar 21, 2010 3:05 am |
Code: |
#trigger "tNameHighlight" {^The following players are near you:$} {}
#condition {(*)} {
#if (%1 != "") {
//this is not a blank line
#cw [b]color to highlight[/b]
} {
//this is a blank line
#state tNameHighlight 0
}
} {manual}
|
To make it genericer, you will need to provide exact examples. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Mar 21, 2010 3:35 am |
It's an interesting approach. I haven't done much with conditional triggers, I admit, and so it had only thought of it in passing. The trigger is already created. I'll share it, though I would certainly like to be able to take your advice and apply it myself so that I can feel more personally competent. I've made the script, its finished, and now I have to "debug" as it were, which was almost my least favorite part of scripting and coding. *sigh*
This turns the highlighting on, I will be changing the pattern to a stringlist variable eventually:
Code: |
<trigger name="Turn-Highlight-On" priority="3840" regex="true" id="405">
<pattern>(Players near you:|You quest out with your magic in search of others\.|Looking around you see:)</pattern>
<value>#T+ Highlight-t
#T+ Turn-Highlight-Off</value>
</trigger>
|
This does the actual highlighting:
Code: |
<trigger name="Highlight-t" priority="3940" regex="true" enabled="false" id="413">
<pattern>^(@c_name)</pattern>
<value>$_mem_num = %ismember(%1, @c_name)
#switch (%item(@c_clan, $_mem_num))
("Justice") {
#if (@_s_highlight)
{
#cw 1
}
#if (@_s_flag)
{
#sayadd " ["%ansi(1)" Justice "%ansi(reset)"]"
}
}
("Bloodlust") {
#if (@_s_highlight)
{
#cw 4
}
#if (@_s_flag)
{
#sayadd " ["%ansi(4)" Bloodlust "%ansi(reset)"]"
}
}
("Shadow") {
#if (@_s_highlight)
{
#cw 3
}
#if (@_s_flag)
{
#sayadd " ["%ansi(3)" Shadow "%ansi(reset)"]"
}
}
("Knighthood") {
#if (@_s_highlight)
{
#cw 9
}
#if (@_s_flag)
{
#sayadd " ["%ansi(9)" Knighthood "%ansi(reset)"]"
}
}
("Conclave") {
#if (@_s_highlight)
{
}
#if (@_s_flag)
{
#sayadd " ["%ansi(14)" Conclave "%ansi(reset)"]"
}
}
("Red Robes") {
#if (@_s_highlight)
{
#cw 12
}
#if (@_s_flag)
{
#sayadd " ["%ansi(12)" Red Robes "%ansi(reset)"]"
}
}
("White Robes") {
#if (@_s_highlight)
{
#cw 15
}
#if (@_s_flag)
{
#sayadd " ["%ansi(15)" White Robes "%ansi(reset)"]"
}
}
("Black Robes") {
#if (@_s_highlight)
{
#cw 3
}
#if (@_s_flag)
{
#sayadd " ["%ansi(3)" Black Robes "%ansi(reset)"]"
}
}
("Slayers") {
#if (@_s_highlight)
{
#cw 14
}
#if (@_s_flag)
{
#sayadd " ["%ansi(14)" Slayers "%ansi(reset)"]"
}
}
("Shalonesti") {
#if (@_s_highlight)
{
#cw 2
}
#if (@_s_flag)
{
#sayadd " ["%ansi(2)" Shalonesti "%ansi(reset)"]"
}
}
("Wargar") {
#if (@_s_highlight)
{
#cw 11
}
#if (@_s_flag)
{
#sayadd " ["%ansi(11)" Wargar "%ansi(reset)"]"
}
}
("Loner") {
#if (@_s_highlight)
{
}
#if (@_s_flag)
{
#sayadd " ["%ansi(15)" Loner "%ansi(reset)"]"
}
}
("Renegade") {
#if (@_s_highlight)
{
}
#if (@_s_flag)
{
#sayadd " ["%ansi(15)" Renegade "%ansi(reset)"]"
}
}
{#sayadd " [Nothing]" }
#if (@_s_lvl)
{
#sayadd "("%item(@c_lvl, $_mem_num)")"
}
#if (@_s_class)
{
#sayadd "("%item(@c_class, $_mem_num)")"
}
#if (@_s_rank)
{
#sayadd "("%item(@c_rank, $_mem_num)")"
}</value>
</trigger>
|
This turns it off:
Code: |
<trigger name="Turn-Highlight-Off" priority="3860" regex="true" enabled="false" id="406">
<pattern>\d+/\d+hp</pattern>
<value>#T- Highlight-t
#T- Turn-Highlight-Off</value>
</trigger>
|
As you can see, I went for the generic entry in the prompt to universalize it better, but the blank line would still be the best option. I'm wondering if I can make the "off" trigger's pattern {*} and have it still function as it does now with the script. Will that capture the blank line and turn it off before any prompts? |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sun Mar 21, 2010 5:30 pm |
Doesn't the pattern:
^$
only match blank lines? I seem to remember using this to trigger on a blank line to turn off another capture trigger that was running. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Mar 21, 2010 6:33 pm |
Seems to work. Thanks!
|
|
|
|
|
|