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.

raw 307 return

Help for those learning Tcl or writing their own scripts.
Post Reply
g
gembels
Voice
Posts: 26
Joined: Sat Jul 07, 2012 9:31 pm

raw 307 return

Post by gembels »

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
}
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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 '{'
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
g
gembels
Voice
Posts: 26
Joined: Sat Jul 07, 2012 9:31 pm

Post by gembels »

thank you so much for your help SpiKe.. silly me
g
gembels
Voice
Posts: 26
Joined: Sat Jul 07, 2012 9:31 pm

Post by gembels »

@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)] ?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
g
gembels
Voice
Posts: 26
Joined: Sat Jul 07, 2012 9:31 pm

Post by gembels »

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" } 

}


Post Reply