mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2014
Posts: 16
R
radmux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: May 2014
Posts: 16
Hello friends!

I'm a Twitch streamer and I've been working on updating my raffle script.

Here's what I have:
Code:
on *:text:!ticket:#:{
  if ((%floodraffle) || ($($+(%,floodraffle.,$nick),2))) { return }
  set -u3 %floodraffle On
  set -u60 %floodraffle. $+ $nick On
  if ($hget($+(tickets.,#),$nick)) { msg # $nick , you already have a ticket! | return }
  var %topic = $+(#,.,$nick)
  ; Check if enough points
  if ($readini(Points.ini,%topic,Points) >= 200) {
    ; Deduct the points
    var %a = $v1 - 200
    writeini Points.ini %topic Points %a
    ; Add the user to tickets.#channel hash table, creating the table if it doesn't exist
    hadd -m $+(tickets.,#) $nick 1
    msg # $nick spent 200 points on a raffle ticket.

  }
else msg #  Sorry $nick , you don't have enough points to join this raffle. You need 200 points to join. }

on *:text:!roll:#:{
  if ($nick isop #) {
    if ($hget($+(tickets.,#))) {
      var %i = $r(1,$hget($+(tickets.,#),0).item)
      msg # The winner is $hget($+(tickets.,#),%i).item
      ; The next line frees the table (all data in it is gone)
      hfree $+(tickets.,#)
    }
    else msg # There are no ticket entries at this time. 
  }
  else msg # $nick, only moderators can use that command.
}


I want to be able to turn the !ticket command off when I'm not holding a raffle.

I'm pretty new to scripting...

~Arden

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
From what I can tell, you already have another post asking the same question. - Forum
What you're looking for is used in pretty much every script around here, you're just not seeing it. I mean, you even have it in your own script.

Set variables, set if statements.
Read the help files.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 16
R
radmux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: May 2014
Posts: 16
Originally Posted By: Nillen
you even have it in your own script.

Set variables, set if statements.

It's not MY script; I have no idea how to do any of this stuff.

Last edited by radmux; 31/05/14 07:08 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: radmux
I have no idea how to do any of this stuff.


Originally Posted By: Nillen
Read the help files.

Joined: May 2014
Posts: 16
R
radmux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: May 2014
Posts: 16
Originally Posted By: Loki12583


Originally Posted By: Nillen
Read the help files.


If I found it in the help files, I wouldn't be here asking for help, would I?

Now, can anybody give me any suggestions of code or constructive help?

I simply need to make it so I can turn the !ticket command on or off.

I have no idea how to code it as I am new to scripting.

Joined: May 2014
Posts: 1
Mostly harmless
Offline
Mostly harmless
Joined: May 2014
Posts: 1
Code:
on *:text:!off:#:{
  set %commandoff
}

on *:text:!on:#:{
  unset %commandoff
}

on *:text:!command:#:{
  if (%commandoff) { HALT }
  /*bla bla bla (msg $chan ...)*/
}


Thats it, simple on/off switcher.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: radmux
If I found it in the help files, I wouldn't be here asking for help, would I?


Everything necessary to do it was already in your script. If you knew what your script was doing, and you should (by reading the help files), you wouldn't have to ask.

Joined: May 2014
Posts: 16
R
radmux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: May 2014
Posts: 16
Originally Posted By: Ryukoto
Code:
on *:text:!off:#:{
  set %commandoff
}

on *:text:!on:#:{
  unset %commandoff
}

on *:text:!command:#:{
  if (%commandoff) { HALT }
  /*bla bla bla (msg $chan ...)*/
}


Thats it, simple on/off switcher.


Thank you!

I'll try this when I get a chance.

Joined: May 2014
Posts: 16
R
radmux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: May 2014
Posts: 16
I tried what you mentioned, Ryukoto, and it's still not working for me.

Here's what I have:
Code:
;Raffle System (Beavis)
on *:text:!raffle off:#:{
  if ($nick isop #) {
    set %ticketoff
    msg $chan $nick, the raffle/giveaway system is now set to OFF.
  }
  else { msg $chan This command is only available to moderators. }
}
on *:text:!raffle:#:{
  if ($nick isop #) {
    unset %ticketoff
    msg $chan $nick has started a raffle/giveaway. To enter the raffle/giveaway, you need a ticket. You can purchase a ticket for 200pts by typing the command "!ticket"; only 1 ticket allowed per user. 
  }
  else { msg $chan This command is only available to moderators. }
}
on *:text:!ticket:#:{
  if (%ticketoff) { HALT }
  if ((%floodraffle) || ($($+(%,floodraffle.,$nick),2))) { return }
  set -u3 %floodraffle On
  set -u60 %floodraffle. $+ $nick On
  if ($hget($+(tickets.,#),$nick)) { msg # $nick , you already have a ticket! | return }
  var %topic = $+(#,.,$nick)
  ; Check if enough points
  if ($readini(Points.ini,%topic,Points) >= 200) {
    ; Deduct the points
    var %a = $v1 - 200
    writeini Points.ini %topic Points %a
    ; Add the user to tickets.#channel hash table, creating the table if it doesn't exist
    hadd -m $+(tickets.,#) $nick 1
    msg # $nick spent 200 points on a raffle ticket.

  }
else msg #  Sorry $nick , you don't have enough points to join this raffle. You need 200 points to join. }

on *:text:!roll:#:{
  if ($nick isop #) {
    if ($hget($+(tickets.,#))) {
      var %i = $r(1,$hget($+(tickets.,#),0).item)
      msg # The winner is $hget($+(tickets.,#),%i).item
      ; The next line frees the table (all data in it is gone)
      hfree $+(tickets.,#)
    }
    else msg # There are no ticket entries at this time. 
  }
  else msg # $nick, only moderators can use that command.
}


Did I do something wrong?
Also, is there a way to have !ticket set to off by default?

I have a timer that has an on/off feature and works fine for me.

Code:
on *:text:!timer on:#: {
  if ($nick isop #) { 
    msg $chan $nick , the timer system is now ON.
    .timer.pointsystem 0 1800 msg $chan You will accumulate 5pts/min for watching this stream. You can check your point balance with "!points". Points can be used to enter our giveaways; raffles generally cost about 200pts to enter. Also, you can risk your points at a gain/loss by playing our battle game using "!battle". Battles last 30 seconds each and cost 50pts to enter. Type "!modcomms" for moderator only commands. 
  }

  else { msg $chan This command is only available to moderators. }
}
on *:text:!timer off:#: {
  if ($nick isop #) { 
    msg $chan $nick , the timer system is now OFF.
  .timer.pointsystem off }
  else { msg $chan This command is only available to moderators. }
}

Last edited by radmux; 31/05/14 11:43 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Code:
set %ticketoff 1

Joined: May 2014
Posts: 16
R
radmux Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: May 2014
Posts: 16
Originally Posted By: blessing
Code:
set %ticketoff 1


That worked!

Thank you so much!

blessing and Ryukoto

Last edited by radmux; 01/06/14 04:29 AM.

Link Copied to Clipboard