mIRC Home    About    Download    Register    News    Help

Print Thread
giveaway script #245580 28/04/14 12:49 PM
Joined: Mar 2014
Posts: 215
J
judge2020 Offline OP
Fjord artisan
OP Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
i am trying to make a giveaway script and my current code is this
Code:
on *:TEXT:!giveaway enter:#:{
  if (%giveaway == on) {
    if (!$read(giveaway.txt,nw,$nick)) {
      write giveaway.txt $nick
      msg $chan $nick - you have been entered into the giveaway! 
    }
  }
  elseif (%giveaway == off) {
    msg $chan There is no active giveaway
  }
}
on *:TEXT:!giveaway start:#:{
  var %giveaway = on
  { msg $chan giveaway started. please do "!giveaway enter" to enter. To clear all names, please do "!giveaway done" }
}
on *:TEXT:!giveaway end:#:{
  var %giveaway = off
  { msg $chan Giveaway has ended. please do !draw to pick a winner!" }
}
on *:text:!giveaway done:#:{
  var %giveaway = off
  { msg $chan giveaway is complete. erasing all names from the giveaway }
  write $+(-ds,1) giveaway.txt
}
on *:text:!draw:#:{ 
  if (%giveaway == off) { msg $chan The winner is $read(giveaway.txt) $+ !! If you would like to pick another winner draw again. }
  elseif (%giveaway == on) { msg $chan The giveaway is still on! please do "!giveaway end" }
}


The thing is i can't get "!giveaway done" to erase all the line of the file, and when i type !draw it doesn't do anything (i suspect the variables aren't working right) Please help


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Re: giveaway script [Re: judge2020] #245582 28/04/14 01:23 PM
Joined: Apr 2014
Posts: 191
B
blessing Offline
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
You have to use set %giveaway instead of var %giveaway to make !draw work.
Code:
on *:TEXT:!giveaway start:#:{
  set -e %giveaway on

on *:TEXT:!giveaway end:#:{
  set -e %giveaway off

...

write $+(-ds,1) giveaway.txt will clear the line that contains 1 in that line.
To clear giveaway.txt, use write -c giveaway.txt.

Re: giveaway script [Re: judge2020] #245599 29/04/14 01:36 AM
Joined: Nov 2013
Posts: 19
D
Dunsparth Offline
Pikka bird
Offline
Pikka bird
D
Joined: Nov 2013
Posts: 19
Im trying to use this script and it's not working at all for me, i'm typing !giveaway start and nothing.