| View previous topic :: View next topic |
| Author |
Message |
gembels Voice
Joined: 07 Jul 2012 Posts: 26
|
Posted: Sun May 08, 2016 7:59 am Post subject: raw 307 return |
|
|
Hi,
the result always "$nick, please identify before transfer" and "$nick identified"
can someone explain to me what happen please ?
Thanks in advance
| Code: |
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
}
|
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun May 08, 2016 10:52 am Post subject: |
|
|
Found one typo on this line... | Code: | | if {$chkreg($nick) != "0"} ( tggamemsg1 "$nick, please identify before transfer" |
You used an open parenthesis '(' where you need an open brace '{' _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
gembels Voice
Joined: 07 Jul 2012 Posts: 26
|
Posted: Mon May 09, 2016 9:53 am Post subject: |
|
|
| thank you so much for your help SpiKe.. silly me |
|
| Back to top |
|
 |
gembels Voice
Joined: 07 Jul 2012 Posts: 26
|
Posted: Fri May 13, 2016 9:10 am Post subject: |
|
|
@SpiKe^^
i try to put
| Code: |
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)] ? |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri May 13, 2016 10:22 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
gembels Voice
Joined: 07 Jul 2012 Posts: 26
|
Posted: Sun May 15, 2016 2:31 am Post subject: |
|
|
| 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: |
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: |
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" }
}
|
|
|
| Back to top |
|
 |
|