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.

Need this script a little more juked up :D

Old posts that have not been replied to for several years.
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Need this script a little more juked up :D

Post by stevegarbz »

Ok, well currently I have this advertising script:

Code: Select all

##### GENERAL SETTINGS ####
# EDIT the channel names or REMOVE one or two depending on which channel you intend the bot the advertise
set channel "#energex #advertise #hix #team.gr #toronto #defcon7 #csinvite"
# Edit the time cycle which is in minutes format depending on the time intervals you want the bot to flow out the advertisment
set time 45

# EDIT the text or REMOVE or ADD lines including inverted commas at the starting and ending at each line 
set text {
"MYADHERE"
}

##### DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING #####

if {[string compare [string index $time 0] "!"] == 0} { set timer [string range $time 1 end] } { set timer [expr $time * 60] }
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }

set queue {} 
set frequency 65 ;# seconds 
proc getqueue {} { 
   if {$::queue != {}} { 
      puthelp [lindex $::queue 0] 
      set ::queue [lreplace $::queue 0 0] 
   } 
   utimer $::frequency getqueue 
} 
proc putqueue {str} { 
   lappend ::queue $str 
} 
getqueue 

proc go {} {
global channel time text timer
foreach chan $channel {
foreach line $text { putqueue "PRIVMSG $chan :$line" }
}
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }
}

putlog "Loaded Advertise Script by es"
Is there a way to get it so it looks like:

Code: Select all

set text {
"MYADHERE"
"RANDOMIZE AD"
"SCRIPT CHOOSES ONE OF THESE ADS"
}
Basically, I want to be able to add lines of text like that, and have the bot randomly spit one out when it is time to message. Thanks!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

yes you can, but instead of

Code: Select all

putqueue "PRIVMSG $chan :$line"
use

Code: Select all

putqueue "PRIVMSG $chan :[lindex $line [rand [llength $line]]]"
this way it'll output a random line from the list.
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

Thanks a lot!
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

One more question; how would I get it to work on all channels the bot is in, so I don't have to define anything?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Then use

Code: Select all

foreach chan [channels] {
instead.
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

and then i don't have to define anything in the top?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Code: Select all

proc go {} { 
global time text timer 
foreach chan [channels] { 
foreach line $text { putqueue "PRIVMSG $chan :$line" } 
} 
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go } 
} 
Use that...
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

stevegarbz wrote:and then i don't have to define anything in the top?
Yes, because [channels] returns the list of all channels that are in the .chan file.
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

Tosser, that would ruin the line that I just added for making the randomized message? Ok, right now I have:

Code: Select all

##### GENERAL SETTINGS ####
# EDIT the channel names or REMOVE one or two depending on which channel you intend the bot the advertise
set channel ""
# Edit the time cycle which is in minutes format depending on the time intervals you want the bot to flow out the advertisment
set time 1

# EDIT the text or REMOVE or ADD lines including inverted commas at the starting and ending at each line 
set text {
"ad1"
"ad2"
"ad3"
}

##### DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING #####

if {[string compare [string index $time 0] "!"] == 0} { set timer [string range $time 1 end] } { set timer [expr $time * 60] }
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }

set queue {} 
set frequency 2 ;# seconds 
proc getqueue {} { 
   if {$::queue != {}} { 
      puthelp [lindex $::queue 0] 
      set ::queue [lreplace $::queue 0 0] 
   } 
   utimer $::frequency getqueue 
} 
proc putqueue {str} { 
   lappend ::queue $str 
} 
getqueue 

proc go {} { 
global time text timer 
foreach chan [channels] { 
foreach line $text { putqueue "PRIVMSG $chan :[lindex $line [rand [llength $line]]]" } 
} 
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go } 
} 

putlog "Loaded Advertise Script by es"
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Code: Select all

proc go {} { 
global time text timer 
foreach chan [channels] { 
foreach line $text { putqueue "PRIVMSG $chan :[lindex $line [rand [llength $line]]]" } 
} 
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go } 
} 
There.
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

That should make it work on all channels, and you can delete the "set channel" line.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Yep. That scripts looks alright for me.
r0t3n @ #r0t3n @ Quakenet
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Also, Sir_Fz if you did a proc with {channel} would it overwrite the $channel varible in that script.
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Tosser^^ wrote:Yep. That scripts looks alright for me.
Oh good, thanx for the info :lol:
Tosser^^ wrote:Also, Sir_Fz if you did a proc with {channel} would it overwrite the $channel varible in that script.
What do you mean?
Last edited by Sir_Fz on Tue Jul 12, 2005 12:43 pm, edited 1 time in total.
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

Eeek, it is doing:

[12:41:44] <PE> your
[12:41:46] <PE> #PE
[12:41:48] <PE> ShoutCast
[12:41:50] <PE> a
[12:41:52] <PE> -
[12:41:54] <PE> that
[12:41:56] <PE> want
[12:41:58] <PE> design,
[12:42:00] <PE> today,

I think it is my advertise lines, hold on. :o
Locked