mIRC Home    About    Download    Register    News    Help

Topic Options
#252190 - 27/03/15 12:23 AM Help with a script [TWITCH]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
So this is the script I have (it is fully functional), and my question is, how could I go about adding to it where it'll feed back to a user that they are on cooldown(flood control) and have it tell them how long they have left until they can use the command again?

Code:
on *:text:!pizza:#kreenpananas:{
  if ((%floodkreenpizza) || ($($+(%,floodkreenpizza.,$nick),2))) { return }
  set -u10800 %floodkreenpizza. $+ $nick On
  var %file = kreenpizza.ini, %cmd = $1
  var %sum = $calc($readini(%file,n,$nick,%cmd) + 1)

  writeini %file $nick %cmd %sum
  msg # $upper($nick) has indulged in the Kreenstream's slice of life %sum $iif(%sum > 1,times.,time.) Immortality is at hand! (3-hour cooldown)
}

Top
#252193 - 27/03/15 12:49 AM Re: Help with a script [TWITCH] [Re: Majeye]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
2nd question unrelated to the first...

How could I get the following command to be channel owner only? and add a stop function?

Code:
on *:TEXT:!raffle:#:{
  if ($nick isop #) {
    set %raffle $rand(1,100)
    msg $chan /me First person to guess the number between 1 and 100 wins!
  }
}


on *:text:*:#: {
  if ($1- == %raffle) {
    msg $chan WE HAVE A WINNER  
    msg $chan /me The Winner is $nick with the number %raffle $+ !!!!!!
    unset %raffle
    .timerraffle 1 10 msg $chan CONGRATULATIONS $nick !
  }
  else { }
}

Top
#252194 - 27/03/15 12:50 AM Re: Help with a script [TWITCH] [Re: Majeye]
Nillen Offline
Hoopy frood

Registered: 24/12/13
Posts: 779
Loc: Sweden
Code:
if ((%floodkreenpizza) || ($($+(%,floodkreenpizza.,$nick),2))) { return }
  set -u10800 %floodkreenpizza. $+ $nick On
Those lines deal with the flood control. The second line sets a variable, the first line checks if the variable is set. If it is set, it's going to return (do nothing).
I don't think there's a way to say how long it's left using -uN, but if you change the second line to use set -z %variable 10800 you can simply use $v1 in the first line to refer to the seconds left. $duration($v1) will give you minutes/hours
_________________________
Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Top
#252195 - 27/03/15 12:53 AM Re: Help with a script [TWITCH] [Re: Majeye]
Nillen Offline
Hoopy frood

Registered: 24/12/13
Posts: 779
Loc: Sweden
There is no such thing as a "channel owner" on twitch. The channel owner you're referring to is the person who has the same nickname as the channel. if ($nick == $mid(#,2)) { do stuff }

Code:
on *:TEXT:!raffle &:#:{
  if ($nick isop #) {
    if (($2 == on) && (%!raffle)) { 
      set %raffle $rand(1,100)
      msg $chan /me First person to guess the number between 1 and 100 wins!
    }
    elseif (($2 == off) && (%raffle)) {
      unset %raffle 
      msg $chan it's off 
    }
  }
}


Just curious, if you knew how to script this yourself, and you obviously knew how to use the unset function in the second text event, couldn't you have figured out an on/off feature yourself?
_________________________
Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Top
#252196 - 27/03/15 12:54 AM Re: Help with a script [TWITCH] [Re: Nillen]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
Thank you, Nillen! You're a boss!

also, i'm sure i could figure out the on/off function myself if i sat at it for a while.. which i just might do. was just looking for guidance in the right direction.

I never look for someone to write codes for me, just for a push in the right direction is all.


Edited by Majeye (27/03/15 06:07 AM)

Top
#252197 - 27/03/15 01:00 AM Re: Help with a script [TWITCH] [Re: Nillen]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
Originally Posted By: Nillen
Code:
if ((%floodkreenpizza) || ($($+(%,floodkreenpizza.,$nick),2))) { return }
  set -u10800 %floodkreenpizza. $+ $nick On
Those lines deal with the floot control. The second line sets a variable, the first line checks if the variable is set. If it is set, it's going to return (do nothing).
I don't think there's a way to say how long it's left using -uN, but if you change the second line to use set -z %variable 10800 you can simply use $v1 in the first line to refer to the seconds left. $duration($v1) will give you minutes/hours


Could you show me an example of this? (you don't have to use my code if you don't want, just trying to better understand what you mean)

Top
#252198 - 27/03/15 01:21 AM Re: Help with a script [TWITCH] [Re: Majeye]
Belhifet Offline
Fjord artisan

Registered: 26/06/14
Posts: 248
Code:
if ((%floodkreenpizza) || ($($+(%,floodkreenpizza.,$nick),2))) { return }


If the variable %floodkreenpizza exists OR the variable %floodkreenpizza.$nick exists then do this { Return }

if we didn't return, continue


set a variable named %floodkreenpizza.$nick for 10800 seconds.


This means that this variable will be set. If the command is used again in the next 10800 seconds, we will return when we check if the variable exists.

Top
#252199 - 27/03/15 06:04 AM Re: Help with a script [TWITCH] [Re: Belhifet]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
Originally Posted By: Belhifet
Code:
if ((%floodkreenpizza) || ($($+(%,floodkreenpizza.,$nick),2))) { return }


If the variable %floodkreenpizza exists OR the variable %floodkreenpizza.$nick exists then do this { Return }

if we didn't return, continue


set a variable named %floodkreenpizza.$nick for 10800 seconds.


This means that this variable will be set. If the command is used again in the next 10800 seconds, we will return when we check if the variable exists.


I thought I understood until this was posted. haha..

i hate being a noob at this sometimes.

Top