Survey Script

By Relurk_ on Mar 09, 2010

Screenshots

////NOTE: I MADE THIS SCRIPT IN LIKE 2 MINUTES////

.survey - to view survey
.setsurvey - set new survey
.resetsurv - resets everything
.sa - set option a
.sb - set option b
.sc - set option c
.A - vote A
.B - vote B
.C - vote C
.Total - View total votes

on *:TEXT:*:#: {
  if ($1 == .setsurvey) { set %survey $2- }
  if ($1 == .sA) { set %optiona $2- }
  if ($1 == .sB) { set %optionB $2- }
  if ($1 == .sC) { set %optionc $2- }
  if ($1 == .survey) { msg $chan %survey | msg $chan A: %optiona | msg $chan B: %optionb | msg $chan C: %optionc | msg $chan To Vote type .A .B or .C }
  if ($1 == .A) { inc %surveya | msg $chan A total of %surveya people have voted A }
  if ($1 == .B) { inc %surveyb | msg $chan A total of %surveyb people have voted B }
  if ($1 == .C) { inc %surveyc | msg $chan A total of %surveyc people have voted C }
  if ($1 == .total) { | msg $chan A: %surveya | msg $chan B: %surveyb | msg $chan C: %surveyc }
  if ($1 == .resetsurv) { set %surveya 0 | set %surveyb 0 | set %surveyc 0 | set %survey 0 | set %optiona 0 | set %optionb 0 | set %optionc 0 }
  if ($1 == .lines) { msg $chan There are 14 lines in this script. }
}

Comments

Sign in to comment.
Sorasyn   -  Oct 26, 2010

Looks like a 2 minute snippet too. lol

 Respond  
Korvin   -  Mar 12, 2010

id use

on *:text:.*:#:

as the added . will speed up other non . triggers.

 Respond  
vinyltm   -  Mar 12, 2010

Yes a duplicate-vote check would be a nice add to this. learned that within 2 minutes of having it in my channel... :-P

 Respond  
raccoon   -  Mar 12, 2010

I like the approach taken in this script, as it's a throwback to how we used to write code in simpler languages. You have one event to handle all input, and a simple set of case statements. No bells, no whistles, easy to implement, easy to expand.

Of course, with 12 times the code, you could add all sorts of duplicate-vote checking, flood prevention, time to automatically close voting, ballot secrecy, etc etc. But this snippet is a good example of a smart computer science student.

 Respond  
Jonesy44   -  Mar 11, 2010

Is there a dislike button... ?

 Respond  
napa182   -  Mar 10, 2010

UK-Sw1ft Said:

I never said it was better, i was just showing an example to how he could use 'ifs', and how a voting script can be made.., so don't jump down my throat -.-.

lol did i say you said it was better? I said "imho = In my honest opinion", and no one is jumping down ur throat so get over ur self.

UK-Sw1ft Said:

http://www.hawkee.com/snippet/7225/
um you never said you were showing them anything all you posted was a link to ur snippet an nothing more.
So to me it looks like ur spamming his snippet with ur's nothing more.....

 Respond  
Jethro   -  Mar 10, 2010

Take people's criticism as an incentive or suggestion. It'll benefit you over the long haul. There's no gain to retaliate their comments directed at you.

 Respond  
UK-Sw1ft   -  Mar 10, 2010

I never said it was better, i was just showing an example to how he could use 'ifs', and how a voting script can be made.., so don't jump down my throat -.-.

 Respond  
napa182   -  Mar 10, 2010

UK-Sw1ft why would you spam ur snippet on his =/ anyways imho ur's is-int that much better....

 Respond  
Jethro   -  Mar 10, 2010

Adding to Napa's, implement some checks for whether a variable has been added for that specific person's vote, then unset them vars after the message has been sent, and a flood trigger control would be nice.

When you write a script, as per Napa's suggestion, put some thought into it, not just engage in a patchwork and put something together sketchily. Improve it and make your time worthwhile when you go about scripting.

 Respond  
napa182   -  Mar 10, 2010

so how come you don't unset them global vars?

imho this snippet looks like it was tossed together in 1 second with no thought.

why don't you spend some time on this and get rid of all them global vars as well as maybe make it so they can only vote once among other things.. like don't have regular users be able to unset/set surveys
Also whats the point of this line?

if ($1 == .lines) { msg $chan There are 14 lines in this script. }

Take some time and..
um keep working on it.....

you seem to have a typo on this line as well

if ($1 == .total) { | msg $chan A: %surveya | msg $chan B: %surveyb | msg $chan C: %surveyc }
 Respond  
Jethro   -  Mar 10, 2010

Well, at least Relurk_ is not using one trigger per text event. Keep it up.

 Respond  
Relurk_   -  Mar 10, 2010

Thank you Dj_801!

 Respond  
deejay8   -  Mar 10, 2010

Nice script Jakob. ;P

 Respond  
Relurk_   -  Mar 10, 2010

What do you mean napa?

 Respond  
napa182   -  Mar 09, 2010

lolwut???

 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.