mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#246079 22/05/14 07:04 PM
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Using the same point system as pretty much everyone else on here. Using mIRC for a bot in my twitch channel. Looking at how to do like !reset to make the bot reset everyone's points. Also, how could I start and stop the bot? so that ppl can't get points for being in my channel while I'm not streaming. Without me having to make the bot leave and re-join every time I start streaming.


Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
Can't promise that i will be able to help after you do it, but even if you use a "popular script", just post it. It is always better for those who try to help you to know what exactly they are dealing with.

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Code:

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:!calc*:#: {
  if ($3 == $null) /msg $chan $nick  $2 = $calc( $2 )
  if ($3 != $null) /msg $chan 7Please dont use the space bar for the !calc7 trigger. Do it like this:  5+5 7for example.
}
on *:TEXT:!c:#: {
  /msg $chan To use this channel calculator, you should know this:
  /msg $chan The Calculator Buttons Are: [+] [-] [^] [*
  ] [/]
  /msg $chan Here are some examples: 
  /msg $chan 3^2 = 9
  /msg $chan 3*2 = 6
  /msg $chan 3/2 = 1,5
  /msg $chan 3+2 = 5
  /msg $chan 3-2 = 1
}




on *:text:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}

on $*:text:/!points (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}





on *:text:!startuptime:#: {
  msg # Starting uptime.
  set -e %uptime. [ $+ [ # ] ] $ctime
}

on *:text:!uptime:#: { msg # I have been online for $duration($calc($ctime - %uptime. [ $+ [ # ] ] )) }

on *:text:!stopuptime:#: { 
  msg # Stopping uptime.
  unset %uptime. [ $+ [ # ] ] 
}

Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
Alright, i did some research and testing for the second problem, the turn on/off script. I used this thread as the basic, so credit goes to blessing.

1) replace your whole "alias -l addPoints" with this one:

Code:
alias -l add.pts {
  if %point.off { return }
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}


This should turn off the point-calculation, whenever the variable %point.off is not set.

2) I changed the other script in the thread a bit, to fit my own personal taste:

Code:
on $*:text:/^!points (on|off)/:#:{
  if $nick isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}


With that, any moderator should be able to use the turn on/off script. If you don't like that, change the isop line to your prefered method.

3) I had to remove the line that gives 1 point when somebody joins the channel, to make the script work even if it starts after somebody is already in. Same thread, a few posts before:

Code:
on !*:join:#:{
$+(.timerpoints.,#,.,$nick) 0 900 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick) <-- Erase that
}


So far, those modifications work for me. I am still new to scripting tho, so i wouldn't mind if somebody would look over my solution, to make sure that i don't have any errors.

Last edited by Ahramanyu; 22/05/14 10:44 PM.
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Originally Posted By: Ahramanyu
Alright, i did some research and testing for the second problem, the turn on/off script. I used this thread as the basic, so credit goes to blessing.

1) replace your whole "alias -l addPoints" with this one:

Code:
alias -l add.pts {
  if %point.off { return }
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}


This should turn off the point-calculation, whenever the variable %point.off is not set.

2) I changed the other script in the thread a bit, to fit my own personal taste:

Code:
on $*:text:/^!points (on|off)/:#:{
  if $nick isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}


With that, any moderator should be able to use the turn on/off script. If you don't like that, change the isop line to your prefered method.

3) I had to remove the line that gives 1 point when somebody joins the channel, to make the script work even if it starts after somebody is already in. Same thread, a few posts before:

Code:
on !*:join:#:{
$+(.timerpoints.,#,.,$nick) 0 900 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick) <-- Erase that
}


So far, those modifications work for me. I am still new to scripting tho, so i wouldn't mind if somebody would look over my solution, to make sure that i don't have any errors.



The !points on and off doesn't work when added

Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
It worked when i tested it. Did you adjust all the changes? Show me your new script.

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Originally Posted By: Ahramanyu
It worked when i tested it. Did you adjust all the changes? Show me your new script.



Here is my new code

Code:

on *:TEXT:!calc*:#: {
  if ($3 == $null) /msg $chan $nick  $2 = $calc( $2 )
  if ($3 != $null) /msg $chan 7Please dont use the space bar for the !calc7 trigger. Do it like this:  5+5 7for example.
}
on *:TEXT:!c:#: {
  /msg $chan To use this channel calculator, you should know this:
  /msg $chan The Calculator Buttons Are: [+] [-] [^] [*
  ] [/]
  /msg $chan Here are some examples: 
  /msg $chan 3^2 = 9
  /msg $chan 3*2 = 6
  /msg $chan 3/2 = 1,5
  /msg $chan 3+2 = 5
  /msg $chan 3-2 = 1
}




on *:text:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}

on $*:text:/!points (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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 !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

on *:text:!points reset:#:{
  { msg $chan All points are now erased }
  write -c points.ini.
}





on $*:text:/^!point (on|off)/:#:{
  if $nick isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}







on *:text:!startuptime:#: {
  msg # Starting uptime.
  set -e %uptime. [ $+ [ # ] ] $ctime
}

on *:text:!uptime:#: { msg # I have been online for $duration($calc($ctime - %uptime. [ $+ [ # ] ] )) }

on *:text:!stopuptime:#: { 
  msg # Stopping uptime.
  unset %uptime. [ $+ [ # ] ] 
}




on *:TEXT:!giveaway enter:#:{
  if (%giveaway == on) {
    if (!$read(giveaway.txt,nw,$nick)) {
      write giveaway.txt $nick
      msg $chan $nick - you have been entered into the giveaway! 
    }
  }
  elseif (%giveaway == off) {
    msg $chan There is no active giveaway
  }
}

on *:TEXT:!giveaway start:#:{
  if ($nick isop #) {
    set -e %giveaway on
    msg $chan giveaway started. please do "!giveaway enter" to enter. To clear all names, please do "!giveaway done" 
  }
  else { msg $chan This command is only available to moderators. }
}


on *:TEXT:!giveaway end:#:{

  set -e %giveaway off
  { msg $chan Giveaway has ended. please do !draw to pick a winner!" }
}
on *:text:!giveaway done:#:{

  -e %giveaway = off
  { msg $chan giveaway is complete. erasing all names from the giveaway }
  write -c giveaway.txt.
}
on *:text:!draw:#:{ 

  if (%giveaway == off) { msg $chan The winner is $read(giveaway.txt) $+ !! If you would like to pick another winner draw again. }
  elseif (%giveaway == on) { msg $chan The giveaway is still on! please do "!giveaway end" }
}



Here is my new Alias

Code:
alias -l add.pts {
  if %point.off { return }
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

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
}



I have nothing under variables except something about #Giveaway off

Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
Where are the lines which start giving you points on joining the channel? You took out several segments from your original file.

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
to make it easier to read, I borrowed his idea.

My REMOTE window reads:

Code:
on *:text:!tokens:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total tokens.
}

on $*:text:/!tokens (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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 tokens. }
  }
  else { msg $chan This command is only available to moderators. }
}
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 900 add.pts $+(#,.,$nick)

}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}


on $*:text:/^!points (on|off)/:#:{
  if $nick isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}



My ALIASES window reads:

Code:
/op /mode # +ooo $$1 $2 $3
/dop /mode # -ooo $$1 $2 $3
/j /join #$$1 $2-
/p /part #
/n /names #$$1
/w /whois $$1
/k /kick # $$1 $2-
/q /query $$1
/send /dcc send $1 $2
/chat /dcc chat $1
/ping /ctcp $$1 ping
/s /server $$1-



alias -l add.pts {
  if %point.off { return }
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

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
}

Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
Edit: Nevermind, i take a look again.

Last edited by Ahramanyu; 22/05/14 11:46 PM.
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
no idea, seems like there needs to be a var determined like var %point.off

Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
I think i got my problem.

Code:
on $*:text:/^!points (on|off)/:#:{
  if $nick !isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}

I told the script to return, if the nick is a operator. Need to change that into "is not an operator". At least i hope that's that. As an alternative, if you don't care wether your other mods can use this command or not, use the original " if $nick != YOURNICKHERE { return | halt } " .

Last edited by Ahramanyu; 23/05/14 01:07 AM.
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Does it work in your channel? i always if if $nick isop # and that works

Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
I am using it right now, yes. Like i said, change the command into "if nick is not an operator", like in my example above.

Edit: After restarting my script, it seems like the turn on/off script suddenly dosn't work anymore. I am really not sure where i screwed up, but i will try to figure it out. Sorry if i wasted your time in any regard, i was pretty sure that i had it.

Edit 2: I just realized that you did put your aliases into the alias-window. The scripts you have there though are made for the remote-window itself.

Code:
alias -l add.pts {
  if %point.off { return }
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

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:!tokens:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total tokens.
}

on $*:text:/!tokens (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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 tokens. }
  }
  else { msg $chan This command is only available to moderators. }
}

on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 10 add.pts $+(#,.,$nick)
}

on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

on $*:text:/^!points (on|off)/:#:{
  if $nick !isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}

Last edited by Ahramanyu; 23/05/14 01:40 AM.
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
So nothing goes in the alias window?

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Really appreciate it, it works now. When I do !reset points and then type !points. It says you have total points. How can I make it say you have 0 points.

Also, on the on join part where it says 300, which means every 5 minutes. I typed in 3600 for 3,600 seconds which is 1 hour it gives a point. That isn't working right. it gives like 1 point every few seconds instead of an hour.

Last edited by Echosyp; 23/05/14 02:42 AM.
Joined: Apr 2014
Posts: 14
A
Pikka bird
Offline
Pikka bird
A
Joined: Apr 2014
Posts: 14
I would probably create a command that says

read points.ini
if points < 1, then give out msg ( you have zero points ).
if points > 1, then post the value for the nick

On a side.note, this is your current erase-script, right?

Code:
on *:text:!points reset:#:{
  { msg $chan All points are now erased }
  write -c points.ini.
}


You should probably give that some limitation, because at the moment, ANYBODY can erase the data in your points.ini by typing this command into the chat.

Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 10 add.pts $+(#,.,$nick)
}


Change the 10 into the amount your prefered amount of seconds.

Last edited by Ahramanyu; 23/05/14 02:50 AM.
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
yea I gotta done some tuning on it to make it moderators only, just trying to figure out some stuff at the moment.

Kinda new to all of this, been a long time since I tried it.

I changed it to 3600 but when I start the bot we still get points every 10 seconds. Do we need to leave and rejoin or do we need to make the bot leave and rejoin? just currently testing everyting out.

Also,

Code:
on *:text:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u5 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}


trying to figure out how to write the you have 0 points correctly.

Cause when I do the !points reset, it deletes their name from the points.ini file

Last edited by Echosyp; 23/05/14 03:17 AM.
Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Code:
alias -l add.pts {
  if %point.off return {
    writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
  }
}
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:/^!points (on|off)/:#:{
  if $nick !== YOURNICKHERE { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # The ability to earn points is no longer available! 
  }
  else { 
    unset %point.off 
    msg # Points are now available to earn! 
  }
}

on *:text:!points:#:{
  if ((%floodcoins) || ($($+(%,floodcoins.,$nick),2))) { return }
  set -u10 %floodcoins On
  set -u300 %floodcoins. $+ $nick On
  msg # $nick - ( $+ $readini(Points.ini,$+(#,.,$nick),Points) $+ )
}

on $*:text:/!points (add|remove)/Si:#:{
  if ($nick == YOURNICKHERE) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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 the owner of this channel. }
}
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 600 add.pts $+(#,.,$nick) 
} 

on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}



Remove all that old code.
Copy this entire code.
Place it in your remote file.
Change "YOURNICKHERE" with what ever your username on twitch is (all lowercase) to make sure only YOU can turn on/off points or add/remove points... That way you don't have mods giving points away or turning on the system without you knowing it.

Under the " on !*:join:#: " portion, you'll see there is a timer. It has " 0 600 "

Change that to however long you want it to be before people get their point.

under this part...

Code:
alias -l add.pts {
  if %point.off return {
    writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
  }
}


you'll notice a +1 at the end. That's the amount of points they're gaining.

Focus on making sure the script works, before you worry about adding to it. As long as you don't change anything but the message and pointgain (ie amount/time) parts of the code you should be okay. Just make sure you're careful when doing so and do a bracket check before you hit ok :P


EDIT:
Please note that I copy pasted this from my remote file. And I don't have points on for when they join the chat (that makes it easy to "farm" points by simply leaving and rejoining)

Last edited by Bramzee; 23/05/14 12:28 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
alias -l add.pts {
  if %point.off return {
    writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
  }
}

on $*:text:/!points (add|remove)/Si:#:{
  if ($nick == YOURNICKHERE) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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 the owner of this channel. }
}


