This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Replacing in a variable a word by a value of another var..

Old posts that have not been replied to for several years.
Locked
l
l337
Voice
Posts: 6
Joined: Sat Jan 15, 2005 4:36 pm

Replacing in a variable a word by a value of another var..

Post by l337 »

Hello:)
this is my code :

Code: Select all

bind pub - !try try
proc try {nick uhost hand chan arg} {

set var1 "Salut ca va bien et toi"
set var2 [string map {"Salut" "Aurevoir"} $var1]
set var_replace "erf"

set var3 [string map {"Salut" $var_replace} $var1]
putquick "PRIVMSG $chan :$var1 devient $var2 qui devient $var3"
}
and it say :
Salut ca va bien et toi devient Aurevoir ca va bien et toi qui devient ${var_replace} ca va bien et toi

and he didn't replace Salut by the value of $var_replace :(

anyone know pls ?
thx :)
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

Code: Select all

set var3 [string map [list "Salut" $var_replace] $var1]
photon?
l
l337
Voice
Posts: 6
Joined: Sat Jan 15, 2005 4:36 pm

Post by l337 »

working, thank you :)
Locked