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 

need to add a timer into this code..

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


Joined: 23 Jun 2011
Posts: 106
Location: somewhere out there

PostPosted: Thu Jul 14, 2011 5:28 am    Post subject: need to add a timer into this code.. Reply with quote

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
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Thu Jul 21, 2011 7:13 am    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Jul 26, 2011 12:57 pm    Post subject: Reply with quote

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
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