| View previous topic :: View next topic |
| Author |
Message |
monie089 Halfop
Joined: 29 Jul 2006 Posts: 76
|
Posted: Mon Aug 14, 2006 10:00 am Post subject: help with add |
|
|
| Code: |
########################################
#tested to work on windrop #
#v1.0 soon to be more updated #
#email me for comments ,hate , or help #
#monie @ XG.Monie089@gmail.com #
########################################
set wififile "wifi/wifi.txt"
set mphfile "wifi/mph.txt"
set mkdsfile "wifi/mkds.txt"
set acwwfile "wifi/acww.txt"
set thasfile "wifi/thas.txt"
set starfoxfile "wifi/starfox.txt"
if {![file exists $wififile]} {
catch {close [open $wififile w]}
}
if {![file exists $mphfile]} {
catch {close [open $mphfile w]}
}
if {![file exists $mkdsfile]} {
catch {close [open $mkdsfile w]}
}
if {![file exists $acwwfile]} {
catch {close [open $acwwfile w]}
}
if {![file exists $thasfile]} {
catch {close [open $thasfile w]}
}
if {![file exists $starfoxfile]} {
catch {close [open $starfoxfile w]}
}
bind pub -|- &wifi pub:wifi
proc pub:wifi {nickname uhost hostname arguments handle } {
putquick "PRIVMSG $nickname :Welcome to The WiFi Gaming Center"
putquick "PRIVMSG $nickname :Games Currently supported are"
putquick "PRIVMSG $nickname :MKDS MPH THAS ACWW STARFOX More coming soon"
putquick "PRIVMSG $nickname :Commands are as Following"
putquick "PRIVMSG $nickname :&list - lists the current games open"
putquick "PRIVMSG $nickname :&join <name> - Joins the game thats open"
putquick "PRIVMSG $nickname :&create <name> -creates a game"
putquick "PRIVMSG $nickname :&leave <name> - Parts you from that game"
putquick "PRIVMSG $nickname :&add - adds your code for any game"
putquick "PRIVMSG $nickname :&find - finds you or a friends code"
}
bind pub -|- &add pub:add
proc pub:add {nick uhost hostname text arg handle channel } {
global mphfile mkdsfile thasfile acwwfile starfoxfile
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="mph"&& $code !=""} {
set fd [open $::mphfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="mkds"&& $code !=""} {
set fd [open $::mkdsfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="acww"&& $code !=""} {
set fd [open $::acwwfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="thas"&& $code !=""} {
set fd [open $::thasfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="starfox"&& $code !=""} {
set fd [open $::starfoxfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
}
bind pub -|- &find pub:find
proc pub:find {nick uhost hand chan arg} {
global mphfile mkdsfile thasfile acwwfile starfoxfile
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::mphfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names mphcode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::mkdsfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names mkdscode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::thasfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names thascode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::acwwfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names acwwcode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::starfoxfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names starfoxcode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
}
bind pub -|- &create pub:create
proc pub:create { nick uhost hand chan arg } {
set table [lindex [split $arg] 0]
if {$table != ""} {
set fd [open $::wififile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == ""} {
set list [lreplace $list end end]
}
lappend list "\[$table\]"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &create game."
}
}
|
everything works but the add and how do i make the join leave and list part please help _________________ New server irc.NintendoXG.com come and visit
Last edited by monie089 on Mon Aug 14, 2006 10:20 am; edited 1 time in total |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Mon Aug 14, 2006 10:15 am Post subject: |
|
|
sigh.
also, why does it say "100% made by monnie" when half or more of this ''script'' has been made by others here. |
|
| Back to top |
|
 |
monie089 Halfop
Joined: 29 Jul 2006 Posts: 76
|
Posted: Mon Aug 14, 2006 10:19 am Post subject: |
|
|
i did this _________________ New server irc.NintendoXG.com come and visit |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Aug 14, 2006 11:04 am Post subject: |
|
|
get rid of the [close [open]] nonsense and read here how you should deal with files _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
monie089 Halfop
Joined: 29 Jul 2006 Posts: 76
|
Posted: Mon Aug 14, 2006 11:26 am Post subject: |
|
|
ok thanks
EDIT:it still says TCL [pub:add]: missing close bracket
| Code: |
bind pub -|- &add pub:add
proc pub:add {nick uhost hostname text arg handle channel } {
global mphfile mkdsfile thasfile acwwfile starfoxfile
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="mph"&& $code !=""} {
set fd [open $::mphfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="mkds"&& $code !=""} {
set fd [open $::mkdsfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="acww"&& $code !=""} {
set fd [open $::acwwfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="thas"&& $code !=""} {
set fd [open $::thasfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="starfox"&& $code !=""} {
set fd [open $::starfoxfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
}
|
thats what im having trouble with please help _________________ New server irc.NintendoXG.com come and visit |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Mon Aug 14, 2006 12:33 pm Post subject: |
|
|
| It would be helpful if you tabinate.. This is unreadable as it is. |
|
| Back to top |
|
 |
monie089 Halfop
Joined: 29 Jul 2006 Posts: 76
|
Posted: Mon Aug 14, 2006 12:40 pm Post subject: |
|
|
| rosc2112 wrote: | | It would be helpful if you tabinate.. This is unreadable as it is. |
what do you mean by tabinate _________________ New server irc.NintendoXG.com come and visit |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
|
| Back to top |
|
 |
monie089 Halfop
Joined: 29 Jul 2006 Posts: 76
|
Posted: Mon Aug 14, 2006 3:34 pm Post subject: |
|
|
i dont even see errors in my script _________________ New server irc.NintendoXG.com come and visit |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Aug 14, 2006 3:50 pm Post subject: |
|
|
<note>One should know how to debug it's own stuff.</note>
<off topic>
I've searched the dictionary and haven't found that word.
</off topic>
Anyway, he probably meant to use some sort of application to arrange your code. Something like this (and I quote):
| Code: |
bind pub -|- &add pub:add
proc pub:add {nick uhost hostname text arg handle channel} {
global mphfile mkdsfile thasfile acwwfile starfoxfile
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="mph"&& $code !=""} {
[...]
}
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
monie089 Halfop
Joined: 29 Jul 2006 Posts: 76
|
Posted: Tue Aug 15, 2006 4:22 pm Post subject: |
|
|
| Code: |
########################################
#100% made by monie #
#tested to work on windrop #
#v1.0 soon to be more updated #
#email me for comments ,hate , or help #
#monie @ XG.Monie089@gmail.com #
########################################
set wififile "wifi/wifi.txt"
set mphfile "wifi/mph.txt"
set mkdsfile "wifi/mkds.txt"
set acwwfile "wifi/acww.txt"
set thasfile "wifi/thas.txt"
set starfoxfile "wifi/starfox.txt"
bind pub -|- &wifi pub:wifi
proc pub:wifi {nickname uhost hostname arguments handle } {
putquick "PRIVMSG $nickname :Welcome to The WiFi Gaming Center"
putquick "PRIVMSG $nickname :Games Currently supported are"
putquick "PRIVMSG $nickname :MKDS MPH THAS ACWW STARFOX More coming soon"
putquick "PRIVMSG $nickname :Commands are as Following"
putquick "PRIVMSG $nickname :&list - lists the current games open"
putquick "PRIVMSG $nickname :&join <name> - Joins the game thats open"
putquick "PRIVMSG $nickname :&create <name> -creates a game"
putquick "PRIVMSG $nickname :&leave <name> - Parts you from that game"
putquick "PRIVMSG $nickname :&add - adds your code for any game"
putquick "PRIVMSG $nickname :&find - finds you or a friends code"
}
bind pub -|- &add pub:add
proc pub:add { nick uhost text channel arg } {
global mphfile mkdsfile thasfile acwwfile starfoxfile
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="mph"&& $code !=""} {
set fd [open $::mphfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""]} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="mkds"&& $code !=""} {
set fd [open $::mkdsfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""]} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="acww"&& $code !=""} {
set fd [open $::acwwfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""]} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="thas"&& $code !=""} {
set fd [open $::thasfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""]} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game !="starfox"&& $code !=""} {
set fd [open $::starfoxfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end == ""]} {
set list [lreplace $list end end]
}
lappend list "\[$nick\] $game $code"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nick :Usage: &add game code"
}
}
bind pub -|- &find pub:find
proc pub:find {nick uhost hand chan arg} {
global mphfile mkdsfile thasfile acwwfile starfoxfile
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::mphfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names mphcode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::mkdsfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names mkdscode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::thasfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names thascode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::acwwfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names acwwcode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
set name [lindex [split $arg] 0]
if {$name != ""} {
set fd [open $::starfoxfile r]
while {! [eof $fd]} {
lappend list [gets $fd]
}
close $fd
if {[set le [lsearch -glob $list "*$name*"]] != -1} {
set line [lindex $list $le]
set code [string map {"" ""} [lindex $line 2]]
putserv "NOTICE $nick :$names starfoxcode is $code"
} else {
putserv "NOTICE $nick :Name not found."
}
} else {
putserv "NOTICE $nick :Usage: &find nick"
}
}
bind pub -|- &create pub:create
proc pub:create { nick uhost hand chan arg } {
set table [lindex [split $arg] 0]
if {$table != ""} {
set fd [open $::wififile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] == ""} {
set list [lreplace $list end end]
}
lappend list "\[$table\]"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick "PRIVMSG $chan :$table was created"
} else {
putserv "PRIVMSG $nick :Usage: &create game."
}
}
bind pub - &join pub:join
proc pub:join { nick chan hand arg text} {
set join [lindex [split $arg] 0]
if {$join != ""} {
set fd [open $::wififile r+]
While {![eof $fd]} {
lappend list [gets $fd]
}
if {[lindex $list end] = ""} {
set list [lreplace $list end end]
}
lappend list "\[$join\] $nick"
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
putquick "PRIVMSG $nick :You have joined $join"
} else {
putserv "PRIVMSG $nick :Usage: &join name"
}
}
|
i found the missing brackets but now it says something bout "==" and interger _________________ New server irc.NintendoXG.com come and visit |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Aug 15, 2006 4:32 pm Post subject: |
|
|
A hint... there is something wrong with this
| Code: |
if {[lindex $list end == ""]} {
|
Actually, there's several things wrong with it...
Check the manual-page for lindex, and you'll see that argument 2 and following arguments should be list indexes ("start", "end", integers are some, == and "" are not)
Also, if you check the various operators supported in tcl (another manual-page), you'll find that == only works on numbers, not strings _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Aug 15, 2006 6:36 pm Post subject: |
|
|
| monie089 wrote: | | rosc2112 wrote: | | It would be helpful if you tabinate.. This is unreadable as it is. |
what do you mean by tabinate |
Edit your code and indent as per the example given. It makes code reading far easier. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
incith Master

Joined: 23 Apr 2005 Posts: 275 Location: Canada
|
|
| Back to top |
|
 |
|