The variable can return this format: Artist-Song
or
this format: Artist - Song
I have made this script that works only for one of the options.
Example:
Code: Select all
bind pub n|n !t testing
proc testing {nick uhost handle chan text} {
set liveme "Janis Joplin-Piece Of My Heart"
putquick "PRIVMSG $chan :\<artistName\>[lindex [split $liveme "-"] 0]\<\/artistName\>"
putquick "PRIVMSG $chan :\<songName\>[lindex [split $liveme "-"] 1]\<\/songName\>"
}
But...17:34 @mybot ¦ <artistName>Janis Joplin</artistName>
17:34 @mybot ¦ <songName>Piece Of My Heart</songName>
If the variable contains the other format, spaces are left after the artist name and before the song name.
Example2:
Code: Select all
bind pub n|n !t testing
proc testing {nick uhost handle chan text} {
set liveme "Janis Joplin - Piece Of My Heart"
putquick "PRIVMSG $chan :\<artistName\>[lindex [split $liveme "-"] 0]\<\/artistName\>"
putquick "PRIVMSG $chan :\<songName\>[lindex [split $liveme "-"] 1]\<\/songName\>"
}
I need the format to always be the same regardless of the value of the variable.17:34 @mybot ¦ <artistName>Janis Joplin </artistName>
17:34 @mybot ¦ <songName> Piece Of My Heart</songName>
I need always to achieve this:
EDIT: Fixed!<artistName>Janis Joplin</artistName>
<songName>Piece Of My Heart</songName>
Code: Select all
bind pub n|n !t testing
proc testing {nick uhost handle chan text} {
set liveme ""Janis Joplin - Piece Of My Heart""
set liveme1 "\<artistName\>[lindex [split $liveme "-"] 0]\<\/artistName\>"
set liveme2 "\<songName\>[lindex [split $liveme "-"] 1]\<\/songName\>"
set liveme1 [string map [list " </" "</"] $liveme1]
set liveme2 [string map [list "> " ">"] $liveme2]
putmsg $chan "$liveme1"
putmsg $chan "$liveme2"
}