Script for timed messages

Discussion about Perl, TCL or Python scripts and C/C++ plugins (using and writing them).

Script for timed mes

Postby Morgoth » 01 Jul 2004 15:14

I am looking for a script to post timed messages in a specific channel. I don't know if there is one already made in perl, I have done a google search and I cannot find one.

The script should be simple, and except a command like /timermsg <time(s)> <channel> <msg> and it will send a message in the channel, when the timer hits that time stated.

Does anyone have a script like this?

Thank you.
Morgoth
Morgoth
 
Posts: 9
Joined: 01 Jul 2004 15:06

Re: Script for timed

Postby Mike » 01 Jul 2004 18:56

Morgoth wrote:I am looking for a script to post timed messages in a specific channel. I don't know if there is one already made in perl, I have done a google search and I cannot find one.

The script should be simple, and except a command like /timermsg <time(s)> <channel> <msg> and it will send a message in the channel, when the timer hits that time stated.

Does anyone have a script like this?

Thank you.


Why not use the built in timer command?
Image
Mike
 
Posts: 374
Joined: 10 Jun 2004 19:05

Postby MrScout » 01 Jul 2004 20:42

I have a script that does something very similar to that (That I wrote in python.. sorry!)

here ya go:

Code: Select all
__module_name__ = "Scrimmage Advertising"
__module_version__ = "1.0"
__module_description__ = "Scrimmage Advertising"

import xchat

xchat.prnt(" MrScout's Scrim Finder Loaded! ")

def findscrim_cb(word, word_eol, userdata):
   global scrimtimer
   args={}
   args["num"]="5v5"
   args["league"]="OGL CAL-O CAL-IM"
   args["map"]="de_dust2"
   args["time"]="26"
   args["server"]="Ours"
   args["zone"]="Central"
   args["chan"]=xchat.get_info("channel")
   for w in word:
      if w[0] == 'n':
         args["num"]=w[2:]
         continue
      if w[0] == 'l':
         args["league"]=w[2:]
         continue
      if w[0] == 'm':
         args["map"]=w[2:]
         continue
      if w[0] == 's':
         args["server"]=w[2:]
         continue
      if w[0] == 't':
         args["time"]=w[2:]
         continue
      if w[0] == 'z':
         args["zone"]=w[2:]
         continue
   if scrimtimer is not None:
      xchat.prnt(" Changing Scrim Advertisement ")
      xchat.unhook(scrimtimer)
      scrimtimer=None
   else:
      printscrim(args)
   time=args["time"]
   time=(int(time)+2)*1000
   scrimtimer=xchat.hook_timer(time, printscrim, args)
   return xchat.EAT_PLUGIN

def stopscrim_cb(word, word_eol, userdata):
   global scrimtimer
   if scrimtimer is not None:
      print " Scrim Advertisement stopped."
      xchat.unhook(scrimtimer)
      scrimtimer=None
   return xchat.EAT_PLUGIN

def printscrim(args):
   sep=" || "

   str=" ----- "+args["num"]+sep+args["league"]+sep+args["map"]+sep+args["server"]+" "+args["zone"]+" ------==>"
   context=xchat.get_context()
   xchat.prnt(" Advertising for Scrim ")
   xchat.command("msg " +args["chan"] + str)
   return 1


xchat.hook_command("findscrim", findscrim_cb, help="/findscrim [n=5v5] [l=OGL Cal-o Cal-im] [m=de_dust2] [s=Ours] [t=21]")
xchat.hook_command("stopscrim", stopscrim_cb, help="/stopscrim stops looking for a scrim")

scrimtimer=None


The relevant part is this:
scrimtimer=xchat.hook_timer(time, printscrim, args)

Scout
All polynomials are funny; some to a higher degree. Furthermore, all polynomials of degree zero are constantly funny.

Python Plugins by Request: PM me or find me at #kwikdeath on Gamesurge
MrScout
 
Posts: 76
Joined: 28 Jun 2004 06:01
Location: Angelo State University

Re: Script for timed

Postby Morgoth » 04 Jul 2004 14:38

Mike wrote:Why not use the built in timer command?


I use x-chat 1.8.11 (customized) and I don't think there is a build in timer. I thought there was, but I couldn't find it.
Morgoth
Morgoth
 
Posts: 9
Joined: 01 Jul 2004 15:06


Return to Scripts and Plugins

Who is online

Users browsing this forum: No registered users and 1 guest

cron