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.

Global variables?

Old posts that have not been replied to for several years.
Locked
m
micky
Voice
Posts: 11
Joined: Mon Dec 13, 2004 10:07 am

Global variables?

Post by micky »

Code: Select all

bind pub !test test
bind msgm - back

proc back {n u h a} {
 if {$nick != "askBOT"} {return 0}
 set arg1 [lindex $a 0]
 set arg2 [lrange $a 1 end]
   puthelp "PRIVMSG #my_channel :$arg1 $arg2"
 } 


proc test {n uh h c a} {
set arg1 [lindex $a 0]
puthelp "PRIVMSG $askBOT :$arg1"
}
And i need to procedure 'back' write: "Nick_user_who_last_use_!test : $arg1 $arg2"
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Try something simple as this:

Code: Select all

bind pub !test test
bind msgm - back

proc test {n uh h c a} {
 global test_nick
 set arg1 [lindex $a 0]; set test_nick $n
 puthelp "PRIVMSG askBOT :$arg1"
 return 0
}

proc back {n u h a} {
 global test_nick
 if {![string equal -nocase "askBOT" $n]} { return 0 }
 set arg1 [lindex $a 0]
 set arg2 [lrange $a 1 end]
 puthelp "PRIVMSG #my_channel :$test_nick: $arg1 $arg2"
 unset test_nick; return 0
}
Last edited by awyeah on Mon Dec 20, 2004 8:08 am, edited 2 times in total.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Where's the mask in your msgm bind? Is askBOT's reply always a valid tcl list?
Have you ever read "The Manual"?
m
micky
Voice
Posts: 11
Joined: Mon Dec 13, 2004 10:07 am

Post by micky »

awyeah:

Code: Select all

Tcl error [back]: can't read "test_nick": no such variable
:/

user:
1. bind msgm - * back
2. Bot always replay: $arg1[1]: http://link.com/FYTD

[1] my arg1 from procedure test

Walked it about it? ;]
Sorry, for my monkey language :>
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Oops, I didn't take a look at your actual binds and forgot to modify them. Here use these:

Code: Select all

bind pub - !test test
bind msgm - * back 

proc test {n u h c t} {
 global test_nick
 set test_nick $n
 puthelp "PRIVMSG askBOT :[lindex $t 0]"
}

proc back {n u h t} {
 global test_nick
 if {![string equal -nocase "askBOT" $n] || ![info exists test_nick]} { return 0 }
 puthelp "PRIVMSG #my_channel :$test_nick: [lindex $t 0] [lrange $t 1 end]"
 unset test_nick
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked