mIRC Home    About    Download    Register    News    Help

Print Thread
#255144 26/09/15 06:45 AM
Joined: Jun 2015
Posts: 34
C
copman Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jun 2015
Posts: 34
Hi i need help turning the script in to a timing raffle so the raffle start and in 5 min it draws and on the 2 min it gives a message saying there is a raffle going 3 min to enter type !raffle. Then in 1 min lift let it say 1 min lift in the raffle to get in type !raffle.

HERE is the script
on *:TEXT:!giveaway:#: {
if (%open == 1) {
write Raffle.txt $nick
msg $chan $nick entered the giveaway!
}
}

on *:TEXT:*:#:{
if ($nick isop #) {
if ($1 == !giveaway) {
if ($2 == open) {
msg $chan /me giveaway started Thanks to keign28 to get in type !giveaway GOOD LUCK
set %open 1
write -c Raffle.txt
echo -a Raffle Started
}
if ($2 == close) {
msg $chan /me giveaway CLOSED!
set %open 0
write -c Raffle.txt
echo -a Raffle Closed
}
}
if ($1 == !giveawayend) {
if (%open == 1) {
var %user = $read(Raffle.txt,n)
write -c Raffle.txt
set %open 0
msg $chan /me And the winner is... %user $+ !!! Well Done!
echo -a Raffle Closed
}
}
}
if ($1 == !people) {
if (%open == 1) {
msg $chan There are currently $lines(Raffle.txt) users in the giveaway!
}
}
}


Thanks.

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
You just need to use some timers that go off at different times

I have posted a raffle script on here that does what you're asking for, try searching for it :]

Joined: Jun 2015
Posts: 34
C
copman Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jun 2015
Posts: 34
i cant get yours to work

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Code:
on *:TEXT:*:#: {
if ($1 == !giveaway) {
if (%open == 1) {
write Raffle.txt $nick
msg $chan $nick entered the giveaway!
}
}
elseif ($1 == !people) {
if (%open) {
msg $chan There are currently $lines(Raffle.txt) users in the giveaway!
}
}
}
alias start_raffle {
if (!%open) {
write -c Raffle.txt
set %open 1
msg #yourchan The raffle is open! You have 5 minutes to enter by typing !raffle
.timer 1 120 msg #yourchan 3 minutes left for the raffle to close. Type !raffle to enter!
.timer 1 290 msg #yourchan 1 minute left people! Type !raffle to enter! Go Go Go!
.timer 1 350 end_raffle
}
elseif (%open) { echo -at There is an active raffle already. }
}
alias end_raffle { 
if (%open) {
var %user = $read(Raffle.txt,n)
write -c Raffle.txt
unset %open 
msg #yourchan /me And the winner is... %user $+ !!! Well Done!
}
elseif (!%open) { echo -at There is not a n active raffle. Type /start_raffle to start one. }
}

Change #yourchan with your channel's name.
Type /start_raffle to start a raffle. It will end automatically in 5 minutes.
You can end it on your own too by typing /end_raffle
Have a nice.. day!
-OrFeAsGr-

Joined: Jun 2015
Posts: 34
C
copman Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jun 2015
Posts: 34
is there a way i can get it to open by typing !raffleopen ?

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Code:
on *:TEXT:*:#: {
if ($1 == !giveaway) {
if (%open == 1) {
write Raffle.txt $nick
msg $chan $nick entered the giveaway!
}
}
elseif ($1 == !people) {
if (%open) {
msg $chan There are currently $lines(Raffle.txt) users in the giveaway!
}
}
if ($1 == !raffleopen) {
start_raffle
}
}
alias start_raffle {
if (!%open) {
write -c Raffle.txt
set %open 1
msg #yourchan The raffle is open! You have 5 minutes to enter by typing !raffle
.timer 1 120 msg #yourchan 3 minutes left for the raffle to close. Type !raffle to enter!
.timer 1 290 msg #yourchan 1 minute left people! Type !raffle to enter! Go Go Go!
.timer 1 350 end_raffle
}
elseif (%open) { echo -at There is an active raffle already. }
}
alias end_raffle { 
if (%open) {
var %user = $read(Raffle.txt,n)
write -c Raffle.txt
unset %open 
msg #yourchan /me And the winner is... %user $+ !!! Well Done!
}
elseif (!%open) { echo -at There is not a n active raffle. Type /start_raffle to start one. }
}

Replace the code with this one

