Quiz script

By Yoshi on Dec 14, 2009

ok this script is for yes or no questions only. this is my first snippet so plz tell me how well i did.

on *:TEXT:Ystartquiz*:#:{
  if ($me == Yoshi && $nick !isop #) { notice $nick Only Draven can use this command!
  }
  if ($me == Yoshi && $nick isop # && %quizq != $null) { notice $nick there is already a poll in progress 
  }
  if ($me == Yoshi && $nick isop # && %quizq == $null && $2- == $null) { notice $nick Please use the correct syntax, as in Ystartquiz <question> 
  }
  if ($me == Yoshi && $nick isop # && %pollq == $null && $2- != $null) {
    msg $chan 3 A quiz has started for: $2- 
    msg $chan Use Yguessyes for yes or Yguessno for no, you may only vote once
    set %quizq $2-
    set %quizy 0
  set %quizn 0 }
}

on *:TEXT:Yguessyes*:#:{
  if ($me == Yoshi && %quizq == $null) { notice $nick There is no quiz going on at this time 
  }
  if ($me == Yoshi && %quizq != $null && $address isin %voter) { notice $nick you have already voted in this poll
  }
  if ($me == Yoshi && $address !isin %voter) {
    notice $nick Thank you for the vote of yes! Please participate in the next quiz
    inc %quizy 
  /set %voter $addtok(%voter,$address,32) }
}

on *:TEXT:Yguessno*:#:{
  if ($me == Yoshi && %quizq == $null) { notice $nick There is no quiz going on at this time 
  }
  if ($me == Yoshi && %quizq != $null && $address isin %voter) { notice $nick you have already voted in this quiz
  }
  if ($me == Yoshi && $address !isin %voter) {
    notice $nick Thank you for the vote of no! Please participate in the next quiz
    inc %quizn 
  /set %voter $addtok(%voter,$address,32) }
}

on *:TEXT:Yquiz*:#:{ 
  if ($me == Yoshi && %quizq == $null) { notice $nick there is no poll in progress at this time
  }
  if ($me == Yoshi && %quizq != $null) {
    notice $nick The current poll question is; %quizq
  notice $nick Use !voteyes for yes or !voteno for no, you may only vote once }
}

on *:TEXT:Yquizresults*:#:{
  if ($me == Yoshi && $address !isin %voter) { notice $nick you need to vote before seeing the results 
  }
  if ($me == Yoshi && $address isin %voter) {
    notice $nick for the Poll; %poll the votes stand at;
    notice $nick Yes: %quizy
    notice $nick No: %quizn
  } 

  on *:TEXT:Yendquiz*:#:{
    if ($me == Yoshi && $nick !isop #) { notice $nick Only Draven can use this command!
    }
    if ($me == Yoshi && %quizq == $null) { notice $nick There is no poll to end at this time
    }
    if ($me == Yoshi && $nick isop # && %quizq != $null) {
      msg $chan 1 The Poll has now ended for the question: %quizq ; and the results are;
      msg $chan 3 Yes: %quizy
      msg $chan 3 No: %quizn
    } 
    if ($me == Yoshi && %quizq != $null && %quizy < %quizn) { 
      msg $chan 3 The Winning Answer is No with %quizn point(s) 
    }
    if ($me == Yoshi && %quizq != $null && %quizn < %quizy) {
      msg $chan 3 The Winning Answer is Yes with %quizy point(s)
    }
    if ($me == Yoshi && %quizq != $null && %quizy == %quizn) {
      msg $chan 3 We have a Tie, Draven will now decide the answer! 
    }
    unset %quizy
    unset %quizn
    unset %quizq
    unset %voter
  }
}

Comments

Sign in to comment.
Jethro   -  Dec 17, 2009

Ripping will never cease to exist. But it won't be ripping if you give back credit when it's due. Again, it's a matter of morality.

 Respond  
slub77   -  Dec 17, 2009

lol this got comments quick, it went from a quiz script to a copyright discussion lol

 Respond  
napa182   -  Dec 17, 2009

no ripping is taking someone elses script and posting it as ur own.

 Respond  
