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 

msg
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Tue Jan 24, 2006 1:01 pm    Post subject: msg Reply with quote

Code:
set idx -1
set chans {#chan #chan2}
set msgs {"msg chan 1" msg chan 2"}
bind time - * fouu
proc fouu {m args} {
   if {$m!="08" && $m!="09" && $m%20==0} {
      foreach c $::chans {
         puthelp "privmsg $c :[lindex $::msgs [incr ::idx]]"
      }
   }
}



code by daemon

my question is the tcl say msg chan1 and chan 2 after reboot. it oK. Is possible to say msg all them 20 mns?

thx
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jan 24, 2006 5:46 pm    Post subject: Reply with quote

I'm not sure if I understood you correctly, but do you mean you want it to work every 20 minutes? if so then just remove
Code:
$m!="08" && $m!="09" &&

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Tue Jan 24, 2006 6:11 pm    Post subject: Reply with quote

yes 20 mns say msg 20mns after etc etc. =]

Quote:
$m!="08" && $m!="09" && *remove*


Tcl error [fouu]: can't use invalid octal number as operand of "%"


Code:
proc fouu {m args} {
   if {$m%20==0} {
      foreach c $::chans {
         puthelp "privmsg $c :[lindex $::msgs [incr ::idx]]"


Thx sir_Fz
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jan 24, 2006 6:57 pm    Post subject: Reply with quote

I've seen this error before but didn't figure out why exactly it occurs (maybe a bug in Tcl), I think it occurs (sometimes) only when m is "0?" so try:
Code:
if {[string trimleft $m 0]%20 == 0} {

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Tue Jan 24, 2006 8:04 pm    Post subject: Reply with quote

[01:00] Tcl error [fouu]: can't use empty string as operand of "%"

Sad always
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jan 24, 2006 8:43 pm    Post subject: Reply with quote

Not always, but every hour (when $m is 00). Use this:
Code:
if {[regexp {00|20|40} $m]} {

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Tue Jan 24, 2006 11:49 pm    Post subject: Reply with quote

Sir_Fz wrote:
I've seen this error before but didn't figure out why exactly it occurs (maybe a bug in Tcl)


no, it's not a bug

a number starting with 0 is considered octal (base eight) in Tcl, as in many other languages (most important being of course C/C++); so you don't have 8 in the octal system, eight becomes 10

so 08 or 09, passed as argument to [bind time] handler isn't valid number and can't be part of numerical expression, hence that error
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Wed Jan 25, 2006 6:10 am    Post subject: Reply with quote

hi

not error detected but that does not go.
the bot one said the sentence right once but it repeat not


thank you very much of your assistance
Back to top
View user's profile Send private message
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Wed Jan 25, 2006 7:02 pm    Post subject: Reply with quote

No solution? Sad
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Jan 25, 2006 7:24 pm    Post subject: Reply with quote

The solution I gave you works just fine. It will msg every 20 minutes (for example at 4:00 4:20 4:40 5:00 5:20...etc)
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Wed Jan 25, 2006 8:04 pm    Post subject: Reply with quote

Code:
if {[regexp {4:20|4:40|5:00} $m]} {



etc etc?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Jan 25, 2006 8:10 pm    Post subject: Reply with quote

No
Code:
if {[regexp {00|20|40} $m]} {

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Wed Jan 25, 2006 9:40 pm    Post subject: Reply with quote

the procedure is not good the bot say only 1. no repat msg Sad
Back to top
View user's profile Send private message
pilouuu
Halfop


Joined: 26 Dec 2005
Posts: 82

PostPosted: Thu Jan 26, 2006 9:49 am    Post subject: Reply with quote

it east can be possible with a timer?
expl:

Code:
bind time - "20 * * * *" drtime
proc drtime { min hour day month year } {


thx
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Jan 26, 2006 9:59 am    Post subject: Reply with quote

Code:
set idx -1
set chans {#chan #chan2}
set msgs {"msg chan 1" msg chan 2"}
bind time - * fouu
proc fouu {m args} {
   if {[regexp {00|20|40} $m]} {
      foreach c $::chans {
         puthelp "privmsg $c :[lindex $::msgs [incr ::idx]]"
      }
   }
}

works perfectly.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
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 -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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