Last edited by OrFeAsGr; 28/09/15 06:59 PM.
Joined: Oct 2015
Posts: 3
J
Self-satisified door
Offline
Self-satisified door
J
Joined: Oct 2015
Posts: 3
Thanks for this code. I am trying to make a few edits. How could I make it say "there is not an active raffle right now" when the raffle is closed? Also how can I make it so only mods or the broadcaster can open the raffle? It seems that typing !raffle will automatically just start a new raffle for anyone as this is. Also ending the raffle will restart the timed message when there is not a raffle under way. Is there a way to fix this? Here's what my code looks like.
Code:

on *:TEXT:*:#: {
  if ($1 == !raffle) {
    if (%open == 1) {
      write raffle.txt $nick
      msg #cartooncyborg /me $nick entered the raffle!
    }
    elseif (!%open) { echo -at msg /me There is not an active raffle. }
  }
  elseif ($1 == !people) {
    if (%open) {
      msg #cartooncyborg /me There are currently $lines(raffle.txt) users in the raffle!
    }
  }
  if ($1 == !raffleopen) {
    start_raffle
  }
  alias start_raffle {
    if (!%open) {
      write -c raffle.txt
      set %open 1
      msg #cartooncyborg The raffle is open! You have 5 minutes to submit a level by typing !raffle. Type !people to see who's already entered the raffle!
      .timer 1 120 msg #cartooncyborg 3 minutes left for the raffle to close. Type !raffle if you have a level suggestion!
      .timer 1 290 msg #cartooncyborg 1 minute left people! Type !raffle to enter! Go Go Go!
      .timer 1 350 end_raffle
    }
    elseif (%open) { echo -at msg #cartooncyborg /me There is an active raffle already. }
  }
  alias end_raffle { 
    if (!%open) {
      var %user = $read(raffle.txt,n)
      write -c raffle.txt
      unset %open 
      msg #cartooncyborg /me And the winner is... %user $+ !!! Well Done!
    }
    elseif (!%open) { echo -at msg /me There is not an active raffle. }


Last edited by Jae55555; 19/10/15 03:21 PM.
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Hi again! smile
Code:

on *:TEXT:*:#: {
  if ($1 == !raffle) {
    if (%open == 1) {
      write raffle.txt $nick
      msg #cartooncyborg /me $nick entered the raffle!
    }
    elseif (!%open) { msg #cartooncyborg /me There is not an active raffle. }
  }
  elseif ($1 == !people) {
    if (%open) {
      msg #cartooncyborg /me There are currently $lines(raffle.txt) users in the raffle!
    }
  }
  if ($1 == !raffleopen) {
if ($istok(%mods,$nick,32)) {
    start_raffle
}
  }
}
  alias start_raffle {
    if (!%open) {
      write -c raffle.txt
      set %open 1
      msg #cartooncyborg The raffle is open! You have 5 minutes to submit a level by typing !raffle. Type !people to see who's already entered the raffle!
      .timerraffle1 1 120 msg #cartooncyborg 3 minutes left for the raffle to close. Type !raffle if you have a level suggestion!
      .timeraffle2 1 290 msg #cartooncyborg 1 minute left people! Type !raffle to enter! Go Go Go!
      .timerraffle3 1 350 end_raffle
    }
    elseif (%open) { msg #cartooncyborg /me There is an active raffle already. }
  }
  alias end_raffle { 
    if (%open) {
.timerraffle* off
      var %user = $read(raffle.txt,n)
      write -c raffle.txt
      unset %open 
      msg #cartooncyborg /me And the winner is... %user $+ !!! Well Done!
    }
    elseif (!%open) { msg #cartooncyborg /me There is not an active raffle. }
}

The timed messages will stop when the raffle ends now. That was my mistake!
I dont know if isop works on twitch.. so i made it so it checks if the nick is in %mods . So you'll have to put the nicks of the mods in %mods seperated with spaces.
And at last, echo -at wasnt needed in front of msg command
smile

Last edited by OrFeAsGr; 19/10/15 03:54 PM.
Joined: Oct 2015
Posts: 3
J
Self-satisified door
Offline
Self-satisified door
J
Joined: Oct 2015
Posts: 3
AMAZING!! Thanks so much. ISOP actually does work in twitch so here's my updated code. It works really nicely. The only thing I would like to implement is a way to keep people from entering the raffle more than one time. Is there a way to limit the entrants or to get rid of duplicates?

Code:
on *:TEXT:*:#: {
  if ($1 == !raffle) {
    if (%open == 1) {
      write raffle.txt $nick
      msg #cartooncyborg /me $nick entered the raffle!
    }
    elseif (!%open) { msg #cartooncyborg /me There is not an active raffle. }
  }
  elseif ($1 == !people) {
    if (%open) {
      msg #cartooncyborg /me There are currently $lines(raffle.txt) users in the raffle!
    }
  }
  if ($1 == !startraffle) {
    if ($nick isop #) || ($nick == cartooncyborg) {
      start_raffle
    }
  }
  if ($1 == !stopraffle) {
    if ($nick isop #) || ($nick == cartooncyborg) {
      end_raffle
    }
  }
}
alias start_raffle {
  if (!%open) {
    write -c raffle.txt
    set %open 1
    msg #cartooncyborg The raffle is open! You have 5 minutes to submit a level by typing !raffle. Type !people to see who's already entered the raffle!
    .timerraffle1 1 120 msg #cartooncyborg 3 minutes left for the raffle to close. Type !raffle if you have a level suggestion!
    .timerraffle2 1 290 msg #cartooncyborg 1 minute left to enter the raffle! Hurry!
    .timerraffle3 1 350 end_raffle
  }
  elseif (%open) { msg #cartooncyborg /me There is an active raffle already. }
}
alias end_raffle { 
  if (%open) {
    .timerraffle* off
    var %user = $read(raffle.txt,n)
    write -c raffle.txt
    unset %open 
    msg #cartooncyborg /me And the winner is... %user $+ !!! Well Done!
  }
  elseif (!%open) { msg #cartooncyborg /me There is not an active raffle. }
}

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Add this in the !raffle part
Code:
if (!$($+(%,joinraf,$nick),2)) {
set $+(%,joinraf,$nick) 1

(and add one } in the end of !raffle part)
And in the alias end_raffle add this:
Code:
unset %joinraf*

smile And it wont let people use the !raffle command more than once

Joined: Oct 2015
Posts: 3
J
Self-satisified door
Offline
Self-satisified door
J
Joined: Oct 2015
Posts: 3
Wow man I really appreciate it. I am learning a bit about this along the way as well. You're really amazing thanks so much. Here's the final beautiful raffle code for anyone who wants it!!

Code:
on *:TEXT:*:#: {
  if ($1 == !raffle) {
    if (!$($+(%,joinraf,$nick),2)) {
      set $+(%,joinraf,$nick) 1
      if (%open == 1) {
        write raffle.txt $nick
        msg #cartooncyborg /me $nick entered the raffle!
      }
      elseif (!%open) { msg #cartooncyborg /me There is not an active raffle. }
    }
    elseif ($1 == !people) {
      if (%open) {
        msg #cartooncyborg /me There are currently $lines(raffle.txt) users in the raffle!
      }
    }
  }
  if ($1 == !startraffle) {
    if ($nick isop #) || ($nick == cartooncyborg) {
      start_raffle
    }
  }
  if ($1 == !stopraffle) {
    if ($nick isop #) || ($nick == cartooncyborg) {
      end_raffle
    }
  }
}
alias start_raffle {
  if (!%open) {
    unset %joinraf*
    write -c raffle.txt
    set %open 1
    msg #cartooncyborg /me --[[ A NEW RAFFLE HAS BEGUN ]]--
    msg #cartooncyborg You have 5 minutes to submit a level by typing !raffle.  MrDestructoid 
    msg #cartooncyborg Type !people to see how many people have already entered the raffle!
    .timerraffle1 1 120 msg #cartooncyborg 3 minutes left for the raffle to close. Type !raffle if you have a level suggestion!
    .timerraffle2 1 290 msg #cartooncyborg 1 minute left to enter the raffle! Hurry!
    .timerraffle3 1 350 end_raffle
  }
  elseif (%open) { msg #cartooncyborg /me There is an active raffle already. }
}
alias end_raffle { 
  if (%open) {
    .timerraffle* off
    var %user = $read(raffle.txt,n)
    write -c raffle.txt
    unset %open 
    unset %joinraf*
    msg #cartooncyborg /me --[[ %user $+  ]]-- HAS WON THE RAFFLE! --[[ CONGRATULATIONS ]]--
    msg #cartooncyborg Please type your level in the chat so we can play it! MrDestructoid 
  }
  elseif (!%open) { msg #cartooncyborg /me There is not an active raffle. }
}
}

Last edited by Jae55555; 20/10/15 03:06 PM.
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
No problem smile Have Fun!!!


Link Copied to Clipboard