Silo   -  Dec 17, 2009

I don't know if this is deemed ripping or not, but I learned the basics by tweaking other ppls scripts and just seeing what they did & how they could be manipulated. Eventually I tried my own basic scripts and went from there. I still quite often have to ask for help or advice since the concept of scripting or computer language is very new to me and I sometimes need a little help to get me thinking in the right way.

lol I still remember the first guy that introduced me to mIRC. He showed me how to add a popup in the channel window (it was Hop:hop). I was so excited and was hooked after that!!!

 Respond  
Master-Of-Death   -  Dec 17, 2009

lol Jethro_ you rip from yourself?

 Respond  
Jethro   -  Dec 16, 2009

I admit I always rip from the best. :(

 Respond  
napa182   -  Dec 16, 2009

well whats funny is if they are going to rip. why didnt they rip somthing good?

Sad just sad.....

 Respond  
Silo   -  Dec 16, 2009

I agree napa, it's the only way to learn.

 Respond  
napa182   -  Dec 16, 2009

lol why rip in the first place? just make ur own crap...

 Respond  
Jethro   -  Dec 16, 2009

Oh I see the similarity in these two scripts. I don't see the big deal though, since all the snippets submitted on hawkee becomes part of the open-source material .

BUT, the ethics of giving the original author's script credit where it's due is absolutely paramount.

 Respond  
Master-Of-Death   -  Dec 16, 2009

he is right, major rip BAD YOSHI!

 Respond  
Wanabepc   -  Dec 16, 2009

All you have done here is rip my poll feature.... and changed some of the words.....

http://www.hawkee.com/snippet/6616/

 Respond  
Silo   -  Dec 15, 2009

Good call Jethro_ makes sense to me.

 Respond  
napa182   -  Dec 15, 2009

sad just sad

 Respond  
Jethro   -  Dec 15, 2009

Silo, you should use $mnick instead:

if ($mnick != $me) { return }

Using $nick returns $null in the on text event.

 Respond  
Yoshi   -  Dec 15, 2009

Thank you for the advice. i will try to use your advice in my other scripts as well

 Respond  
Master-Of-Death   -  Dec 15, 2009

Silo it's a bot, if your connected to the same server and channel and do not use if ($me == Yoshi) it double posts. ;0 I know from my bots.

 Respond  
Silo   -  Dec 15, 2009

halt is too final. I think using return is better since the rest of the script can still process if needed. But why even use your Yoshi nick in there? if ($nick != $me) return
you dont need the { } for a single line script, since there is noting to nest.

 Respond  
Master-Of-Death   -  Dec 15, 2009

why keep using

if ($me == Yoshi && $nick !isop #) { notice $nick Only Draven can use this command!

Why not just use

if ($me !== Yoshi) { halt }

Means you only need to use it once at the beginning of each text event, and whil on that subject you could just use one text event for everything.

 Respond  
Silo   -  Dec 14, 2009

Things like:

if ($me == Yoshi && $nick !isop #) { notice $nick Only Draven can use this command!

shouldn't be used in scripts you make public. Also using hard coded #channels in code is sloppy as well (not that you have done this, but in general).

Slacker has given great advice with his !%quizq and %quizq suggestion. And using things like unset %vote.* will make your scripts cleaner and look better. If you don't understand what he's referring to, from the mIRC help file:

/unset [-s] <%var>
This unsets and removes the specified variables from the variables list. If you specify a variable with wildcard characters then all matching variables will be removed.
/unset %test*
This will remove all variables beginning with the word %test.
 Respond  
slacker   -  Dec 14, 2009

instead of useing %quizq != $null or %quizq == $null you could do !%quizq an %quizq
also on ur unset of vars you can do unset %quizy %quizn %quizq %voter or beter yet why not name the vars like %vote.quizy %vote.quizn %vote.quizq and %vote.vote then unset them like unset %vote.*

you do have alot of redundancy in the script but good work on ur first script.

 Respond  
blitzz   -  Dec 14, 2009

Who is Draven?

You missing one end bracket on the Yquizresults event.

 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.