mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2014
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Apr 2014
Posts: 9
Hello! I have a pretty much fully functional script for points already, but it runs constantly - people are getting way too many points for nothing!

If at all possible, I need a command to start/stop it at the beginning/end of streams.

My current points script:

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:!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 DePoints.
}

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) + 5)


Thanks a lot for any help. smile

Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
/help if
/help /set
you would make an on text command that would (probably be moderator only) set a variable on and another to set it off.
then in the join command you would have it check for that variable to be on or off, then have the 'off' one not give points (or have it give less)


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Apr 2014
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Apr 2014
Posts: 9
thanks smile I think I understand what you're getting at, but I don't really know the first thing about how to code something like that :s do you think you could give me an example to work off of? if it isn't too much trouble

thanks so much <3

Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
tip: (remove spaces) for inserting a script use [ code ] (scripts here) [ /code ]
-
an example script for turning it on/off:
Code:
on *:text:!stream*:#:{
if ($2 == live) {
msg $chan points will now be at regular giving
unset %isstreamoff
}
elseif ($2 == off) {
msg $chan points will now not be given since the stream is offline
set -e %isstreamoff yes
}
}

usage:
!stream live
!stream off
then, you would add a line like this to your join command
Code:
if (%isstreamoff) return

the ! in the first part of the if statement make is opposite, so if there is no variable %isstreamon then it will do the code after it. the return at the end stops the code.

incase you need this, this is the join command
Code:
on !*:join:#:{
if (%isstreamoff) return
$+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick)
}


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Jul 2014
Posts: 48
A
Ameglian cow
Offline
Ameglian cow
A
Joined: Jul 2014
Posts: 48
personally, I would tie in the points timer to an "uptime" command. onjoin, check if uptime/isonline before setting the timer, if not uptime/online, set timer off.

Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
i was thinking to do that, but in this post i was writing a script right from the reply box and a command to turn it on/off was mentioned.


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Mar 2014
Posts: 20
R
Ameglian cow
Offline
Ameglian cow
R
Joined: Mar 2014
Posts: 20
this works the best to make sure people cant gain points while its off

on !*:join:#:{
if (%flag == 1 ) {
$+(.timerpoints.,#,.,$nick) 0 36 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick)
if ($nick isop #) {
msg # The Creator Has Enter The Stream
}
}
elseif (%flag == 0 ) {
msg # sorry $nick the points system is off but feel free to check your points if you want
}
else {
msg $chan $nick you broke my code gg
}
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
writeini -n points.ini $1 points $calc($readini(points.ini,$1,points) + 5)
}

Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
might want to change that else in the join. if %flag isn't there and you have a stream averaging 100 viewers the chat will be spammed with broken code


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Apr 2014
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Apr 2014
Posts: 9
Thank you so much. smile It really helped!


Link Copied to Clipboard