Jump to content

IRC UDF


McGod
 Share

Recommended Posts

  • 5 months later...

Hi, [sorry if I should post in another forum]

I have a problem with this scripts.

The _IRCPing function is bugging apparently.

Here is my output:

C:\...\irc.au3(120,14) : WARNING: $irc: possibly used before declaration.

TCPSend($irc,

~~~~~~~~~~~~^

C:\...\irc.au3(120,14) : ERROR: $irc: undeclared global variable.

TCPSend($irc,

~~~~~~~~~~~~^

You can see my 2 attached files (main is the launcher and irc is the func library).

Thanks in advance,

Zopieux

main.au3

irc.au3

Edited by Zopieux

I'm not English, then please excuse my spelling :)

Link to comment
Share on other sites

Replace

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

with

Func _IRCPing($irc, $ret)

If $irc = -1 Then Return 0

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

Link to comment
Share on other sites

Ok thanks, I don't have error anymore but now, the script can't connect the server, I get the message "Server has errored or disconnected", whereas the irc.epkinet.org server exists... Is my firewall able to block the connection, maybe?

EDIT: it works on another server, like chat.freenode.net... Why?

Edited by Zopieux

I'm not English, then please excuse my spelling :)

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Hi Chip,

thanks for this functions. This works fine.

I've added a new one, that allows to send messages as ACTION.

Func _IRCSendAction ($irc, $msg, $chan="")
    If $irc = -1 Then Return 0
    If $chan = "" Then
        TCPSend($irc, $msg & @CRLF)
        If @error Then 
            MsgBox(1, "IRC.au3", "Server has disconnected.")
            Return -1
        EndIf
        Return 1
    EndIf
    TCPSend($irc, "PRIVMSG " & $chan & " :" & Chr(1) & "ACTION " & $msg & Chr(1) & @CRLF)
        If @error Then 
        MsgBox(1, "IRC.au3", "Server has disconnected.")
        Return -1
    EndIf
    Return 1
EndFuncoÝ÷ Ù±!?Ûwv¢Ø^­û§rبÂÞj÷©çzV§u¢´*'ç-ȶ§z0Û¢jez׺Ú"µÍÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÂÈØÜ[ÛX]HHTÈÚ[[È[Y]ÊN   ÌÍÚÈHÛØÚÙ]Y[YÛHÒTÐÛÛXÝ

BÂBBBBIÌÍÛÙÈHYÜØYÙHÈÙ[Ú]TÜ[Û[È]Z[Y[
ÊNÒTÐÛÛXÝ

HÈH[È][YJÊNÛÝXØÙÜÈHBÈÛZ[HHLHHÙØÛÛXÝYÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOB[ÈÒTÓX]PÚ[[
    ÌÍÚË    ÌÍÛÙÏI][ÝÉ][ÝË ÌÍØÚ[I][ÝÉ][ÝÊBRY   ÌÍÚÈHLH[]UÔÙ[
    ÌÍÚË    ][ÝÔT ][ÝÈ  [È ÌÍØÚ[   [È ][ÝÈ][ÝÈ    [È ÌÍÛÙÈ  [ÈÔBBRYÜ[BSÙÐÞ
K   ][ÝÒTË]LÉ][ÝË ][ÝÔÙÈØÛÛXÝY][ÝÊBBT]LBQ[YT]B[[ÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÂÈØÜ[ÛÛÜÙHHTÈÛÛXÝ[ÛÈ[Y]ÊN ÌÍÚÈHÛØÚÙ]Y[YÛHÒTÐÛÛXÝ

BÂBBBBIÌÍÛÙÈHYÜØYÙHÈÙ[Ú]]Z]Ü[Û[
ÝXHÈÙYHÚ][ÛY[ÊBÈ]Z[Y[
ÊNÒTÐÛÛXÝ

HÈH[È][YJÊNÛÝXØÙÜÈHBÈÛZ[HHLHHÙØÛÛXÝYÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOB[ÈÒTÔ]Z]
    ÌÍÚË    ÌÍÛÙÏI][ÝÉ][ÝÊBRY  ÌÍÚÈHLH[]UÔÙ[
    ÌÍÚË    ][ÝÔURU][ÝÈ [È ÌÍÛÙÈ  [ÈÔBT]B[[
Edited by BugFix

Best Regards BugFix  

Link to comment
Share on other sites

  • 4 years later...

Thank you!! This is what I needed to build a 'simple' method for allowing 2 scipts to communicate via IRC. I'm currently using this to connect to a personal IRC channel online and send commands to another autoit script with a serial connection to Arduino so I can remotely control my servo. It's not a pretty solution, but I think I can make something work

(I would use SMTP/POP protocols, but the delay was too significant for my needs)

Also, Thought i'd add my $0.02 to this awesome udf.

I added this line to the example.au3 before the WEnd:

If StringLen($recv) > 0 Then ToolTip($recv,"" ,"","IRC response",1)

This generates an awesome tool-tip that helped me figure out how to use the $recv in my code to receive commands from another script

Edited by cassetti
Link to comment
Share on other sites

---------------------------

AutoIt Error

---------------------------

Line 120 (File "C:\Users\User\Desktop\IRC.au3"):

TCPSend($irc, "PONG " & $ret & @CRLF)

TCPSend(^ ERROR

Error: Variable used without being declared.

---------------------------

OK

---------------------------

Link to comment
Share on other sites

TCPSend($irc, "PONG " & $ret & @CRLF)

TCPSend(^ ERROR

Read this thread, there are at least 2 posts describing this and the fix for it. Try doing a LITTLE work before posting an error report, especially when dealing with a 5 year old thread.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

BrewManNH

I did read but I am still having errors

after replacement _IRCPING's function and changing the number of arguments (parameters) , I need to change main.au3 so _IRCPING("PONG",) would send two params.

what is the second parameter would be ?

---------------------------
AutoIt Error
---------------------------
Line 18  (File "C:UsersUserDesktopmain.au3"):
If $sTemp[1] = "PING" Then _IRCPing($sTemp[2])
If $sTemp[1] = "PING" Then ^ ERROR
Error: Incorrect number of parameters in function call.
---------------------------
OK  
---------------------------
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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