Jump to content

Recommended Posts

Posted

Hey, I have a problem with the IRC UDF Chip made.

So, when I connect and leave the IRC bot idle(more than ~2 minutes), it disconnects.

It gives me this error message:

<TEST_BOT> Hello!
* TEST_BOT has quit IRC (Broken pipe)

And AutoIT gives me this:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Jay\My Documents\Programming\My AutoIT\IRC BOT\8ball.au3"  
C:\Program Files\AutoIt3\Include\IRC.au3 (120) : ==> Variable used without being declared.: 
TCPSend($irc, "PONG " & $ret & @CRLF) 
TCPSend(^ ERROR
>Exit code: 0   Time: 106.255

This can't be a problem with the actual bot, because it says "C:\Program Files\AutoIt3\Include\IRC.au3 (120) : ==> Variable used without being declared"

This is the part of the UDF that is giving me the trouble:

;===============================================================================
;
; Description:    Returns a PING to Server
; Parameter(s):  $irc - Socket Identifer from _IRCConnect ()
;                   $ret - The end of the PING to return
; Requirement(s):   _IRCConnect () to be run
; Return Value(s):  On Success - 1
;                  On Failure - -1 = Server disconnected.
; Author(s):        Chip
; Note(s):        English only
;
;===============================================================================
Func _IRCPing($ret)
    If $ret = "" Then Return -1
    TCPSend($irc, "PONG " & $ret & @CRLF)
        If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFunc

But I don't know a lot of AutoIT, so I can't decipher the error message :shocked:

Please, any help will be greatly appreciated!

8ball.au3

IRC.au3

Posted (edited)

Edit: Sorry for the double post, I just thought it would be handy for people who have troubles with this UDF.

mmavipc, a wonderful AutoIT user has solved the problem!

Here's what mmavipc said:

at the top of the UDF add

Global $ircoÝ÷ Ù©Ý­êeiÇ­â*'ç-~éܶ*'Â+ajëh×6Func _IRCConnect ($server, $port, $nick)
    $irc = TCPConnect(TCPNameToIP($server), $port)
    If $irc = -1 Then Exit MsgBox(1, "IRC.au3 Error", "Server " & $server & " is not responding.")
    TCPSend($irc, "NICK " & $nick & @CRLF)
    $ping = tcprecv($irc,2048)
    if stringleft($ping,4) = "PING" Then
        $pong = stringreplace($ping,"PING :","")
        tcpsend($irc,"PONG " & $pong & @LF)
    EndIf
    TCPSend($irc, "USER " & $nick & " 0 0 " & $nick &@CRLF)
    Return $irc
EndFunc
Edited by lolwut

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...