|
forren Novice
Joined: 26 Apr 2007 Posts: 44
|
Posted: Sat Jul 07, 2007 11:45 pm
Imbedding ANSI for later display |
I'm trying to imbed some %ansi commands into a variable so I can just call the variable itself on my prompt trigger and have it easily display the variable, which can either be filled with the colored word or null, having it do nothing.
#VAR promptPipesDisplay %null
$pipes = myrtlePipe|coltsfootPipe|faeleafPipe
#fo $pipes
{
$puffs = @settings.%concat(%i, "Puffs")
#if ($puffs <= 2)
{
$thing = %concat("fillpipe ", %i)
#VAR promptPipesDisplay "%ansi(high,yellow)PIPES%ansi(high,blue)|"
balanceEnqueue {$thing}
}
}
Is there any way to do this successfully? So far I just get the actual string when #SAYPing it in the prompt trigger. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jul 08, 2007 12:24 am |
Firstly, you need to include the @s to make the $pipes variable work. I'm not sure if you'd edited that deliberately to give a generic example or not, but it needs to change.
Also, you're doing some implicit concatenation in the @settings.whateverPuffs variable reference. That probably needs to be made explicit.
You also don't need to quote the %ansi functions - you can expand them when you assign the variable. This is the only change you should need to make to fix the script. The rest are good practice. Here's the final result:
#VAR promptPipesDisplay %null
$pipes={@MyrlePipe|@ColtsfootPipe|@FaeleafPipe}
#fo $pipes
{
$puffs = @{%concat("settings.",%i,"Puffs")}
#if ($puffs <= 2)
{
$thing = %concat("fillpipe ", %i)
#VAR promptPipesDisplay %concat(%ansi(high,yellow),"PIPES",%ansi(high,blue),"|")
balanceEnqueue {$thing}
}
} |
|
|
|
forren Novice
Joined: 26 Apr 2007 Posts: 44
|
Posted: Sun Jul 08, 2007 12:42 am |
Rest of the script is working just fine - the only problem is that string is being treated as any other, and appearing as the raw %ansi(high,yellow)PIPES%ansi(high,blue)| string. Will try it.
Also - I don't need @s before the various myrtlePipe/coltsfootPipe names. They are entries in a data record. |
|
|
|
|
|
|
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
|
|