Voucher System

By SimplicityX on Aug 26, 2010

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,.)
  }
}

Comments

Sign in to comment.
SimplicityX   -  Aug 28, 2010

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.

 Respond  
Aucun50   -  Aug 27, 2010

101, WorldDMT is almost Dr. DMT for msl lol

 Respond  
WorldDMT   -  Aug 27, 2010

jethro_: i take it on internet bro :D

 Respond  
Jethro   -  Aug 27, 2010

Right Aucun50, I should have been more constructive when making a comment, but the fact that the author mentioned that he doesn't care can give people a negative impression otherwise.

WorldDMT, where did you take the college course for MSL 101? just kidding lol

 Respond  
WorldDMT   -  Aug 27, 2010

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).
  }
}
 Respond  
Aucun50   -  Aug 27, 2010

And you couldn't have said something like that in your first post? What I mean by %varname is you can have %person1 %person2 and use inc %person1, %person2.

 Respond  
Jethro   -  Aug 27, 2010

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.

 Respond  
Aucun50   -  Aug 27, 2010

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.

 Respond  
Jethro   -  Aug 27, 2010

SimplicityX wrote:

Feel free to modify and spread this script to whatever extent, I don't really care.If you don't care, how do you expect people to care for any suggestion on your snippet?

 Respond  
SimplicityX   -  Aug 27, 2010

If anyone has a better way of doing this, please tell me so I can rework it to look better.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.