What i need to change here ? - 16/11/13 11:51 AM
Hey guys i'm trying to create a bot for my channel wih Point System, slotmachine and so on...
Now i would like to add a ranking system, therefor i wanted to use the same code as for the point system.
Every user gets a timer when they join and they get 1 point(i named it blobs, it's only for the code.) every 30 mins and when they reach 20 blobs they get a new rank but for now i only want to add the blobs to them.
I used CronkTV's Tutorial on Youtube for the point system and to get a feeling for the scripting, i will modify it in the future since i think it could be a lot easier whitout complicated topics in the .ini and so on.
There's a part i wanted to use but i cant understand how it words, he's using a command "add.pts" it's only used in the timer, nowhere else thats why i don't get it what he's doing.
I hope you could understand my explanation .
Now the code:
Okay, so heres the add.pts think and i dont know what it is doing.
And since i don't understand what happens there i just tried to do it my way, i thought i could just write the command after "$+(.timerpoints.,#,.,$nick) -o 0 10"
so i tried it with writeini but it only creates the Blobs section in the Ranks.ini whitout adding blobs, they are always 0.
And heres the rest of the code, maybe you need it.
Thank you very much!
Now i would like to add a ranking system, therefor i wanted to use the same code as for the point system.
Every user gets a timer when they join and they get 1 point(i named it blobs, it's only for the code.) every 30 mins and when they reach 20 blobs they get a new rank but for now i only want to add the blobs to them.
I used CronkTV's Tutorial on Youtube for the point system and to get a feeling for the scripting, i will modify it in the future since i think it could be a lot easier whitout complicated topics in the .ini and so on.
There's a part i wanted to use but i cant understand how it words, he's using a command "add.pts" it's only used in the timer, nowhere else thats why i don't get it what he's doing.
I hope you could understand my explanation .
Now the code:
Okay, so heres the add.pts think and i dont know what it is doing.
And since i don't understand what happens there i just tried to do it my way, i thought i could just write the command after "$+(.timerpoints.,#,.,$nick) -o 0 10"
so i tried it with writeini but it only creates the Blobs section in the Ranks.ini whitout adding blobs, they are always 0.
Code:
on !*:join:#:{ ;###PunkteSystem### $+(.timerpoints.,#,.,$nick) -o 0 10 add.pts $+(#,.,$nick) add.pts $+(#,.,$nick) ;###Begrüßung### msg $chan Hallo $nick $+ ,willkommen im Nuthouse! ;###Ranking### var %blobs $calc($readini(Ranks.ini,Blobs,$nick) + $1) $+(.timerpoints.,#,.,$nick) -o 0 10 (writeini -n Ranks.ini Blobs $nick %blobs) } on !*:part:#:$+(.timerpoints.,#,.,$nick) off alias -l add.pts { writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1) }
And heres the rest of the code, maybe you need it.
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 } 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 hat $readini(Points.ini,n,$+($chan,.,$nick),Points) Pillen! } 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:#:{ ;###PunkteSystem### $+(.timerpoints.,#,.,$nick) -o 0 10 add.pts $+(#,.,$nick) add.pts $+(#,.,$nick) ;###Begrüßung### msg $chan Hallo $nick $+ ,willkommen im Nuthouse! ;###Ranking### var %blobs $calc($readini(Ranks.ini,Blobs,$nick) + $1) $+(.timerpoints.,#,.,$nick) -o 0 10 (writeini -n Ranks.ini Blobs $nick %blobs) } on !*:part:#:$+(.timerpoints.,#,.,$nick) off alias -l add.pts { writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1) } raw 366:*:{ var %i = 1 while ($timer(%i)) { if ($+(points.,$2,.,*) iswm $v1) { var %a = $v2 if ($gettok(%a,-1,46) !ison $2) { .timer $+ %a off | continue } } inc %i } } ;Slotmachine################################# on *:text:!pull:#:{ if ((%floodpull) || ($($+(%,floodpull.,$nick),2))) { return } set -u10 %floodpull On set -u30 %floodpull. $+ $nick On /set %slotmachine $readini(Points.ini,n,$+($chan,.,$nick),Points) if ( %slotmachine <= 2) { msg $chan $nick Du brauchst mehr Pillen. | halt } else { set %points $calc( $readini(Points.ini,n,$+($chan,.,$nick),Points) - 2 ) /writeini -n Points.ini $+($chan,.,$nick) Points %points set %s1 $rand(1,3) set %s3 $rand(1,3) set %s2 $rand(1,3) /msg $chan $nick Pulls the Slot.. /msg $chan %s1 - %s2 - %s3 } if ( %s1 == %s2 ) && ( %s2 == %s3 ) { set %tokenwin $rand(1,20) msg $chan Du gewinnst %tokenwin Pillen! set %points $calc( $readini(Points.ini,n,$+($chan,.,$nick),Points) + %tokenwin ) /writeini -n Points.ini $+($chan,.,$nick) Points %points } }
Thank you very much!