| View previous topic :: View next topic |
| Author |
Message |
droolin Halfop

Joined: 24 Jul 2003 Posts: 64
|
Posted: Thu Sep 06, 2007 10:57 pm Post subject: string map question |
|
|
When looking through these threads, I seen where a suggestion was made to use string map instead of regsub, which seemed to fit a situation that I am trying to code for. But, for some reason I am having problems with this.
I am trying to use a variable for the replacement value, and the variable name is what is actually being replaced.
" | Code: | :\0038,12 Welcome To ~~~~~~~~, Our current DJ is ^^^^^^^^ \xab\xa7\xbb:\0038,1 The AweRockRadio Team \xab\xa7\xbb"
set lcl_new_msg1 [string map -nocase {~~~~~~~~ $chan ^^^^^^^^ $gbl_DJ_Current_Nick} $gbl_ary_text(OnJoinMsg1)] |
And this is what appears.
- | Quote: | | ozzy- Welcome To $chan, Our current DJ is $gbl_DJ_Current_Nick «§»: The AweRockRadio Team «§» |
Any suggestions as to what I am doing wrong here?
Any and all help appreciated.
Dan |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Fri Sep 07, 2007 12:03 am Post subject: |
|
|
string map wont recognize variables within its map like that. I don't really see why you'd need it tho, when you can just do
set lcl_new_msg1 ":\0038,12 Welcome To $chan, Our current DJ is $gbl_DJ_Current_Nick \xab\xa7\xbb:\0038,1 The AweRockRadio Team \xab\xa7\xbb "
or whatever..That assumes $chan and $gbl_DJ_Current_Nick were previously defined of course. |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri Sep 07, 2007 6:19 am Post subject: |
|
|
The braces prevent variable substitution. Use list to create your map...
| Code: | | string map [list ~~~ $x ^^^ $y ... $z] $msg |
_________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
|