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.

Script for changing the topic

Old posts that have not been replied to for several years.
Locked
R
Real
Voice
Posts: 24
Joined: Mon Mar 08, 2004 11:27 am

Script for changing the topic

Post by Real »

Hi, I need some help scripting a TCL script :)

It's purpose is for a private clan channel, where line-ups for wars can be made.
If anyone uses

Code: Select all

!avail myname
, it has to add myname to the topic.

In irc this is:

Code: Select all

on 1:TEXT:!avail *:#666.to:{
//set %avail %avail $2 }
So this command writes the names which are already in %avail in %avail again + the new nick (the $2)
How is this done in TCL? I'm having some problems with variables in TCL, so can you help me out here?

Now the editing of the topic. There are a lot of variables which have to be written to the topic every time you change a little thing.

Code: Select all

/availtopic { //Topic #channel %wartype vs %wenemy ][ Date: %wdate Time: %wtime ][ Avail: %avail ]
The variables are changed with !wartype, !wtime commands, but if I know how !avail works, I can make those myself too ofcourse :)

The main problem is that I can't handle variables.

I think this is all for now :)

Big thanks
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Ok, try this code:

Code: Select all

bind pub - !avail pub:avail
proc pub:avail {nick host hand chan text} {
  global avail
  set myname "[lindex $text 1]"
  if {($myname != "") && ([string match -nocase "#666.to" "$chan"])} {
    if {$avail == ""} {
      set avail "$myname"
      } else {
      append avail " $myname"
    }
  }
}
Hope it helps :P
Xpert.
R
Real
Voice
Posts: 24
Joined: Mon Mar 08, 2004 11:27 am

Post by Real »

Code: Select all

proc pub_avail {nick host hand chan text} { 
  global avail 
  set myname "[lindex $text 1]" 
  if {($myname != "") && ([string match -nocase "#666.to" "$chan"])} { 
    if {$avail == ""} { 
      set avail "$myname" 
      } else { 
      append avail " $myname" 
    }
    putserv "TOPIC #666.to :$wartype $avail"
  } 
}
So this is slightly adjusted from yours.

I have a question though :) There's the $wartype variable, but this variable has to be set with another proc, but I think if you use "set $wartype xxx" the variable will only work for 1 proc. I'm I right?

So I want the variables to remain the entire time. Is this possible?

Sorry if I haven't explained well enough :)
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

Use in the first line in your proc:

Code: Select all

global <variables>
Example:

Code: Select all

global avail wartype
:P
Xpert.
Locked