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.

add line :-o

Old posts that have not been replied to for several years.
Locked
a
agoni

Post by agoni »

hi! everyone

i would like to store X nick on a file for a game tcl.

players use !play to enter the game, and when the X number of players is ok the game start.

i would like that the bot write a list of players like this

player1
player2
player3
etc...

I tried this but that don't work :-/ the bot don't add line so on the file, there is only the last one who type !play

proc pub_players {nick uhost hand chan arg} {
global players_file
set f [open $players_file w]
foreach line $nick {
puts $f $line
close $f
}
}

so how to ask the bot to put each player on different lines ?
thanx for help ! and sorry for my english :-/


User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

It sounds like you want to append to the file. So first of all, open the file in mode "a" instead of "w" (w overwrites it). Then, get rid of your foreach loop, because $nick is only one thing, not a list. So just puts $f $nick, not a loop for it.
a
agoni

Post by agoni »

thanx stdragon :smile: work great

Just another litle question :wink:

if a player type 2 times !play the bot save 2 times his nick :-/ how to ask bot to never add a nick who is already on the file ?

<font size=-1>[ This Message was edited by: agoni on 2001-10-05 01:28 ]</font>
Locked