egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

string map question

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
droolin
Halfop


Joined: 24 Jul 2003
Posts: 64

PostPosted: Thu Sep 06, 2007 10:57 pm    Post subject: string map question Reply with quote

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
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Sep 07, 2007 12:03 am    Post subject: Reply with quote

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
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Sep 07, 2007 6:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber