This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Announce at specific time

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Announce at specific time

Post by starpossen »

I have searched the tcl archive, and didn't really found what I needed.

What I want is, a script that will announce any given text I input, at a specific time, like announce an update which occours twice a day, first one at 00:00AM and second one at 12:00PM
The bot would then announce to the channel:

<bot> stuff has been updated, check it out at site.com

I dont want any public commands at all, if any commands at all, it should all be done via. partyline by me the botowner.

If this is too much to ask, and if this already exists, then I appologise for this topic.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

# the chan to announce to
set do_on_time_chan "#chan"

bind time - "00 00 *" do_on_time
bind time - "00 12 *" do_on_time

proc do_on_time {args} {
	putserv "PRIVMSG $::do_on_time_chan :stuff has been updated, check it out at site.com"
}
something like this?
Elen sila lúmenn' omentielvo
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Looks like something I could use, but it looks really simple, maybe I really should read some more in the docs hehe, but thanks, so I can just add this, and it will announce whatever I put in the text?

*EDIT* would it be possible to make a .chanset #channel +announce kinda thing?
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

I would suggest you take a look in the tcl-command.doc file yes.. really helpful ;)

to get the +announce I would suggest searching for setudef in the mentioned file
Elen sila lúmenn' omentielvo
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Okay, please don't laugh to much now, but would this be somewhat close to my sollution:

Code: Select all

setudef flag announce

# the chan to announce to
set do_on_time_chan "#chan"

bind time - "00 00 *" do_on_time
bind time - "00 12 *" do_on_time

proc do_on_time {args} {
   putserv "PRIVMSG $::do_on_time_chan :stuff has been updated, check it out at site.com"
}
I've read up on the udef section, and added setudef flag announce but i'm sure that was too easy, and that I need to do something else, although it did give me an output that that flag was set after I did .chanset #channel +announce
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Why should I laugh? Everyone got to learn it sometime, and one of the best ways to do it is by asking, no shame in that :)

True, it's not as easy as that.. you have to check out the
channels
Returns: a list of the channels the bot has a channel record for
Module: channels
and
channel get <name> <setting>
Returns: The value of the setting you specify. For flags, a value of 0
means it is disabled (-), and non-zero means enabled (+).
Module: channels

along with the foreach command.. end-result should look something like this:

Code: Select all

setudef flag announce

# the chan to announce to
set do_on_time_chan "#chan"

bind time - "00 00 *" do_on_time
bind time - "00 12 *" do_on_time

proc do_on_time {args} {
  foreach ch [channels] {
	if {[channel get $ch announce]} {
		putserv "PRIVMSG $::do_on_time_chan :stuff has been updated, check it out at site.com"
	}
  }
} 
Elen sila lúmenn' omentielvo
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

But I was wondering, now that the userdef has been made, what about the static channel added in the script?
Could that part be removed, or should it be made to a different code?
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

haha, my bad,.. that can offcourse be removed now and

Code: Select all

$::do_on_time_chan
be replaced by

Code: Select all

$ch
Elen sila lúmenn' omentielvo
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Papillon wrote:haha, my bad,.. that can offcourse be removed now and

Code: Select all

$::do_on_time_chan
be replaced by

Code: Select all

$ch
since when does a time binding pass along channel information?
The way to accomplish it would be to use a custom flag with extended information. That way the message you put will be added during the .chanset
.
.chanset #yourchan +announce On channel #youchan we have lots of milk. Bring you kitties ladies. Thx. :)
Just like I have would be how you would enter your line, understand?
In this way, that static line containing channels is hereby irrelevant, and the chanset controls the universe... :wink:

edit: and actually, now that I really ponder about such a universe controlling announcer... I believe one might already exist in the archive, and rather than reinvent another wheel (the one made here might not be as round), it might be a smoother ride to just use the wheel already in existence... Just a thought
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Im a bit confused now, so I can actually make a custom output for each channel in the .chanset or am I totally lost here? cause my future plan is to have the bot sit on several channels, but with custom output for each channel.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

starpossen wrote:Im a bit confused now, so I can actually make a custom output for each channel in the .chanset or am I totally lost here? cause my future plan is to have the bot sit on several channels, but with custom output for each channel.
This _is_ BurgerKing..Indeed, you can have it your way. Which is exactly how I explained it above. During the .chanset is when you will set +announce and your message.

The script will use a timer, and that timer will sort thru every channel. If any are found to be +announce the script will grab the extended information and display it during that timered event. The display will be puthelp'd to avoid users from having this occur in so many channels the ircd dismisses their bot from the network for causing excess flood. This would be easy to accomplish and If no one else has ideas, I could have something up after 9-10 hours (I have work in 15 mins for 8 hours so can't delve into scripting yet mind you.. muahaha).. I'm sure as well someone else can script something according to the notes I've given.
.chanset #mychan +announce Robots are everywhere!!
.chanset #yourchan +announce There are no robots!!

**meanwhile 15 mins later**
*a timered event occurs in both channels*
<bot:#mychan> Robots are everywhere!!
<bot:#yourchan> There are no robots!!
This is more than likely what you had in mind.

Would def need a way to .backup announce and .load announce so bot crashes and such would not destroy any potential settings. This also is a trivial matter easily added.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Maybe time to clear up the mess? :p

Script by Papillon works as long as you make the change he posted. You enable it on a specific channel using .chanset #thechannel +announce. The message is hardcoded in the proc.

Speechles has a few nice suggestions, but have yet to post actual code.

Oh, and Speechles; time bindings would never supply a channel-name, but then again, the source of ch isn't from the proc arguments, but from a foreach-loop on the output of [channels] in this case...
NML_375
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

speechles wrote:Would def need a way to .backup announce and .load announce so bot crashes and such would not destroy any potential settings. This also is a trivial matter easily added.
Trivial indeed, they made chansave for just such a thing.
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Code: Select all

setudef flag announce
setudef str announce.msg

bind time - "00 00 *" do_on_time
bind time - "00 12 *" do_on_time

proc do_on_time {args} {
  foreach ch [channels] {
   if {[channel get $ch announce]} {
      putserv "PRIVMSG $ch :[channel get $ch announce.msg]"
   }
  }
} 
Usage:
.chanset #channel +announce
.chanset #channel announce.msg This is the message
.chansave
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Tnaks for all the replys, I think I got a better understanding of how things works now, I just got a tiny favor to ask, if I wanted to add minutes, would I just have to change it like

Code: Select all

bind time - "00 00 01*" do_on_time
bind time - "00 12 01*" do_on_time
Reason being that my bot is a bit ahead of time, and then I wanted it to wait till one minute past the hour in the script, as I showed in the code.
Post Reply