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 

Message + timer

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Arkadietz
Halfop


Joined: 14 Jul 2006
Posts: 67
Location: cat /dev/zero > /dev/null;

PostPosted: Sat Sep 01, 2012 5:04 pm    Post subject: Message + timer Reply with quote

Okay it's simple.

1. To has a list where i can put my messages
2. To has a settable timer ( where show the messages in the channel/s )
_________________
On a unix system everything is a file ; if something is not a file , it is a proccess.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
SpiKe^^
Owner


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

PostPosted: Sat Sep 01, 2012 5:36 pm    Post subject: Reply with quote

Would that timer read one line from the file??

Maybe keep track of the last line read, and read the next line in the file?
_________________
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
Arkadietz
Halfop


Joined: 14 Jul 2006
Posts: 67
Location: cat /dev/zero > /dev/null;

PostPosted: Sat Sep 01, 2012 5:40 pm    Post subject: Reply with quote

i got some example script for this but is old.. and not work properly

http://paste.tclhelp.net/?id=bm3
_________________
On a unix system everything is a file ; if something is not a file , it is a proccess.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
SpiKe^^
Owner


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

PostPosted: Sat Sep 01, 2012 7:47 pm    Post subject: Reply with quote

Try this:

Code:

# The list of channel ads to run (set to {} to disable this script) #
set prnl(msgs) {

1st example ad.
2nd example ad.
Next ad.
Last ad.

}


# The channels to msg: #chan1 #chan2 #etc  (* = all channels) #
set prnl(chans) {*}


# The number of minutes between channel ads  (1 or more minutes) #
set prnl(minutes) 5


###### END OF SETTINGS ######


set prnl(tmls) [split [string trim $prnl(msgs)] "\n"]
set prnl(msgs) ""
foreach prnl(tmit) $prnl(tmls) {
  set prnl(tmit) [string trim $prnl(tmit)]
  if {$prnl(tmit) ne ""} {  lappend prnl(msgs) $prnl(tmit)  }
}
unset prnl(tmls) prnl(tmit)

if {$prnl(msgs) eq ""} {  return  }

if {$prnl(chans) eq "*" || $prnl(chans) eq ""} {  set prnl(chans) [channels]  }
if {![info exists prnl(next)]} {  set prnl(next) 0  }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }


proc prnl:rnext {} {  global prnl
 if {$prnl(msgs) eq ""} {  return  }

 foreach ch $prnl(chans) {
  puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
 }

 incr prnl(next)
 if {$prnl(next)>=[llength $prnl(msgs)]} {  set prnl(next) 0  }
 set prnl(timer) [timer $prnl(minutes) [list prnl:rnext]]
}


putlog "Public Read Next Line v1.1 loaded."


_________________
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
Arkadietz
Halfop


Joined: 14 Jul 2006
Posts: 67
Location: cat /dev/zero > /dev/null;

PostPosted: Sat Sep 01, 2012 7:51 pm    Post subject: Reply with quote

could you add an option to post random quotes ( where can not repeat last 5 quotes at least )
_________________
On a unix system everything is a file ; if something is not a file , it is a proccess.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
SpiKe^^
Owner


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

PostPosted: Sat Sep 01, 2012 8:11 pm    Post subject: Reply with quote

Now you have a choice of reading 'in order' or eggdrops somewhat less than 'random' Smile

Code:

# The list of channel ads to run (set to {} to disable this script) #
set prnl(msgs) {

1st example ad.
2nd example ad.
Next ad.
Last ad.

}


# The channels to msg: #chan1 #chan2 #etc  (* = all channels) #
set prnl(chans) {*}


# The number of minutes between channel ads  (1 or more minutes) #
set prnl(minutes) 5


# Read the lines in order or random  (1=inorder || 2=random) #
set prnl(order) 2


###### END OF SETTINGS ######


set prnl(tmls) [split [string trim $prnl(msgs)] "\n"]
set prnl(msgs) ""
foreach prnl(tmit) $prnl(tmls) {
  set prnl(tmit) [string trim $prnl(tmit)]
  if {$prnl(tmit) ne ""} {  lappend prnl(msgs) $prnl(tmit)  }
}
unset prnl(tmls) prnl(tmit)

if {$prnl(msgs) eq ""} {  return  }

if {$prnl(chans) eq "*" || $prnl(chans) eq ""} {  set prnl(chans) [channels]  }
if {![info exists prnl(next)]} {  set prnl(next) 0  }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }


proc prnl:rnext {} {  global prnl
 if {$prnl(msgs) eq ""} {  return  }

 if {$prnl(order)=="2"} {  set prnl(next) [rand [llength $prnl(msgs)]]  }

 foreach ch $prnl(chans) {
  puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
 }

 incr prnl(next)
 if {$prnl(next)>=[llength $prnl(msgs)]} {  set prnl(next) 0  }
 set prnl(timer) [timer $prnl(minutes) [list prnl:rnext]]
}


