mIRC Home    About    Download    Register    News    Help

Print Thread
#242386 09/07/13 06:23 PM
Joined: Jul 2013
Posts: 6
C
CronTV Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Jul 2013
Posts: 6
Hi guys! I'm fairly new to the mirc language so I was wondering if someone could help me in finishing my script? I want to be able to activate this through a timer when someone joins. So the person gets Points every 10minutes and then for the timer to end when they leave the irc.

Code:
on *:join:#:{
  var %points $addPoints(1)
}


I would also like to add a new command to my script to allow the addition of points to people in the irc by typing !points add user and !points remove user.

Please could you help?


The full script is here

Thanks
CronTV

Joined: Jul 2013
Posts: 2
F
Bowl of petunias
Offline
Bowl of petunias
F
Joined: Jul 2013
Posts: 2
Have a look over this:
if you don't want mirc to display when the timers are started and stopped, prefix them with a .

Is this what you were looking for ?

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 *:join:#:{
var %points $addPoints(1)
timer $+ $nick 0 5 doaddpoints $chan $nick 1
}

on *:part:#:{
timer $+ $nick off
}

on *:text:!points:#:{
var %points $lookUpPoints
msg $chan $nick has %points total points.
if ($2 == add) { doaddpoints $chan $3 1 }
if ($2 == remove) { dorempoints $chan $3 }
}

on *:text:!points *:#:{
if ($2 == add) { doaddpoints $chan $3 1 }
if ($2 == remove) { dorempoints $chan $3 }
}

Joined: Jul 2013
Posts: 6
C
CronTV Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Jul 2013
Posts: 6
Thanks a lot man, works perfectly. Now i just need to sort out the raffle system and trading points.

Joined: Jul 2013
Posts: 6
C
CronTV Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Jul 2013
Posts: 6
Also i don't think the add and remove commands are working, could be wrong..

Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
Try this instead
Code:
on *:text:!points:#:{
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}
on $*:text:/!points (add|remove)/Si:#:{
  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))
}
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)
}

!points
!points add user ..................... Adds 1 point to user
!points add user (number).......... Adds (N) points to user
!points remove user.................. Removes 1 point from user
!points remove user (number)...... Removes (N) points from user

Joined: Jul 2013
Posts: 6
C
CronTV Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Jul 2013
Posts: 6
Thanks deega, worked much better, still got one small problem though in that the removal of points doesn't work. I changed the script slightly to only work for moderators and to display a message. Any suggestions?

Code:
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. }
  }
}


Edit: Nevermind i fixed it, it was my changing that broke it.
Code:
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. }
}


Last edited by CronTV; 10/07/13 04:47 PM.
Joined: Oct 2012
Posts: 164
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
smile
You should remove the braces from this line.
{ msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points. }
Code:
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. }
}


Joined: Jul 2013
Posts: 6
C
CronTV Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Jul 2013
Posts: 6
Any suggestions for the use of a !give <user> <amount> command? To allow users to give others points and the points to be removed from their current balance?

Edit: Also is while i'm here is there any sort of socket or something I can use to see if a person is subscribed to a youtube? That way they can earn points for subscribing if they do something like !youtube <their youtube>. Don't know how well that would work. Could anyone point me in the right direction?

Last edited by CronTV; 11/07/13 01:23 AM.

Link Copied to Clipboard