IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: HackBenjamin on June 25, 2008, 04:18:57 PM

Title: /scid wrong channel and server
Post by: HackBenjamin on June 25, 2008, 04:18:57 PM
I made this CTCP script today for my bot.

Code: [Select]
Dim target
Dim nick
Dim chan
DIm net

Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
nick = lcase(nickname)
chan = lcase(channel)
net = getidentifier("$network",servernumber)
if lcase(left(message,6)) = "`ping " then
 if len(message) > 6 then
  target = mid(message,7)
   sendcommand "/ping " & target,servernumber
 end if
end if
if lcase(left(message,9)) = "`version " then
 if len(message) > 9 then
  target = mid(message,10)
   sendcommand "/version " & target,servernumber
 end if
end if
if lcase(left(message,6)) = "`time " then
 if len(message) > 6 then
  target = mid(message,7)
   sendcommand "/time " & target,servernumber
 end if
end if
if lcase(left(message,8)) = "`finger " then
 if len(message) > 8 then
  target = mid(message,9)
   sendcommand "/ctcp " & target & " FINGER",servernumber
 end if
end if
End Sub

Sub ONCTCPREPLY(Nickname,CTCP,Reply,ServerNumber)
if nickname = target then
 if ctcp = "PING" then
  sendcommand "/scid " & net & " /msg " & chan & " " & target & "'s PING reply: " & reply,servernumber
 elseif ctcp = "VERSION" then
  sendcommand "/scid " & net & " /msg " & chan & " " & target & " is using " & reply,servernumber
 elseif ctcp = "TIME" then
  sendcommand "/scid " & net & " /msg " & chan & " It is " & reply & " where " & target & " is located.",servernumber
 elseif ctcp = "FINGER" then
  sendcommand "/scid " & net & " /msg " & chan & " " & target & "'s FINGER reply: " & reply,servernumber
 end if
end if
End Sub

Problem is, sometimes it sends the CTCP reply to the wrong server/channel

 The question: How can that error be avoided?
Title: Re: /scid wrong channel and server
Post by: Snerf on June 25, 2008, 04:55:08 PM
You have the ServerNumber, you do not need to use /scid.

SendCommand "/msg " & Chan & " " & target & ".....",ServerNumber
Title: Re: /scid wrong channel and server
Post by: HackBenjamin on June 25, 2008, 05:14:38 PM
Silly me, I can't believe I did not see this.

:mrgreen:

Heh, that's pretty cool./me waves at  mrgreen