egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Announce at specific time
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Thu May 08, 2008 5:05 pm    Post subject: Announce at specific time Reply with quote

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.
Back to top
View user's profile Send private message
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Thu May 08, 2008 5:56 pm    Post subject: Reply with quote

Code:
# 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
Back to top
View user's profile Send private message MSN Messenger
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Thu May 08, 2008 6:24 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Fri May 09, 2008 6:15 am    Post subject: Reply with quote

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

to get the +announce I would suggest searching for setudef in the mentioned file
_________________
Elen sila lúmenn' omentielvo
Back to top
View user's profile Send private message MSN Messenger
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Fri May 09, 2008 9:27 am    Post subject: Reply with quote

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

Code:

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
Back to top
View user's profile Send private message
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Fri May 09, 2008 9:50 am    Post subject: Reply with quote

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 Smile

True, it's not as easy as that.. you have to check out the
Quote:
channels
Returns: a list of the channels the bot has a channel record for
Module: channels
and
Quote:
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:
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
Back to top
View user's profile Send private message MSN Messenger
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Fri May 09, 2008 9:58 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Fri May 09, 2008 10:10 am    Post subject: Reply with quote

haha, my bad,.. that can offcourse be removed now and
Code:
$::do_on_time_chan
be replaced by
Code:
$ch

_________________
Elen sila lúmenn' omentielvo
Back to top
View user's profile Send private message MSN Messenger
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri May 09, 2008 10:15 am    Post subject: Reply with quote

Papillon wrote:
haha, my bad,.. that can offcourse be removed now and
Code:
$::do_on_time_chan
be replaced by
Code:
$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
.
Quote:
.chanset #yourchan +announce On channel #youchan we have lots of milk. Bring you kitties ladies. Thx. Smile

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
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Fri May 09, 2008 10:31 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri May 09, 2008 10:38 am    Post subject: Reply with quote

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.
Quote:
.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.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri May 09, 2008 11:22 am    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 09, 2008 11:34 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 09, 2008 11:41 am    Post subject: Reply with quote

Code:
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
Back to top
View user's profile Send private message
starpossen
Op


Joined: 10 Jan 2006
Posts: 139

PostPosted: Fri May 09, 2008 1:21 pm    Post subject: Reply with quote

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:

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber