|
Shanerz Newbie
Joined: 27 May 2003 Posts: 4 Location: USA
|
Posted: Tue May 27, 2003 5:33 pm
Problems with #sub and ansi color |
I'm using the following trigger (somplified) to gag mud prompts and display them in a nicer format.
#trigger {^< &{stuff} > &{rest}$} {#if @rest="" {#gag} {#sub @rest};#st @stuff}
The problem arises because the prompts are one color (green), and the following text varies. However whenever the #sub trigger fires text that would have been nongreen without the #sub turns into green.
Is there a way to preserve the original color? Is there a better way to gag prompts? What can I do to improve the situation? Does #sub just not preserve ansi color? Why not? |
|
|
|
Darkmere Novice
Joined: 23 May 2003 Posts: 31
|
Posted: Tue May 27, 2003 8:44 pm |
quote:
I'm using the following trigger (somplified) to gag mud prompts and display them in a nicer format.
#trigger {^< &{stuff} > &{rest}$} {#if @rest="" {#gag} {#sub @rest};#st @stuff}
The problem arises because the prompts are one color (green), and the following text varies. However whenever the #sub trigger fires text that would have been nongreen without the #sub turns into green.
Is there a way to preserve the original color? Is there a better way to gag prompts? What can I do to improve the situation? Does #sub just not preserve ansi color? Why not?
I didn't like the prompt to my Mud (actually I just wanted it improved) So I came up with this script that may help you in basic design. From what I have been able to see, #sub won't preserve ansi, but this script takes care of that..
#ALIAS prompton {#t+ prompt}
#CLASS {general|prompt}
#ALIAS promptoff {#t- prompt}
#VAR hpperc {100}
#VAR manaperc {67}
#VAR moveperc {98}
#VAR hpcol {3}
#VAR manacol {2}
#VAR movecol {2}
#TRIGGER {You have %d~(&%d{maxhp}~) hit, %d~(&%d{maxmana}~) mana and %d~(&%d{maxmove}~) movement points.} {}
#TRIGGER {~| (%d)H (%d)M (%d)V} {#VAR hpperc {%eval( (%1 * 100)/@maxhp)};#VAR manaperc {%eval( (%2 * 100)/@maxmana)};#VAR moveperc {%eval( (%3 * 100)/@maxmove)};#VAR hpcol {%if( @hpperc < 26, 4, %if( @hpperc < 51, 6, %if( @hpperc < 100, 2, 3)))};#VAR manacol {%if( @manaperc < 26, 4, %if( @manaperc < 51, 6, %if( @manaperc < 100, 2, 3)))};#VAR movecol {%if( @moveperc < 26, 4, %if( @moveperc < 51, 6, %if( @moveperc < 100, 2, 3)))};#SUB {%concat( "| ", %ansi( @hpcol), %1%ansi( green)H%ansi( @hpcol), "(", @hpperc, "%) ", %ansi( @manacol), %2%ansi( green)M%ansi( @manacol), "(", @manaperc, "%) ", %ansi( @movecol), %3%ansi( green)V%ansi( @movecol), "(", @moveperc, "%)", %ansi( def))}} "" {nocr|prompt}
#CLASS 0
It changes color, depending on the percent ranking of the hp/mana etc..
-Darkmere- |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue May 27, 2003 8:56 pm |
Untested. Assumes @rest is the next line from the MUD and NOT part of your actual prompt.
#TRIGGER {^~< &{stuff} ~>} {#GAG} {} {nocr|prompt}
LightBulb
Advanced Member |
|
|
|
Shanerz Newbie
Joined: 27 May 2003 Posts: 4 Location: USA
|
Posted: Tue May 27, 2003 11:09 pm |
I wasn't clear enough. Lightbulb guessed my intents the best. I want to show only @rest on the line. I went through solutions like what Lightbulb proposed. Two issues (I didn't mention my failed attempts) with the solution of Lightbulbs.
1) If the mud sends prompts on sequential lines for reasons beyond my control I see blank lines (happens when others are doing things). I'd prefer not to have those
2) The mud sometimes sends a prompt and output on the same line. I really don't want to see the prompt in those cases.
I solution I posted was the 'best' I'd found but it had ansi colorization issues. Now that I've explained more of what I want, can anyone still help?
-Shanerz
(Thanks for the good responses so far) |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|