So i have this point system which lists points per user per channel and increases the points for every 5 mins the user is in chat.
That works fine and all but doesnt benefit the people who are actually active in chat.
What i want to add is a function that adds a point for every 5th chat message, so that active people gain more.
The last method is what i have been trying around with but no matter how i made it i always got "test2" as output. Could you help me please?
Edit: Done!
;---------------------------------
;Punktesystem test
;---------------------------------
alias -l addPoints {
if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt }
var %topic $+($chan,.,$nick)
var %points $calc($readini(Points.ini,%topic,Points) + $1)
writeini -n Points.ini %topic Points %points
return %points
}
alias -l lookUpPoints {
var %topic $+($chan,.,$nick)
var %points $readini(Points.ini,%topic,Points)
return %points
}
alias doaddpoints {
if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
var %topic $+($1,.,$2)
var %points $calc($readini(Points.ini,%topic,Points) + $3)
writeini -n Points.ini %topic Points %points
echo -a Added points for %topic
}
alias dorempoints {
var %topic $+($1,.,$2)
remini -n Points.ini %topic Points
echo -a Removed points for %topic
}
on *:text:!bananen:#:{
if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
set -u10 %floodpoints On
set -u30 %floodpoints. $+ $nick On
msg # $nick hat insgesamt $readini(Points.ini,$+(#,.,$nick),Points) Bananen.
}
on $*:text:/!bananen (add|remove)/Si:#:{
if ($nick isop #) {
if ($0 < 3) { msg # Insufficient parameters: Use !bananen <add|remove> <user> [number] | return }
writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
{ msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points. }
}
else { msg $chan This command is only available to moderators. }
}
on !*:join:#:{
$+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick)
set %nachrichten. $+ $nick = 0
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}
on *:TEXT:*:*: {
if (%nachrichten. [ $+ [ $nick ] ] == 4) {
set %nachrichten. $+ $nick 0
msg $chan test
add.pts $+(#,.,$nick)}
}
else { inc %nachrichten. $+ $nick }
msg $chan test2
.timer $+ $nick 1 300 unset %nachrichten. [ $+ [ $nick ] ]
}
Because if Brackets not present, it tries to interpret the variable %nachrichten. first and then on the retrieved data to add the $nick.
For example if u try
if (%nachrichten. $+ $nick == $nick) {
The evaluation will be true, because the %nachricten variable does not contain anything , so the only thing it will be check , will be $nick
if ($nick == $nick) {
so the logical expression is true. Brackets allows you to attack to variable's name something dynamic
Thanks, i still dont quite understand a lot of this script language..
So like this every 5th message will add 1 point.
How would i have to change it to give points per activity? Like it is right now it gives points for 5 messages without a time window. It could take like 20 hours in theory and give points. Soooo how would i measure activity to like.. messages a minute -> points ?
Sorry if i didnt make it clear.
Another question: How do i post code like that in a comment?
Theres an error in your code
on *:TEXT:*:*: {
if (%nachrichten. $+ $nick == 4) {
set %nachrichten. $+ $nick 0
msg $chan test
add.pts $+(#,.,$nick)}
else { inc %nachrichten. $+ $nick }
}
msg $chan test2
}
The Else is inherited in the "if", It should be out of the bracket, to continue after if fail.
on *:TEXT:*:*: {
if (%nachrichten. $+ $nick == 4) {
set %nachrichten. $+ $nick 0
msg $chan test
add.pts $+(#,.,$nick)}
}
else { inc %nachrichten. $+ $nick }
msg $chan test2
}
Use tags [ code]
Thanks, but could you tell me why you need these?