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.
Help for those learning Tcl or writing their own scripts.
gembels
Voice
Posts: 26 Joined: Sat Jul 07, 2012 9:31 pm
Post
by gembels » Sun May 08, 2016 7:59 am
Hi,
the result always "$nick, please identify before transfer" and "$nick identified"
can someone explain to me what happen please ?
Thanks in advance
Code: Select all
set tgchan1 "#jakarta"
set tgcmdrankx1 "!trf*"
set tgflagsrankx1 "m|m"
bind pubm $tgflagsrankx1 "$tgchan1 %$tgcmdrankx1" bankd
bind raw -|- "307" whoisbalas
proc whoisbalas {from key text} {
global chkreg botnick
set nick [lindex $text 1]
if {$nick == $botnick} { return 0 }
putlog "NICK $nick IS IDENTIFY..!"
if {[info exists chkreg($nick)]} {
set chkreg($nick) "0"
}
}
proc whoisdia {text} {
putserv "WHOIS $text $text"
}
proc bankd {nick host hand chan text} {
global chkreg
whoisdia $nick
privmsg $chan "Debug: $chkreg($nick)"
if {$chkreg($nick) != "0"} ( tggamemsg1 "$nick, please identify before transfer"
unset chkreg($nick)
return } else { tggamemsg1 "$nick identified" }
return 0
}
SpiKe^^
Owner
Posts: 831 Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:
Post
by SpiKe^^ » Sun May 08, 2016 10:52 am
Found one typo on this line...
Code: Select all
if {$chkreg($nick) != "0"} ( tggamemsg1 "$nick, please identify before transfer"
You used an open parenthesis '(' where you need an open brace '{'
gembels
Voice
Posts: 26 Joined: Sat Jul 07, 2012 9:31 pm
Post
by gembels » Mon May 09, 2016 9:53 am
thank you so much for your help SpiKe.. silly me
gembels
Voice
Posts: 26 Joined: Sat Jul 07, 2012 9:31 pm
Post
by gembels » Fri May 13, 2016 9:10 am
@SpiKe^^
i try to put
Code: Select all
if {![info exists chkreg($nick)]} {
set chkreg($nick) "1"
}
its always saying "please identify before transfer" at the first then if they try second time it work.. you have any idea why ?
I think its because "whoisdia $nick" didn't response earlier than [info exists chkreg($nick)] ?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Fri May 13, 2016 10:22 am
Yes, to "fix" this you could add a timer to allow the 307 get triggered first.
Once the game is over, the king and the pawn go back in the same box.
gembels
Voice
Posts: 26 Joined: Sat Jul 07, 2012 9:31 pm
Post
by gembels » Sun May 15, 2016 2:31 am
caesar wrote: Yes, to "fix" this you could add a timer to allow the 307 get triggered first.
how do you do that ? on tcl there is no "goto" command.. do I need use while or separate the proc to calling after that.. which one is the best practise between of this 2 below ?
1. .....
Code: Select all
set tgchan1 "#jakarta"
set tgcmdrankx1 "!trf*"
set tgflagsrankx1 "m|m"
bind pubm $tgflagsrankx1 "$tgchan1 %$tgcmdrankx1" bankd
bind raw -|- "307" whoisbalas
proc whoisbalas {from key text} {
global chkreg botnick chan
set nick [lindex $text 1]
if {$nick == $botnick} { return 0 }
putlog "NICK $nick IS IDENTIFY..!"
if {[info exists chkreg($nick)]} {
set chkreg($nick) "0"
}
response nick chan
}
proc whoisdia {text} {
putserv "WHOIS $text $text"
}
proc bankd {nick host hand chan text} {
whoisdia $nick $chan
}
proc response {nick arg} {
global chkreg
privmsg $arg "Debug: $chkreg($nick)"
if {$chkreg($nick) != "0"} ( tggamemsg1 "$nick, please identify before transfer"
unset chkreg($nick)
return } else { tggamemsg1 "$nick identified" }
return 0
}
or
2. .....
Code: Select all
set tgchan1 "#jakarta"
set tgcmdrankx1 "!trf*"
set tgflagsrankx1 "m|m"
bind pubm $tgflagsrankx1 "$tgchan1 %$tgcmdrankx1" bankd
bind raw -|- "307" whoisbalas
proc whoisbalas {from key text} {
global chkreg botnick chan
set nick [lindex $text 1]
if {$nick == $botnick} { return 0 }
putlog "NICK $nick IS IDENTIFY..!"
if {[info exists chkreg($nick)]} {
set chkreg($nick) "0"
}
}
proc whoisdia {text} {
putserv "WHOIS $text $text"
}
proc bankd {nick host hand chan text} {
global chkreg
whoisdia $nick
privmsg $arg "Debug: $chkreg($nick)"
utimer 5 [checked $nick]
}
proc checked {arg} {
global chkreg
if {$chkreg($arg) != "0"} ( tggamemsg1 "$arg, please identify before transfer"
unset chkreg($arg)
return } else { tggamemsg1 "$arg identified" }
}