I don't know where you're all picking up code like this, but please stop spreading it around. The first alias is nonsense, and you don't surround arbitrary lines with braces. Aside from syntax, it's good to give meaningful names to variables instead of using $3, $4, $5 directly throughout your code.

Code:
alias -l add.pts {
  if (%point.off) return
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

on $*:text:/!points (add|remove)/Si:#:{
  if ($nick == YOURNICKHERE) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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,n,$+(#,.,$3),Points) total points.
  }
  else { msg $chan This command is only available to the owner of this channel. }
}


And if the channel owner's name matches the channel you can avoid hard coding it as so:
Code:
if ($mid(#,2-) != $nick) return

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Loki, I found everything in this thread on this forum. It's just a point code that i've seen just about everyone pass around on here. So I picked it up.


Everything works just fine on my bot except my !points erase code, it erases their whole name from the points.ini file and leave it blank. So when they type !points it tries to read the points.ini and sees it's blank and just says $nick has total points.

I want it to say $nick has 0 total points, so I need to figure out a way to make !points reset change the values to 0 instead of erasing the whole points.ini file.


Code:
on *:text:!points reset:#:{
  if ($nick isop #) {
    { msg $chan All points are now erased }
    write -c points.ini.
  }
  else { msg $chan This command is only available to moderators. }
}


I know the -c points.ini file clears the whole file, I'm just not sure what to add to make it reset everyone to 0 instead of erasing the whole file.


Bramzee, I changed the 600 to 3600 (which should be 3600) seconds, but if I change it while someone is in my channel they still gain the point every 600 seconds and anyone who joins after only gains 1 point an hour.

So do I need to make the bot leave the channel then rejoin if I change anything in the code? or make sure there is nobody in the channel if I change something?

Last edited by Echosyp; 23/05/14 05:31 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Don't set them to 0, read them back as 0 if they don't exist.

Code:
on *:text:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $iif($readini(Points.ini,n,$+(#,.,$nick),Points),$v1,0) total points.
}

on *:text:!points reset:#:{
  if ($nick isop #) {
    msg $chan All points are now erased
    write -c points.ini
  }
  else { msg $chan This command is only available to moderators. }
}

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Ok, appreciate that.

My last question and my bot will be complete for now.


This is my join code, I want ppl to gain 1 point when they join. So new players to the channel can start with at least 1 point. But I don't want them to be able to farm points by joining and leaving and re-joining.

Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 3600 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}




So I TRIED to do the following code below to remove 1 point when they leave and give them 1 point when they join. To even stuff out, since I don't know how to make it so if non new players join they won't get the 1 point AGAIN. So I copied the fir alias. of

Code:
alias -l add.pts {
  if (%point.off) return
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}


I renamed it to alias -l subtract.pts and did writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) - 1)

hoping the - 1 would remove 1 point when they left.

Code:
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
  subtract.pts $+(#,.,$nick)
}


Above is my when they leave the channel code. I don't understand the alias -l add.pts part of that code, when they join it doesn't have the alias as part of the code, but the leaving part of the code has alias -l add.pts in it.

And you can see at the end of the part code I added my subtract.pts which doesn't work.

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
1. All aliases begin with word "alias" should be put in the remote section, not in aliases.
2. Alias can be put anywhere in the remote. Putting alias beside an event doesnt mean that alias will work for that event. Alias works when you call it in the event regardless where you put the alias in the remote.
Code:
; all lines begin with ";" is a comment.
; alias to substract user point.
alias -l substract.pts {
  yourcode here
}

; when user leaves the channel
on !*:part:#:{
  ; tell bot to turn off timerpoints.
  $+(.timerpoints.,#,.,$nick) off

  ; and then call substract.pts alias to substract their point
  substract.pts $+(#,.,$nick)
}

what you do is:
Code:
; when user leaves channel, tell bot to turn off timer.
on !*:part:#:$+(.timerpoints.,#,.,$nick) off

; this is an alias 
alias -l add.pts {
  ; tell bot to add point and write it to ini file
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)

  ; then call substract.pts alias to do whatever substract.pts want to do in its alias.
  subtract.pts $+(#,.,$nick)
}

; you dont have substract.pts alias in remote, but you calling it in add.pts alias.
; this will result unknown command in your status window

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
It didn't work, below is the two codes.



Code:
alias -l subtract.pts {
  if (%point.off) return
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) - 1)
}





