mIRC Home    About    Download    Register    News    Help

Print Thread
#252494 18/04/15 02:28 PM
Joined: Mar 2015
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 10
Currently trying to make this work:

Click to reveal..
Code:
On *:text:!poll *:#:{
  if (($nick isop $chan) || ($read(Pseudomods.txt,nw,$nick))) { msg $chan /me Poll started, type " $+ $2 $+ " to vote for " $+ $3 $+ " or " $+ $4 $+ " to vote for " $+ $5 $+ ".
    set %choose1 $2
    set %choose2 $4
    set %opt1 $3
    set %opt2 $5
    set %num1 0
    set %num2 0
    write -c PollOp1.txt
    write -c PollOp2.txt
    set %pollStat ON
  }
}
 
on *:text:%choose1:#:{
  if ($read(PollOp1.txt,w,$nick)) return
  else {
    write PollOp1.txt $nick
    %num1 inc
    if ($read(PollOp2.txt,w,$nick)) {
      %num2 dec
      write -ds $nick
    }
  }
}
on *:text:%choose2:#:{
  if ($read(PollOp2.txt,w,$nick)) return
  else {
    write PollOp2.txt $nick
    %num2 inc
    if ($read(PollOp2.txt,w,$nick)) {
      %num1 dec
      write -ds $nick
    }
  }
}
 
on *:text:!endPoll:#:{
  if (($nick isop $chan) || ($read(Pseudomods.txt,nw,$nick))) {
    if (%pollStat) {
      if (%num1 == %num2) { msg $chan /me It was a tie with " $+ %num1 $+ " votes for each option. }
      else if (%num1 > %num2) { msg $chan /me " $+ %opt1 $+ " with " $+ %num1 $+ " votes against " $+ %num2 $+ " . }
      else if (%num1 < %num2) { msg $chan /me " $+ %opt2 $+ " with " $+ %num2 $+ " votes against " $+ %num1 $+ " . }
      unset %opt1
      unset %opt2
      unset %choose1
      unset %choose2
      unset %num1  
      unset %num2      
      unset %pollStat
    }
  }
}


Main problem is that %num1 and %num2 won't change and !endpoll always ends in a tie because of that.

What exactly is wrong and are there any suggestions in making this command work properly and maybe more efficient?

Joined: Sep 2011
Posts: 32
F
Ameglian cow
Offline
Ameglian cow
F
Joined: Sep 2011
Posts: 32
You might find /help /inc to be useful.


Link Copied to Clipboard