I've seen this done in multiple "free shell" channels on Freenode and other IRC networks. Basically, if you need a system where users need to get a certain amount of vouchers in order to get something, you can use this.
It's not a perfect system, though, because I'm too lazy to have it check for nick changes and such to prevent cheating and the script can probably be shortened through token identifiers or something similar.
The commands:
There are only two commands, really.
.Vouch
The is required. The script will check various things, such as seeing if the nick you specify is your own and if you already vouched for that person. If any of those get caught, the script will return the error in question and halt.
.Vouches
The is optional. If you don't specify it, the script will return how many vouchers you have.
Feel free to modify and spread this script to whatever extent, I don't really care.
on *:TEXT:.Vouches &:#: {
msg # 10[14 $+ $nick $+ 10]: $iif(!$2,You have $iif(!%vouches. [ $+ [ $nick ] $+ ],0,$numtok(%vouches. [ $+ [ $nick ] $+ ],32)) vouche(s).,$$2 has $iif(!%vouches. [ $+ [ $$2 ] ],0,$numtok(%vouches. [ $+ [ $$2 ] ],32)) vouche(s).)
}
on *:TEXT:.Vouch &:#: {
if ($nick isin %vouches. [ $+ [ $$2 ] ]) { msg # 10[14 $+ $nick $+ 10]: You have already voted for this person. | halt }
if ($$2 == $nick) { msg # 10[14 $+ $nick $+ 10]: You can't vouch for yourself. | halt }
else {
set %vouches. [ $+ [ $$2 ] ] %vouches. [ $+ [ $$2 ] ] $nick
msg # 10[14 $+ $nick $+ 10]: You have vouched for $+($$2,.)
}
}
Jethro_: I stated that I did not care if anyone stole credit for this snippet. As such, I don't care if they modify it, etc.
Aucun50: I set the variable the way I did to keep track of who already vouched for who in order to stop double-vouching and I wanted to leave the script variable-based.
WorldDMT: Thanks for the suggestion/example you gave. I'll remember that.
All of the Above: Thanks for whatever constructive comments that you gave if I didn't address them above. I've been away since yesterday, so I haven't had a chance to reply until now.
no need for two "$" for $$2 just put one $2 and about $+($$2,.) this can be $2.
and u can do it by a different way with ini file and use tokenize like this
on *:text:*:#:{
if $strip($1) == .vouch && $2 ison # {
tokenize 44 $2 $readini(votes.ini,$2)
if ($istok($2-,$2,44)) msg # 10[14 $+ $nick $+ 10]: You have already voted for this person.
elseif ($1 == $nick) msg # 10[14 $+ $nick $+ 10]: You can't vouch for yourself.
else {
writeini votes.ini votes $1 $addtok($2-,$nick,44)
msg # 10[14 $+ $nick $+ 10]: You have vouched for $1.
}
}
elseif $strip($1) == .vouches {
var %x $2
tokenize 44 $readini(votes.ini,$2)
msg # 10[14 $+ $nick $+ 10]: $iif(!%x,You have,%x has) $0 vouche(s).
}
}
Aucun50, before you tell me to "shut up," make sure your definition of the word useful applies to your suggestion thoroughly. By using "inc %varname", it'll only count on a "single person" basis, and the %varname will overwrite the other person's count. The var has to be dynamic.
My other "helpful" suggestion is that, as this has been mentioned an infinite number of times, (believe it or not, there'll always be people using one trigger per text event) there's no need to use more than one text event when one will suffice. Another factor may need to be considered to make the script safe from being spammed of abused.
Easy Jethro_, shut up and post a useful comment.
Just looking at this SimplicityX and the way you use it
set %vouches. [ $+ [ $$2 ] ] %vouches. [ $+ [ $$2 ] ] $nick
It seems your looking for a simple command "inc %varname", you only end up counting the number of tokens right? You don't use any of the text why not make things a lot easier.