»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 09-01-2003, 12:05 AM   #1 (permalink)
Banned
 
Join Date: Nov 2002
Location: Seattle, WA
Posts: 3,289
iNeb is on a distinguished road
Send a message via AIM to iNeb
Anyone here know pythlon?

I need to edit a VERY simple and short script for irc.

It's a page script that will page me when my nick is said (By page, it will play a sound file)

Only problem is, i want it to page me only when !nick is said.

Code:
### Edit the following variables to your likeing.
### filename - change this to the file you wish to play
### app - change this to the application name used to play the file.
###       the file name is placed after the command.
### response - change this to 0 to have it off by default.

response = 1
filename = "/home/tech/files/irc/scripts/irc.wav"
app      = "esdplay"

### Don't edit past here unless you know what you are doing!

import xchat
import os
import thread

__module_name__        = "Mike's Soundresponse"
__module_version__     = "1.0"
__module_description__ = "A Sound Response script"

print "Pager loaded!"

def soundresponse_cb( word, word_eol, userdata ):
    import __main__
    if len(word) < 2:
        print "You did not supply enough args."
        return xchat.EAT_ALL
    if word[1] == "on":
        __main__.response = 1
        print "Turning sound response on."
    elif word[1] == "off":
        __main__.response = 0
        print "Turning sound response off."
    elif word[1] == "file":
        if len(word) < 3:
            print "You did not supply a file name."
        else:
            __main__.filename = word[2]
    elif word[1] == "app":
        if len(word) < 3:
            print "You did not supply an app name."
        else:
            __main__.app = word[2]

    return xchat.EAT_ALL

def playsound_cb( word, word_eol, userdata ):
    import __main__
    if __main__.response == 1:
        args = (__main__.app + " " + __main__.filename,)
        thread.start_new_thread( os.system, args );
    return xchat.EAT_NONE


xchat.hook_command( "SOUNDRESPONSE", soundresponse_cb, help="/SOUNDRESPONSE <arg>, turn \"on\" or \"off\"." )
xchat.hook_print("Channel Msg Hilight", playsound_cb)

iNeb is offline   Reply With Quote
Old 10-11-2003, 11:06 PM   #2 (permalink)
Registered User
 
sixf00t4's Avatar
 
Join Date: Aug 2002
Location: Western PA
Posts: 2,296
sixf00t4 is on a distinguished road
Send a message via ICQ to sixf00t4 Send a message via AIM to sixf00t4 Send a message via Yahoo to sixf00t4
throw in another elif line there.

Code:
elif word[1] == "!nick":
      xchat.hook_print("Channel Msg Hilight", playsound_cb)
and change !nick to the trigger word. that should work
__________________
[url=http://joshuadhall.com]My blog[/url]
sixf00t4 is offline   Reply With Quote
Old 10-11-2003, 11:11 PM   #3 (permalink)
Banned
 
Join Date: Nov 2002
Location: Seattle, WA
Posts: 3,289
iNeb is on a distinguished road
Send a message via AIM to iNeb
Wow, old thread, already got it to work with a different script :P
iNeb is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 09:40 PM.