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.

script symbol chaos!

Old posts that have not been replied to for several years.
Locked
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

script symbol chaos!

Post by NewzUK »

Hi there

I have a mIRC bot that msg's info to my eggdrop bot (because the news script is for mIRC, but I send it to the eggdrop to announce). However, when the line of news contains certain symbols, the eggdrop outputs to the channel like this:

Eurostocks open {flat;} RWE, Repsol gain, Aviva dips (Reuters)

As you can see, it puts { } around the word (flat) that contains a symbol - in this case a semi-colon.

The TCL script I'm using to announce the info in the channel is msg_say.tcl from the egghelp library (below)

Would appreciate any ideas to get rid of this problem!

Thanks.
# this script is used to talk "anonymously" on a chan
# msg the bot using: /msg $botnick !say #chan ......
# and everything after "#chan" will be displayed in "#chan"


bind msg - !say msg_say

proc msg_say {nick uhost hand args} {
global botnick
if {[llength [lindex $args 0]]<2} {
putserv "NOTICE $nick :/msg $botnick !say <#chan> <something to say>"
} else {
set chan [lindex [lindex $args 0] 0]
if { ![validchan $chan]} {
putserv "NOTICE $nick :\"$chan\": invalid chan."
return 0
}
## FIX ME this condition is never reached
if { ![onchan $botnick $chan] } {
putserv "NOTICE $nick :je ne suis pas sur le chan \"$chan\"."
return 0
}
## END FIX ME
# comment this next 4 lines if you want to be able to talk in a chan you're not in
if { ![onchan $nick $chan] } {
putserv "NOTICE $nick :tu n'es pas sur le chan \"$chan\"."
return 0
}
set msg [lrange [lindex $args 0] 1 end]
}
putchan $chan $msg
}

putlog "msg_say.tcl by fraff"
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

While you seemed to have made an effort to contain list commands on string, you have failed. This looks to be down to one issue, the use of the $args variable.

When using this, you have ended up using more commands than needed, and to most eyes, would looks like these list on string issues are contained.

Code: Select all

# this script is used to talk "anonymously" on a chan 
# msg the bot using: /msg $botnick !say #chan ...... 
# and everything after "#chan" will be displayed in "#chan" 


bind msg - !say msg_say 

proc msg_say {nick uhost hand arg} { 
  global botnick
  set arg [split $arg]
  if {[llength $arg] < 2} { 
    putserv "NOTICE $nick :/msg $botnick !say <#chan> <somethingtosay>" 
  } else { 
    set chan [lindex $arg 0] 
    if { ![validchan $chan]} { 
      putserv "NOTICE $nick :\"$chan\": invalid chan." 
      return 0 
    } 
    ## FIX ME this condition is never reached 
    if { ![onchan $botnick $chan] } { 
      putserv "NOTICE $nick :je ne suis pas sur le chan \"$chan\"." 
      return 0 
    } 
    ## END FIX ME 
    # comment this next 4 lines if you want to be able to talk in a chan you're not in 
    if { ![onchan $nick $chan] } { 
      putserv "NOTICE $nick :tu n'es pas sur le chan \"$chan\"." 
      return 0 
    } 
    set msg [lrange $arg 1 end] 
  } 
  putchan $chan $msg 
} 

putlog "msg_say.tcl by fraff"
That should clear most of it up. However, I havn't fully checked it.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

thanks pp - I've tried what you've posted, but it's still returning { } around $ and ; signs... :-?

btw - I didn't write the script, but I hope it's author is following this threat!
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

he forgot to make the msg variable into a string
do it like this:

Code: Select all

set msg [join [lrange $arg 1 end]]
the output should be correct then
Elen sila lúmenn' omentielvo
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

hmmm that's not outputting anything now - no TCL error tho...sorry

:-?
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

well... that's not because of the line I gave you.... btw.. you did understand that you were supposed to replace this line

Code: Select all

set msg [lrange $arg 1 end]
didn't you :)
Elen sila lúmenn' omentielvo
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

sorry - I made a mistake - it's working perfectly now - thanks alot for the help :)
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

hi again - actually, it's outputting, but now it's ignoring $ signs completely

original txt to display: L.Lease sells US HCI unit for $102 mln (Reuters)

outputted as: L.Lease sells US HCI unit for mln (Reuters)

thanks...
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Can you post the script as it is now, and look in the partyline of the bot, to see of there are any errors.

It sounds like it is interpreting them as variables, but unless you are using expr, eval, subst or timers, there should be no issue of this.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

bind msg - !say msg_say

proc msg_say {nick uhost hand arg} {
global botnick
set arg [split $arg]
if {[llength $arg] < 2} {
putserv "NOTICE $nick :/msg $botnick !say <#chan> <somethingtosay>"
} else {
set chan [lindex $arg 0]
if { ![validchan $chan]} {
putserv "NOTICE $nick :\"$chan\": invalid chan."
return 0
}
set msg [join [lrange $arg 1 end]]
}
putchan $chan $msg
}

putlog "Say loaded"


there are no errors in the partyline...thanks.
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Replace this line with the following

Code: Select all

putchan $chan $msg
to

Code: Select all

puthelp "PRIVMSG $chan :$msg"
I don't any reason to, but the above command, may be interpreting the variable.

Ontop, are you able yourself to send strings with $ to the IRC server? The IRC server may filter text, to help curb the effects of people trying to exploit users with the $decode worms and tricks.

You may also wish to use the putlog command, as the ifrst line of the script (inside the proc), to see exactly what eggdrop is receiving.
Locked