egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deleting a specific thing in an output file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Mas
Voice


Joined: 04 Feb 2016
Posts: 2

PostPosted: Thu Feb 04, 2016 5:16 pm    Post subject: Deleting a specific thing in an output file Reply with quote

Hello ... I have a score file in which there are two things when its output it seems like this
teamname,points
example
Gladiators,5000 Titanic,3000 Clusters,2000
at months end it reset whole file and i just want to delete the scores and reset it to 0 as below
Gladiators,0 Titanic,0 Clusters,0

#MANUALLY reset current Team Member scores & Team Scores for month MANUALLY
proc tgresetscores {nick host hand text} {
global tgteambyname tgteamscore tgscoresbyname tgteamscoretotal
global tgtscf tgteamscore
if {($tgresetreqpw==1 && [passwdok $hand $text]) || $tgresetreqpw==0} {
if {[file exists member.scores]&&[file size member.scores]>2} {
set _sfile [open member.scores w]
puts $_sfile ""
close $_sfile
set tgteamscore ""
set tgteamscoretotal 0
}
#THIS IS THE 2ND PART WHICH IS RESETTING WHOLE FILE WE JUST NEED TO DELETE THE SCORE NOT THE TEAM

if {[file exists $tgtscf]&&[file size $tgtscf]>2} {
set _sfile [open $tgtscf w]
puts $_sfile ""
close $_sfile
set tgteamscore ""
set tgteamscoretotal 0
}
tggamemsg "[tgcolrset]===== Score table & Stats reset by $nick! ====="
}
}
[/code]


Last edited by Mas on Thu Mar 03, 2016 5:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 505
Location: Tennessee, USA

PostPosted: Tue Feb 16, 2016 9:36 pm    Post subject: Reply with quote

Code:

proc tgresetscores {nick host hand text} {
  global tgteambyname tgteamscore tgscoresbyname tgteamscoretotal
  global tgtscf tgteamscore

  if {($tgresetreqpw==1 && [passwdok $hand $text]) || $tgresetreqpw==0} {


    if {[file exists member.scores]&&[file size member.scores]>2} {
      set _sfile [open member.scores w]
      puts $_sfile ""
      close $_sfile

### remove 2 lines here ###

    } 
 #THIS IS THE 2ND PART WHICH WE JUST NEED TO DELETE THE SCORE NOT THE TEAM

    set tlist [array names tgteamscore]
    foreach team $tlist {
      set tgteamscore($team) 0
    }
    tgsavescores
    set tgteamscoretotal [llength $tlist]


    tggamemsg "[tgcolrset]===== Score table & Stats reset by $nick! ====="
  }
}


_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
Back to top
View user's profile Send private message Visit poster's website
Mas
Voice


Joined: 04 Feb 2016
Posts: 2

PostPosted: Tue Feb 16, 2016 9:50 pm    Post subject: Thank you very mich Spike^^ Reply with quote

Thank you very much Spike^^ bro you are a life saver really your code worked like a charm ... thanks once again....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber