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.
-
garfwen
- Halfop
- Posts: 61
- Joined: Wed Mar 12, 2008 5:16 pm
Post
by garfwen »
Hello
I have a script that add every single person that types !reg bot adds on a list.
Code: Select all
foreach new_player $player_list {
Now i has trying to make a !remove script, but is not working:
Code: Select all
bind pub - !remove remove
proc remove {nick uhost hand chan rest} {
global reg_status player_list max_players game_status game_prize the_winner_is
set pos [lsearch -exact $player_list $nick]
if { $pos != -1 } {
set player_list [lreplace $player_list $pos 0]
putserv "NOTICE $nick :$::corinicial Removed! $::corfinal"
} else {
putserv "NOTICE $nick :$::corinicial You are not registered! $::corfinal"
}
}
Whats wrong ?!
Ty, GaRfWeN
-
tomekk
- Master
- Posts: 255
- Joined: Fri Nov 28, 2008 11:35 am
- Location: Oswiecim / Poland
-
Contact:
Post
by tomekk »
try to change:
Code: Select all
set player_list [lreplace $player_list $pos 0]
to:
Code: Select all
set player_list [lreplace $player_list $pos $pos]
:>
-
garfwen
- Halfop
- Posts: 61
- Joined: Wed Mar 12, 2008 5:16 pm
Post
by garfwen »
still not working,
bot says "Removed"
but nick stills there (on the list) :<
-
tomekk
- Master
- Posts: 255
- Joined: Fri Nov 28, 2008 11:35 am
- Location: Oswiecim / Poland
-
Contact:
Post
by tomekk »
Code: Select all
[tomekk@zonk]:/home# ./zonk.tcl
list before: nick1 nick2 nick3
command [remove "nick2"]
NOTICE nick2 :Removed!
list after: nick1 nick3
but ok, u can always use another foreach to rewrite the list without specified nick
its no problem

-
garfwen
- Halfop
- Posts: 61
- Joined: Wed Mar 12, 2008 5:16 pm
Post
by garfwen »
I forgot that it was saving nick;host .
Fixed, ty