Code:
on !*:part:#:{
  $+(.timerpoints.,#,.,$nick) off
  alias -l add.pts {
    writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
    subtract.pts $+(#,.,$nick)
  }

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
I didnt write code like that.
Please do pay attention.
You dont need to write alias inside your event. You have to CALL IT.
I didnt write alias inside the event, did I?

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
ok, so far this is what I have.

Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 3600 
  add.pts $+(#,.,$nick)
}

on !*:part:#:{
  $+(.timerpoints.,#,.,$nick) off

}


I'm not gaining a point when I join, so I need to see if a new user will gain a point when they join.

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
For learning process, it would be good if you write some comment in your code. If you can translate it correctly with your words, then you learn something.
Code:
; when user join the channel
on !*:join:#:{
  ; tell bot to start timer every 3600secs and do "?" 
  ; please check with your previous code. 
  ; this line is wrong. there is no command or alias after 3600secs timer.
  $+(.timerpoints.,#,.,$nick) 0 3600 

  ; after activate timer, now tell bot to call add.pts alias and do whatever command in add.pts alias
  add.pts $+(#,.,$nick)
}

; when user leaves channel
on !*:part:#:{
  ; tell bot to turn off timer
  $+(.timerpoints.,#,.,$nick) off

}


Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
One last thing, my !points on and !points off command don't work unless I add the alias -l to the part of the code when someone leaves.


on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1) <<<If I don't have this typed in !points on and !points off don't work.
}[/code]

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Here is my WHOLE bot code. Probably A LOT of errors in there, but here it is.


Code:
alias -l add.pts {
  if (%point.off) return
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}


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:!calc*:#: {
  if ($3 == $null) /msg $chan $nick  $2 = $calc( $2 )
  if ($3 != $null) /msg $chan 7Please dont use the space bar for the !calc7 trigger. Do it like this:  5+5 7for example.
}
on *:TEXT:!c:#: {
  /msg $chan To use this channel calculator, you should know this:
  /msg $chan The Calculator Buttons Are: [+] [-] [^] [*]
  ] [/]
  /msg $chan Here are some examples: 
  /msg $chan 3^2 = 9
  /msg $chan 3*2 = 6
  /msg $chan 3/2 = 1,5
  /msg $chan 3+2 = 5
  /msg $chan 3-2 = 1
}




on *:text:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $iif($readini(Points.ini,n,$+(#,.,$nick),Points),$v1,0) total points.
}

on $*:text:/!points (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <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,n,$+(#,.,$3),Points) total points.
  }
  else { msg $chan This command is only available to the owner of this channel. }
}

on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

on *:text:!points reset:#:{
  if ($nick isop #) {
    msg $chan All points are now erased
    write -c points.ini
  }
  else { msg $chan This command is only available to moderators. }
}










on $*:text:/^!points (on|off)/:#:{
  if $nick !isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}







on *:text:!startuptime:#: {
  msg # Starting uptime.
  set -e %uptime. [ $+ [ # ] ] $ctime
}

on *:text:!uptime:#: { msg # I have been online for $duration($calc($ctime - %uptime. [ $+ [ # ] ] )) }

on *:text:!stopuptime:#: { 
  msg # Stopping uptime.
  unset %uptime. [ $+ [ # ] ] 
}




on *:TEXT:!giveaway enter:#:{
  if (%giveaway == on) {
    if (!$read(giveaway.txt,nw,$nick)) {
      write giveaway.txt $nick
      msg $chan $nick - you have been entered into the giveaway! 
    }
  }
  elseif (%giveaway == off) {
    msg $chan There is no active giveaway
  }
}

on *:TEXT:!giveaway start:#:{
  if ($nick isop #) {
    set -e %giveaway on
    msg $chan giveaway started. please do "!giveaway enter" to enter. To clear all names, please do "!giveaway done" 
  }
  else { msg $chan This command is only available to moderators. }
}


on *:TEXT:!giveaway end:#:{

  set -e %giveaway off
  { msg $chan Giveaway has ended. please do !draw to pick a winner!" }
}
on *:text:!giveaway done:#:{

  -e %giveaway = off
  { msg $chan giveaway is complete. erasing all names from the giveaway }
  write -c giveaway.txt.
}
on *:text:!draw:#:{ 

  if (%giveaway == off) { msg $chan The winner is $read(giveaway.txt) $+ !! If you would like to pick another winner draw again. }
  elseif (%giveaway == on) { msg $chan The giveaway is still on! please do "!giveaway end" }
}




on *:text:!pointcheck *:#:{
  if ((%floodcheck) || ($($+(%,floodcheck.,$2),2))) { return }
  set -u1 %floodcheck On
  set -u5 %floodcheck. $+ $nick On 
  msg # $2 has $readini(Points.ini,$+(#,.,$2),Points) total points. 
}





on *:text:!winner:#:{
  var %nick1 = $nick(#,$rand(1,$nick(#,0)))
  while (%nick1 == $me) { %nick1 = $nick(#,$r(1,$nick(#,0))) }
  msg # Randomly selected winner is %nick1 $+ ! Congratulations %nick1 you win... $eval($+(%,prize.,$network,.,#),2)
}





on *:TEXT:!top10:#:{
  if $nick == robpsychobob { top10 # } 
  else { msg # You are not allowed to use !top10. }
}

alias -l top10 {
  window -h @. | var %i 1
  while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
    var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
    aline @. %n %p
    var %i $calc($readn + 1)
  }
  filter -cetuww 2 32 @. @.
  var %i 1 | while %i <= 10 {
    var %list $addtok(%list,$line(@.,%i),44)
    inc %i
  }
  msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
  window -c @.
}










on *:text:!tickets:#:{
  if ($hget($+(tickets.,#),$nick)) { msg # $nick You already have a ticket! | return }
  var %topic = $+(#,.,$nick)
  ; Check if enough points
  if ($readini(Points.ini,%topic,Points) >= 1) {
    ; Deduct the points
    var %a = $v1 - 1
    writeini Points.ini %topic Points %a
    ; Add the user to tickets.#channel hash table, creating the table if it doesn't exist
    hadd -m $+(tickets.,#) $nick 1
    msg # $nick You bought a ticket, you now have %a points.
  }
  else msg # $nick --- Sorry you only have $iif($readini(Points.ini,n,$+(#,.,$nick),Points),$v1,0) total points!
}
on *:text:!ticket roll:#:{
  if ($nick == forgottenheroes) {
    if ($hget($+(tickets.,#))) {
      var %i = $r(1,$hget($+(tickets.,#),0).item)
      msg # The winner is $hget($+(tickets.,#),%i).item
      ; The next line frees the table (all data in it is gone)
      hfree $+(tickets.,#)
    }
    else msg # Sorry $nick there is no entries at the moment. 
  }
  else msg # $nick Only Mods can use that command.
}









on $*:text:/^!addcom !?(\S+)/iS:#:{
  if ($nick !isop #) return
  writeini commands.ini commands $regml(1) $$3-
  msg # $nick > The command $2 has been created
}

on $*:text:/^!delcom !?(\S+)/iS:#:{
  if ($nick !isop #) return
  remini commands.ini commands $regml(1)
  msg # $nick > The command $2 has been removed from the database.
}

on $*:text:/^!(\S+)/:#:{
  if ($nick !isop #) return
  if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
}



I would LOVE for !points on & !points off to burn the bot on and off so he either starts collecting points while I'm streaming or stops collecting points when I quit streaming.

I would LOVE for the bot to be able to add 1 point to new users, but not allow them to quit and re-join to keep farming 1 point over and over.

I would LOVE a raffle to be added to the bot that makes it so the players can spend ever how many points they want and be entered that many times into the raffle. Then when the raffle stops it picks a random winning ticket. Even tho someone bought 100 tickets and someone else only bought 10 I stil want that person who bought 10 to have a chance at winning but a lower chance.

Last edited by Echosyp; 24/05/14 05:18 AM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Originally Posted By: Echosyp
One last thing, my !points on and !points off command don't work unless I add the alias -l to the part of the code when someone leaves.


on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1) <<<If I don't have this typed in !points on and !points off don't work.
}

That happens because what you provide here doesnt check %point.off. Also i see you have 2 add.pts aliases in your remote. One on the top of the remote, and other what you provide here. You can remove this one.

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Yea, that's what I was saying. I do have 2 add.pts aliases. That's how the code already was when I found it on here.

But when I remove the alias that was provided in the part of the code you just quoted, the !points on !points off doesn't work. So I had to keep that in for it to work.


Also, someone else said they had to remove part of the code that gives someone 1 point when they join to make their !points on / !points off work.


I believe I'm getting confused on what makes the bot work and what breaks it.

I took a year at University of Phoenix for computer programming and always wanted to learn, but I keep running into roadblocks and stay up for hours and hours wrecking my brain trying to figure out what broke what.

Last edited by Echosyp; 24/05/14 06:25 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
I'm 100% sure you dont need 2 same aliases in the remote.
You can remove what i was saying safely.

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
That's weird as hell.

I remove that alias and

Code:
on $*:text:/^!points (on|off)/:#:{
if $nick !isop # { return }
if $2 == off { 
  set -e %point.off 1 
  msg # Not collecting points anymore.
}
if $2 == on { 
  unset %point.off 
  msg # Collecting points now.
}
}


won't work at all. I add the alias back in and it works like a charm.



I discovered, if I move the above code to the very top of the remote tab !points on and !points off work, but if I have that code below the join and part code it no longer works. Any idea?


Figured it out.

I had:

Code:
on !*:part:#:
  $+(.timerpoints.,#,.,$nick) off
}


I changed it to

Code:
on !*:part:#:{ <----- I WAS MISSING THIS!!!!!!!
  $+(.timerpoints.,#,.,$nick) off
}

Last edited by Echosyp; 25/05/14 03:21 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Originally Posted By: Echosyp
I would LOVE for the bot to be able to add 1 point to new users, but not allow them to quit and re-join to keep farming 1 point over and over.

replace this code
Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}

with this one
Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  if %joinfarm. [ $+ [ $+(#,.,$nick) ] ] { return }
  add.pts $+(#,.,$nick)
  var %s $calc($timer(points.,#,.,$nick).delay / 1000)
  inc $+(-u,%s) %joinfarm. [ $+ [ $+(#,.,$nick) ] ] 
}

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Appreciate that blessing. I had just wrote it so they lose 1 point when they leave and gain that 1 point back when they join. But I believe them losing that point isn't the best option.

Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Originally Posted By: blessing
Originally Posted By: Echosyp
I would LOVE for the bot to be able to add 1 point to new users, but not allow them to quit and re-join to keep farming 1 point over and over.

replace this code
Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}

with this one
Code:
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  if %joinfarm. [ $+ [ $+(#,.,$nick) ] ] { return }
  add.pts $+(#,.,$nick)
  var %s $calc($timer(points.,#,.,$nick).delay / 1000)
  inc $+(-u,%s) %joinfarm. [ $+ [ $+(#,.,$nick) ] ] 
}


That's not working blessing, when I start mIRC and connect it says there is to many parameters in var %s $calc($timer(points.,#,.,$nick).delay / 1000)

and they still gain the 1 point when they join.

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Yeah my bad. it should be:
Code:
var %s $calc($timer($+(points.,#,.,$nick)).delay / 1000)

Joined: Jul 2014
Posts: 8
A
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
A
Joined: Jul 2014
Posts: 8
Hi guys, i don't want to create new topic for it, so i just wanna ask you if u can help me with command. I have really no idea how to set it.

Looking for !reset command . But i don't want to delete all points from points.ini. I just want to let users delete their own points.

They are playing raffle a lot and they have often -40 points etc.

I want let them reset their own points so they will get 0.

I have same point system as others.

Code:
alias -1 addPoints {
  if ($1 !isnum) { echo 2 -st $1 is not 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 -1 lookUpPoints {
  var %topic $+($chan,.,$nick)
  var %points $readini(Points.ini,$topic,Points)
  return %points
}
alias doaddpoints {
  if ($3 !isnum { echo 2 =st $3 neni cislo. Hodnota musi byt cislo. | 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:!points:#: {
  msg # $nick ma prave $readini(Points.ini,$+(#,.,$nick),Points) bodu.
}
 
on $*:text:/!points (add|remove)/Si:#:{
  if  ($nick isop #) {
    if ($0 < 3) { msg # Spatny parametr: prikaz je !points <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  má práv&#283; $readini(Points.ini,$+(#,.,$3),Points) bodu.
    }
  else {msg $chan Tento prikaz je povolen pouze moderatorum. }
}
 
on !*:join:#:{
  $+(.timer3.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
 
on !*:part:#:$+(.timer3.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

Page 1 of 2 1 2

Link Copied to Clipboard