mIRC Home    About    Download    Register    News    Help

Print Thread
help with bonus point script #267204 21/04/20 08:47 PM
Joined: May 2013
Posts: 127
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 127
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

Quote

;=====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
}


Re: help with bonus point script [Re: raycomp] #267206 22/04/20 01:28 AM
Joined: Jan 2004
Posts: 1,300
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,300
/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

Re: help with bonus point script [Re: maroon] #267207 22/04/20 09:48 AM
Joined: May 2013
Posts: 127
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 127
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

Re: help with bonus point script [Re: raycomp] #267209 22/04/20 04:28 PM
Joined: Jan 2004
Posts: 1,300
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,300
I just got through explaining how to remove items and sections. For this one,

/remini -n filename.ini #skinnerbek.Indigo

Re: help with bonus point script [Re: maroon] #267239 25/04/20 03:17 PM
Joined: May 2013
Posts: 127
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 127
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

Re: help with bonus point script [Re: raycomp] #267244 26/04/20 05:52 PM
Joined: Jan 2004
Posts: 1,300
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,300
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:
Code
$+($chan,.,$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:
Code
$+($chan,.,$iif($2,$2,$nick))

Re: help with bonus point script [Re: maroon] #267254 28/04/20 03:31 PM
Joined: May 2013
Posts: 127
R
raycomp Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: May 2013
Posts: 127
Maroon perfect. Thank you very much