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.

!stats responce in chan

Help for those learning Tcl or writing their own scripts.
Post Reply
s
speedy
Voice
Posts: 3
Joined: Tue Feb 27, 2007 11:01 am

!stats responce in chan

Post by speedy »

i need some help about the pub command !stats & log in a #chan

plz help me to solve the problem that my egg will responce on those triggers

### start script

bind pub - !logs logs_msg
proc logs_msg { nick uhost hand chan args } {
putserv "NOTICE $nick :Channel Logs can be read
http://myurl.com/~leader/logs/$chan"
return 0

}


bind pub - !stats stats_msg
proc stats_msg {nick uhost hand chan args } {
putserv "NOTICE $nick :Channel can be found on
http://myurl.com:8033l/$chan"
return 0

}

#### en script
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

First off, it would be prefferable if you put your tcl-code inside a code-block.

Secondly, it would be helpful if you could provide some information on the actual malfunction of your script; ie. error-message, unexpected response, or such.

A few obvious issues however:
  1. Don't use "args" as a variable in a proc declaration unless you are fully aware of it's special characteristics. It does not behave as any other variable. Speciffically, it can accept an arbitrary number of arguments while any other variable-name may only take one.
  2. You cannont have newlines in strings you send to the irc-server.
  3. In this case, you would most likely be better off using "puthelp" rather than "putserv". Only use "putserv" for important things such as kicking/banning, opping, registering with Nickserv (if available)
NML_375
User avatar
et109
Voice
Posts: 7
Joined: Sun Feb 25, 2007 9:47 am
Location: Pennsylavnia

!stats !logs problem

Post by et109 »

this works okay here

Code: Select all

   bind pub - !logs logs_msg
   bind pub - !stats stats_msg

   proc logs_msg { nick uhost hand chan text } {
       puthelp "NOTICE $nick :Channel Logs can be read at"
       puthelp "NOTICE $nick :http://myurl.com/~leader/logs/$chan"
     return 0
  }

   proc stats_msg {nick uhost hand chan text } {
      puthelp "NOTICE $nick :Channel stats can be found on"
      puthelp "NOTICE $nick :http://myurl.com:8033l/$chan"
      return 0
  }
The pub event handler takes <nick>< u@host> < handle> < channel> < text> as its arguments
s
speedy
Voice
Posts: 3
Joined: Tue Feb 27, 2007 11:01 am

Post by speedy »

if it pisible he says channel in place of #channels without the # ?
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

puthelp "NOTICE $nick :http://myurl.com:8033l/[join [split $chan #]]"
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Code: Select all

puthelp "NOTICE $nick :http://myurl.com:8033l/[string trimleft $chan "#"]"
I don't really see the point of turning a string into a list and then back to a string again :roll:

edit:

Code: Select all

% set chan #moo
#moo
% string trimleft $chan #
moo
% join [split $chan #]
 moo
Another good reason why rosc's solution wouldn't work very well
Post Reply