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.

Variable

Old posts that have not been replied to for several years.
Locked
c
cerberus_gr
Halfop
Posts: 97
Joined: Fri Feb 07, 2003 8:57 am
Location: 127.0.0.1

Variable

Post by cerberus_gr »

Sorry if this post already exists, but I don't know how I could search about it.

I have this code:

Code: Select all

bind ctcp F "*DCC*" fd:chataccept
proc fd:chataccept { nick uhost hand dest key text } {
    if {[string match "*chat*" [string tolower $text]]} {
      set idx [hand2idx $hand]
      # -- why $idx is -1 ???? How can I take the idx of this connection?

      # Here is my problem
      set fd(_$hand) 1
      # How can I set a variable which has another variable in it and how
      # can I call this?
      # putlog "${fd(_$hand)"  returns error

      set a [connect [lindex [split $uhost @] 1] [lindex [split $text] 3]]
      control $a fd:chat_control
    }
}
Thx :)
c
cerberus_gr
Halfop
Posts: 97
Joined: Fri Feb 07, 2003 8:57 am
Location: 127.0.0.1

Post by cerberus_gr »

anyone? :P
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

$idx is -1 since idx does not exist yet, $idx is an "indetificator" of a dcc/telenet connection, and since the user is not connected through dcc/telenet in you script idx will always return -1

the format var(something) is known as arrays in tcl, see more about arrays here
Elen sila lúmenn' omentielvo
c
cerberus_gr
Halfop
Posts: 97
Joined: Fri Feb 07, 2003 8:57 am
Location: 127.0.0.1

Post by cerberus_gr »

thx Papillon
It now works. :)
Locked