|
Joined: May 2013
Posts: 140
Vogon poet
|
OP
Vogon poet
Joined: May 2013
Posts: 140 |
I have a bonus point script in my bot that award or remove point for good/bad behavior I need help to also delete the nick in the points.ini file When added it looks like this; (channel user and points) [#skinnerbek.Indigo] Points=295 I need help to also delete the entry for nick Indigo in the point.ini file. I have tried but no go. Feel free to use if you want ;=====Bonus Point system ====
alias -l addPoints { if ($1 !isnum) { echo 2 -st $1 must be a number. | halt } var %topic $+($chan,.,$nick) var %points $calc($readini(Docs\Point.ini,%topic,Points) + $1) writeini -n Docs\Point.ini %topic Points %points return %points }
alias -l lookUpPoints { var %topic $+($chan,.,%target) var %topic $+($chan,.,$nick) var %points $readini(Docs\Point.ini,%topic,Points) return %points }
on 1:text:!bonus:#:{ var %target $iif($2,$2,$nick) var %points $lookUpPoints msg # %target wow already %points Bonus points in $chan }
on 1:text:!bonusnick:#:{ var %target $iif($2) var %points $lookUpPoints msg # %target wow already %points Bonus points in $chan }
;==Top 10 users===================
on 1:TEXT:!bonus10:#:{ run_top10 # } alias run_top10 { window -h @. | var %i 1 while $ini(Docs\point.ini,%i) { var %n $v1 if ($+(*,$1,*) iswm %n) { aline @. $gettok($remove(%n,[,]),2,46) $readini(Docs\point.ini,%n,points) } inc %i } filter -cetuww 2 32 @. @. var %i 1 | while %i <= 10 { var %list $addtok(%list,$line(@.,%i),44) inc %i } msg $1 Top 10 bonus point users are $replace(%list,$chr(44),$+($chr(44),$chr(32))) window -c @. }
;===on part======
on 1:text:quits:#:{ if (services iswm $nick) return if (Guest* iswm $nick) return var %points $addPoints(-2) msg #skinnerbek removes 2 points to $nick $- , total points %points $- :Quiting }
;=nickchange=============
on 1:text:* now known as*:#:{ if (services iswm $nick) return if (Guest* iswm $nick) return var %points $addPoints(-5) msg #skinnerbek Bot removed 5 points from $nick $- , total points %points $+ :Nickchange halt } on 1:text:* now away *:#:{ if (services iswm $nick) return if (Guest* iswm $nick) return var %points $addPoints(-2) msg #skinnerbek Bot removed 2 points from $nick $- , total points %points $+ :Nickcgange halt }
on 1:text:* smoke *:#:{ if (services iswm $nick) return if (Guest* iswm $nick) return var %points $addPoints(-1) msg #skinnerbek Bot removed 1 points from $nick $- , total points %points $+ :Rook halt }
on 1:text:*bbl*:#:{ if (services iswm $nick) return if (Guest* iswm $nick) return var %points $addPoints(-3) msg #skinnerbek Bot removed 3 points from $nick $- , total points %points $+ :BBL halt } on 1:text:*brb*:#:{ if (services iswm $nick) return if (Guest* iswm $nick) return var %points $addPoints(-2) ;msg #skinnerbek Bot removed 2 points from $nick $- , total points %points $+ :BRB halt }
alias -l swear.words { RETURN tiet.spyker.bitch.poes.naai.piel.jags.cock.cunt.fok.fokkit.vok.vokkit } alias -l good.words { RETURN more.middag.naand.hallo.hello.hi.bye.wt.dag.alo }
ON @*:TEXT:*:#:{ if (services iswm $nick) return if (Guest* iswm $nick) return VAR %x = $strip($1-) , %i = $numtok($swear.words,46) WHILE (%i) { IF ($istok(%x,$gettok($swear.words,%i,46),32)) { var %points $addPoints(-10) ;msg #skinnerbek Bot removed 10 points from $nick $- , total points %points $+ :Badwords RETURN }
IF ($istok(%x,$gettok($good.words,%i,46),32)) { var %points $addPoints(+5) msg #skinnerbek Bot added 5 points to $nick $+ , total points %points $+ :Goodwords RETURN }
DEC %i } else var %points $addPoints(+1) msg #skinnerbek Bot awards 1 points to $nick $+ , total points %points $+ :Gesels }
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 2,127 |
/remini can delete either an item, or a whole [section] of an ini file
/writeini -n test.ini section1 item1 value /writeini -n test.ini section1 item2 value /writeini -n test.ini section2 item1 value
To remove only 1 item: /remini test.ini section1 item1
To instead remove the entire [section] then don't specify the name of an item to remove /remini test.ini section1
|
|
|
|
Joined: May 2013
Posts: 140
Vogon poet
|
OP
Vogon poet
Joined: May 2013
Posts: 140 |
thank youI have tried but do not know to code to remove this section [#skinnerbek.Indigo] = channel.nick
Will delete manually in the ini file
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 2,127 |
I just got through explaining how to remove items and sections. For this one,
/remini -n filename.ini #skinnerbek.Indigo
|
|
|
|
Joined: May 2013
Posts: 140
Vogon poet
|
OP
Vogon poet
Joined: May 2013
Posts: 140 |
Yes you have if it was that easy.
I save bonus points for every user (150 different users in ini fie) with:
alias -l addPoints { if ($1 !isnum) { echo 2 -st $1 is nie 'n nommer nie. Moet nommer wees. | halt } var %topic $+($chan,.,$nick) var %points $calc($readini(Docs\Point.ini,%topic,Points) + $1) writeini -n Docs\Point.ini %topic Points %points return %points }
Resulting in this :
[#skinnerbek.Indigo] Points=295
Where the user is Indigo for this specific user out of 150 on record
Then I need to delete the record say for user Indigo. I have tried using variation of the save alias to delete
on 1:text:!delpunt *:#:{ if ($nick isop $chan) { var %topic $+($chan.$nick) /remini -n Docs\Point.ini %topic ;remini -n Docs\Point.ini $+($chan.$nick) ;/remini -n Docs\Point.ini ($chan,.,$2) }
It is above my experise to figure it out.
That why I said the only way for me to do it is manually
Thanks anyway for the explanations
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 2,127 |
You're trying to delete it the way I showed you, with one minor exception. Your section is named channel.nick but you're using $+($chan.$nick) which is trying to access a no-such-identifier. To avoid this kind of mis-steak, go into the alt+R editor, and on the 'options' menu of that window, there's an option "identifier warning". Without that being checked, no-such-identifier resolves to be $null, but if you have a checkmark for that option, you'll instead get an error which halts the script. What you should be using there instead is having the items inside $+(*) being separated by commas, similar to one of your commented-out lines, depending on whether you want to delete the item for $2 or for $nick: If you want to delete the item for $2 but then fallback to deleting the time for that nick when $2 is not present, you can do like: $+($chan,.,$iif($2,$2,$nick))
|
|
|
|
Joined: May 2013
Posts: 140
Vogon poet
|
OP
Vogon poet
Joined: May 2013
Posts: 140 |
Maroon perfect. Thank you very much
|
|
|
|
|