putlog "Public Read Next Line v1.1 loaded."


_________________
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
Arkadietz
Halfop


Joined: 14 Jul 2006
Posts: 67
Location: cat /dev/zero > /dev/null;

PostPosted: Sat Sep 01, 2012 9:35 pm    Post subject: Reply with quote

could you add a second timer:

1. minimum time before post the quote
2. maximum time before post the quote

result:
get some random time between min and max time
_________________
On a unix system everything is a file ; if something is not a file , it is a proccess.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
SpiKe^^
Owner


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

PostPosted: Sat Sep 01, 2012 10:39 pm    Post subject: Public Read Next Line v1.2 Reply with quote

This should do it.

Code:

# The list of channel ads to run (set to {} to disable this script) #
set prnl(msgs) {

1st example ad.
2nd example ad.
Next ad.
Last ad.

}


# The channels to msg: #chan1 #chan2 #etc  (* = all channels) #
set prnl(chans) {*}


# The number of minutes between channel ads  (1 or more minutes) #
set prnl(min-lo) 5


# The number of minutes between channel ads  (same or above min-lo) #
set prnl(min-hi) 10


# Read the lines in order or random  (1=inorder || 2=random) #
set prnl(order) 2


###### END OF SETTINGS ######


set prnl(tmls) [split [string trim $prnl(msgs)] "\n"]
set prnl(msgs) ""
foreach prnl(tmit) $prnl(tmls) {
  set prnl(tmit) [string trim $prnl(tmit)]
  if {$prnl(tmit) ne ""} {  lappend prnl(msgs) $prnl(tmit)  }
}
unset prnl(tmls) prnl(tmit)

if {$prnl(msgs) eq ""} {  return  }

if {$prnl(chans) eq "*" || $prnl(chans) eq ""} {  set prnl(chans) [channels]  }
if {![info exists prnl(next)]} {  set prnl(next) 0  }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }

if {$prnl(min-hi)<$prnl(min-lo)} {  set prnl(min-hi) $prnl(min-lo)  }


proc prnl:rnext {} {  global prnl
 if {$prnl(msgs) eq ""} {  return  }

 if {$prnl(order)=="2"} {  set prnl(next) [rand [llength $prnl(msgs)]]  }

 foreach ch $prnl(chans) {
  puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
 }

 incr prnl(next)
 if {$prnl(next)>=[llength $prnl(msgs)]} {  set prnl(next) 0  }

 set randmin $prnl(min-lo)
 if {$prnl(min-hi)>$prnl(min-lo)} {
   incr randmin [rand [expr {$prnl(min-hi)-$prnl(min-lo)+1}]]
 }

 set prnl(timer) [timer $randmin [list prnl:rnext]]
}


putlog "Public Read Next Line v1.2 loaded."


_________________
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
Arkadietz
Halfop


Joined: 14 Jul 2006
Posts: 67
Location: cat /dev/zero > /dev/null;

PostPosted: Sun Sep 02, 2012 1:01 am    Post subject: Reply with quote

okay, but can you keep both timers i mean to looks something like that:

1. timer to use static/dynamric
a. static - in the first post ( where always post a reply on same time )
b. dynamic - last post ( where use the values min and max )
2. possible bugs ( tested ):
no working properly if in the quotes has [,],(,),%,&,!, .
example:
Dr. Kucho! feat. Aris - Doing Better Without You (Original Mix).mp3
_________________
On a unix system everything is a file ; if something is not a file , it is a proccess.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
SpiKe^^
Owner


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

PostPosted: Sun Sep 02, 2012 2:34 am    Post subject: Reply with quote

Quote:
1. timer to use static/dynamric

To have the ads always on the same time interval, set min-lo & min-hi both to the same number of minutes.


Quote:
no working properly if in the quotes has [,],(,),%,&,!, .

The issue there is with a few tcl special characters.
We can get around that by storing all our ad lines to a plain text file, and not in the script tcl file.
Make a ad-file.txt, and put it in the scripts dir with this new script...

Code:

# set the route and file name of the channel ads file #
# make the ads file as a plain text document, 1 ad per file line #
set prnl(ad-file) "scripts/ad-file.txt"


# The channels to msg: #chan1 #chan2 #etc  (* = all channels) #
set prnl(chans) {*}


# The minimum number of minutes between channel ads  (1 or more minutes) #
set prnl(min-lo) 5


# The maximum number of minutes between channel ads  (same or above min-lo) #
set prnl(min-hi) 10


# Read the lines in order or random  (1=inorder || 2=random) #
set prnl(order) 2


###### END OF SETTINGS ######


set prnl(msgs) ""
if {![file exists $prnl(ad-file)]} {  return  }

set prnl(tm-open) [open $prnl(ad-file)]
while {![eof $prnl(tm-open)]} {
 set prnl(tm-line) [string trim [gets $prnl(tm-open)]]
 if {$prnl(tm-line) ne ""} {
   lappend prnl(msgs) $prnl(tm-line)
 }
}
close $prnl(tm-open)
unset prnl(tm-open) prnl(tm-line) prnl(ad-file)

if {$prnl(msgs) eq ""} {  return  }

if {$prnl(chans) eq "*" || $prnl(chans) eq ""} {  set prnl(chans) [channels]  }
if {![info exists prnl(next)]} {  set prnl(next) 0  }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }

if {$prnl(min-hi)<$prnl(min-lo)} {  set prnl(min-hi) $prnl(min-lo)  }


proc prnl:rnext {} {  global prnl
 if {$prnl(msgs) eq ""} {  return  }

 if {$prnl(order)=="2"} {  set prnl(next) [rand [llength $prnl(msgs)]]  }

 foreach ch $prnl(chans) {
  puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
 }

 incr prnl(next)
 if {$prnl(next)>=[llength $prnl(msgs)]} {  set prnl(next) 0  }

 set randmin $prnl(min-lo)
 if {$prnl(min-hi)>$prnl(min-lo)} {
   incr randmin [rand [expr {$prnl(min-hi)-$prnl(min-lo)+1}]]
 }

 set prnl(timer) [timer $randmin [list prnl:rnext]]
}


putlog "Public Read Next Line v1.3 loaded."


_________________
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
Arkadietz
Halfop


Joined: 14 Jul 2006
Posts: 67
Location: cat /dev/zero > /dev/null;

PostPosted: Sun Sep 02, 2012 8:28 pm    Post subject: Reply with quote

has been tested and does not work at all
_________________
On a unix system everything is a file ; if something is not a file , it is a proccess.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
SpiKe^^
Owner


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

PostPosted: Sun Sep 02, 2012 8:39 pm    Post subject: Reply with quote

Probably problems with finding the ads file.
Let's try it with some error lines added...

Code:

# set the route and file name of the channel ads file #
# make the ads file as a plain text document, 1 ad per file line #
set prnl(ad-file) "scripts/ad-file.txt"


# The channels to msg: #chan1 #chan2 #etc  (* = all channels) #
set prnl(chans) {*}


# The minimum number of minutes between channel ads  (1 or more minutes) #
set prnl(min-lo) 5


# The maximum number of minutes between channel ads  (same or above min-lo) #
set prnl(min-hi) 10


# Read the lines in order or random  (1=inorder || 2=random) #
set prnl(order) 2


###### END OF SETTINGS ######


set prnl(msgs) ""
if {![file exists $prnl(ad-file)]} {
  putlog "PRNL Error: Unable to find file: $prnl(ad-file)"
  putlog "Public Read Next Line v1.4 NOT loaded!"
  return
}

set prnl(tm-open) [open $prnl(ad-file)]
while {![eof $prnl(tm-open)]} {
 set prnl(tm-line) [string trim [gets $prnl(tm-open)]]
 if {$prnl(tm-line) ne ""} {
   lappend prnl(msgs) $prnl(tm-line)
 }
}
close $prnl(tm-open)
unset prnl(tm-open) prnl(tm-line) prnl(ad-file)

if {$prnl(msgs) eq ""} {
  putlog "PRNL Error: No text in ad file: $prnl(ad-file)"
  putlog "Public Read Next Line v1.4 NOT loaded!"
  return
}


if {$prnl(chans) eq "*" || $prnl(chans) eq ""} {  set prnl(chans) [channels]  }
if {![info exists prnl(next)]} {  set prnl(next) 0  }
if {![info exists prnl(timer)]} { set prnl(timer) [timer 2 [list prnl:rnext]] }

if {$prnl(min-hi)<$prnl(min-lo)} {  set prnl(min-hi) $prnl(min-lo)  }


proc prnl:rnext {} {  global prnl
 if {$prnl(msgs) eq ""} {  return  }

 if {$prnl(order)=="2"} {  set prnl(next) [rand [llength $prnl(msgs)]]  }

 foreach ch $prnl(chans) {
  puthelp "PRIVMSG $ch :[lindex $prnl(msgs) $prnl(next)]"
 }

 incr prnl(next)
 if {$prnl(next)>=[llength $prnl(msgs)]} {  set prnl(next) 0  }

 set randmin $prnl(min-lo)
 if {$prnl(min-hi)>$prnl(min-lo)} {
   incr randmin [rand [expr {$prnl(min-hi)-$prnl(min-lo)+1}]]
 }

 set prnl(timer) [timer $randmin [list prnl:rnext]]
}


putlog "Public Read Next Line v1.4 loaded."


_________________
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
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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