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 

write a message, depending on the number of lines written

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Tue Oct 27, 2015 10:47 pm    Post subject: write a message, depending on the number of lines written Reply with quote

I want the bot to write a message, depending on the number of lines written in the channel.
You can individually configure the channels for this action?
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Oct 28, 2015 7:58 am    Post subject: Re: write a message, depending on the number of lines writte Reply with quote

juanamores wrote:
I want the bot to write a message, depending on the number of lines written in the channel.
You can individually configure the channels for this action?


How about a protection script? One that watches for 'flooding' by number of lines posted?

For example, AllProtection can be configured to just warn.
Edit that warning, and wouldn't that do what you want?
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Oct 31, 2015 10:43 am    Post subject: Re: write a message, depending on the number of lines writte Reply with quote

Is There some more specific snippet?
I need my bot radio advertising write songs that are broadcast on channel activity.
There is a time of night that the channels are not active and what I want is that if no one writes, the bot no more type advertising on that channel.
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sat Oct 31, 2015 12:12 pm    Post subject: Re: write a message, depending on the number of lines writte Reply with quote

Ah. Ok.
That's different from what I originally thought you wanted.

Using the tcl command getchanidle and a foreach loop iterating through a list of nicks currently in the channel, it shouldn't be too difficult to write a tcl script that can determine if no user has spoken in the channel for more than x minutes. I suppose you would want to do this check often, and that could be controlled by a cron bind.

As to how you would integrate this determination with your current script that is doing the announcements now - we'd have to examine that script and perhaps you would have to modify it too.

If you know some TCL, have a look here:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
and text search it for
getchanidle

Perhaps someone else will come along with another idea for you too.
What I have mentioned above is just the first thing that came to my mind.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sat Oct 31, 2015 5:16 pm    Post subject: Reply with quote

I might go about this somewhat differently.

Make a small script that will keep track of the idleness of the channel.
I would do this by simply storing the timestamp of the last post to the channel, in a global variable...
Code:

# Set the channel to monitor #
set wasidle(chan) "#sumchan"

# Set the time (in minutes) for the channel to be considered idle #
set wasidle(time) "15"

#### END OF SETTINGS ####

bind pubm - "* $wasidle(chan)" was:idle

# force this eggdrop conf setting to be disabled #
set exclusive-binds 0

# convert minutes to seconds, and save result #
set wasidle(time) [expr {$wasidle(time) * 60}]

if {![info exists wasidle(lastut)]} { set wasidle(lastut) [unixtime] }

proc was:idle {nk uh hn ch tx} {
  global wasidle
  set wasidle(lastut) [unixtime]
  return 0
}



Then, at the top of the process that does not want to continue if the channel is idle, I might add something like this...
Code:

  global wasidle
  if {[info exists wasidle(lastut)]} {
    if {([unixtime]-$wasidle(lastut)) > $wasidle(time)} { return 0 }
  }

NOTE: the exact code to add to the process, and where to add it, may differ depending on the fine points of the existing code.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Mon Nov 02, 2015 9:39 pm    Post subject: Reply with quote

SpiKe^^ It's an intelligent way to solve the problem but... is there any way to consider idle when other bots writes ?
The idea lies in to except nicks from those bots because what I want the bot to publish advertisments if nobody user (human) is writting.
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Mon Nov 02, 2015 11:17 pm    Post subject: Reply with quote

Maybe this is closer to what you were looking for.
You will need to make sure the other bots are added to this bot and have the b flag.
Code:

# Set the channel to monitor #
set wasidle(chan) "#sumchan"

# Set the time (in minutes) for the channel to be considered idle #
set wasidle(time) "15"

# Set userfile flags to be exempt from idle monitoring #
# note: set this empty to not exempt anyone #
set wasidle(exempt) "b|b"

#### END OF SETTINGS ####

bind pubm - "$wasidle(chan) *" was:idle

# force this eggdrop conf setting to be disabled #
set exclusive-binds 0

# convert minutes to seconds, and save result #
set wasidle(time) [expr {$wasidle(time) * 60}]

if {![info exists wasidle(lastut)]} { set wasidle(lastut) [unixtime] }

proc was:idle {nk uh hn ch tx} {
  global wasidle
  if {$wasidle(exempt) eq "" || ![matchattr $hn $wasidle(exempt) $ch]} {
    set wasidle(lastut) [unixtime]
  }
  return 0
}

Note: edited the above bind pubm line to now be correct.

You will still need to modify the existing script(s) as above.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.


Last edited by SpiKe^^ on Thu Nov 05, 2015 6:54 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Tue Nov 03, 2015 6:54 am    Post subject: Reply with quote

A couple of questions, my friend...

1) May I add bots that are not of my property in my bot and give them b flag bearing in mind they are not going to identify with my bot ?
My bot is in many channels where you can find other bots that are not mine.

2) Could you tell me the command to give them the b flag ?

3) How can I set multiples channels?

Thank you for your attention my friend Smile
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Thu Nov 05, 2015 8:51 pm    Post subject: Reply with quote

juanamores wrote:
1) May I add bots that are not of my property in my bot and give them b flag...
Yes, I don't think that really makes any difference.
In your case though, I think I would maybe use a custom exempt flag, that can be any upper case letter.
Example: set wasidle(exempt) "E|E"
In dcc chat with your bot, do:
.help adduser
.help chattr

juanamores wrote:
...bearing in mind they are not going to identify with my bot ?
The bot doesn't require any sort of "identify" in order for it to know a properly added user/bot in its userfile.
Users/bots are recognized any time they match one of the host masks added for that user/bot.
If the user/bot has a change of username or host, you may need to add a new host mask so the bot knows who they are.
In dcc chat with your bot, do:
.help +host

juanamores wrote:
2) Could you tell me the command to give them the b flag ?
You really need to learn some about how to properly operate eggdrop bots.
In dcc chat with your bot, do:
.help +bot
Doing: .+bot botnick :will add a bot to the userfile, with the b flag and a host mask if the new bot is on a channel with your bot.

juanamores wrote:
3) How can I set multiples channels?
The script as wrote above, is a single channel script.
Do you really have more than one channel that you need to pause ads when they go idle?
Let me know if you do, and maybe I can make it more multichannel capable.
Multichannel will make the edits in the pausing script(s) much harder for you to figure out:)
It may be best for you to post the script you are currently wanting to work with.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Nov 07, 2015 1:03 am    Post subject: Reply with quote

Thank SpiKe^^ Very Happy
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
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 -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
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