| View previous topic :: View next topic |
| Author |
Message |
heartbroken Op

Joined: 23 Jun 2011 Posts: 106 Location: somewhere out there
|
Posted: Thu Jul 14, 2011 5:28 am Post subject: need to add a timer into this code.. |
|
|
hi
i have a code .this code post trigger in channel with a trigger.reads subject in a .txt file which i've edited. but i want that bot post trigger line by line with timing .
i type !trigger bot will begin to post line-1 and two minutes later bot'll post line-2 -2 minutes later post line-3 ...
so how i can add timing into this code ? thnx.
| Code: | if { [llength $arg] < 2 } {
if { [isop $nick $chan] || [ishalfop $nick $chan] ||[isvoice $nick $chan] } {
set way "PRIVMSG $chan :\001ACTION"
set notice 0
} else {
set way "NOTICE $nick :$nick:"
set notice 1
}
} else {
if { [onchan [lindex $arg 1] $chan] && ( [isop $nick $chan] || [ishalfop $nick $chan] || [isvoice $nick $chan] ) } {
if { [lindex $arg 2]=="c" } {
set way "PRIVMSG $chan :\001ACTION [lindex $arg 1]"
set notice 3
} elseif { [lindex $arg 2]=="p" } {
set way "PRIVMSG [lindex $arg 1] :"
set notice 2
} else {
set way "NOTICE [lindex $arg 1] :$nick:"
set notice 1
}
} else {
return 0
}
} |
_________________ Life iS Just a dReaM oN tHE wAy to DeaTh |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Thu Jul 21, 2011 7:13 am Post subject: |
|
|
The code you posted doesn't include the output statements, so it is difficult to reply with specifics. However, I can offer an example of how you could output timed statements.
Before I do, I am doubtful about your attempt to assign the output method to the variable 'way'.
| Code: |
set way "PRIVMSG $chan :\001ACTION [lindex $arg 1]"
|
Evaluation of the above code (as the text is assigned to the variable), will cause substitution of the backslash. Essentially it will be lost. To retain a backslash you will need to double it as follows :-
| Code: |
set way "PRIVMSG $chan :\\001ACTION [lindex $arg 1]"
|
As an example of timed output, say if the text lines are in the form of a list 'textlist', you could use something akin to the following :-
| Code: |
set count 1
foreach line $textlist {
timer $count [list putserv "PRIVMSG $chan :$line"]
incr count 2
}
|
The first output occurs after 1 minute. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jul 26, 2011 12:57 pm Post subject: |
|
|
The single escape is most likely intentional to create the "Ctrl+A" character used for CTCP commands, in this case the Action (or /me) command. I don't see any cause for changing that piece of the code. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|