mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2014
Posts: 5
L
Liche_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: May 2014
Posts: 5
Hello all, nice to meet you!
I'm a newbie when it comes to scripting, but it's quite a lot of fun to mess around with. I took a few example scripts from some online bots and tried to make original scripts for my own channels, but I would like some small additions to make them better.

First, I would like my scripts to have some sort of spam limit. Like when someone keeps spamming !ask, I would like the script to activate a 1 minute cool down before that person can activate the script again, if possible I would like "(nick) please wait (time) before asking again" to appear.

Second, I've been trying this little script (it's an example of the script)

Quote:
on *:TEXT:!help*:#: {
{ set %help $rand(1,2)
set %rdm.users $nick($chan,0)
set %rdm.choose $rand(1,%rdm.users)
set %rdm $nick($chan,%rdm.choose)
if %help == 1 { /msg $chan Help %rdm $+ with this }
if %help == 2 { /msg $chan Help %rdm $+ with that }
}
}


However, there is no spacing between the random nickname and the following text. It appears as Help nickwith this.
Could someone help me out on this?

Third, I would like my bot to immediately respond to hugs or slaps from other users, the reaction should vary on the person (nick) activating the script though...

God... I'm asking way too much here, but any help is very much appreciated! Other advice is also very welcome, as I said I'm not very experienced with scripting yet.

Last edited by Liche_; 13/05/14 09:30 AM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
For your first question, you want to add a flood filter. I made a very simple alias that you can use, check this forum .

Quote:
on *:TEXT:!help:#: {
set %help $rand(1,2)
set %rdm.users $nick($chan,0)
set %rdm.choose $rand(1,%rdm.users)
set %rdm $nick($chan,%rdm.choose)
if %help == 1 { /msg $chan Help %rdm $+ with this }
if %help == 2 { /msg $chan Help %rdm $+ with that }
}
For your second question, I highlighted the your issue, remove this and you'll get it. $+ it used to make mIRC validate the value of %rdm and then put the text afterwards together with the value of %rdm.

And for your third question, what you're looking for is ACTION. Example:
Code:
on *:ACTION:*:#:{
  if ($nick == Nillen) msg # <3
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 5
L
Liche_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: May 2014
Posts: 5
Thank you for your answer!
The second and third problem look solved, though I'm not really sure how to make the first one work.

The idea is that after 3 tries of the !help script a message should appear "Please try again after (timer amount) seconds" which involves a 30 second cooldown.

I hope it's clear like this?
Again, your help is very much appreciated!

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Then you're looking for something like this.
Code:
on *:TEXT:!help:#: {
  if (%cooldown) {
    inc %x
    if (%x == 3) {
      msg # Please wait %cooldown second $+ $iif(%cooldown > 1,s.,.)
      unset %x
    }
    return
  }
  var %help $rand(1,2)
  var %rdm.users $nick($chan,0)
  var %rdm.choose $rand(1,%rdm.users) 
  var %rdm $nick($chan,%rdm.choose) 
  if %help == 1 { /msg $chan Help %rdm with this }
  if %help == 2 { /msg $chan Help %rdm with that }
  set -z %cooldown 30
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 5
L
Liche_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: May 2014
Posts: 5
Thanks for the first aid. Strangely enough the script often says nothing instead of "please wait X sec" is there a bug in it somewhere?

Also is it possible to put a halt to the script if someone only says "help". I know it sounds odd, but the point is that someone asks a question like : "!help Can you help me with this?" and not just "!help"

(Sorry for being a nag orz)

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Tested it myself.

No issues found. I did it exactly as you requested:
Originally Posted By: Liche_
The idea is that after 3 tries of the !help script a message should appear "Please try again after (timer amount) seconds" which involves a 30 second cooldown.
Unless by "tries" you meant that the command has triggered 3 times?

2nd question: Replace "!help" with "!help *"
* is an indication that any text can be used at this marker, be it before or after the word.

Also, I don't know what your purpose of the script truly is, just randomly saying "help (random user) with this/that." doesn't really make sense. If you want something different just let us know and we'll help you out with that as well.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 5
L
Liche_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: May 2014
Posts: 5
Ah yes exactly!
I made a mistake there.
The command should work for 3 tries and then stop working+adding message "please wait X secs"
I'm sorry for this confusion!

Also thank you for helping me out with the third question!
Yeah the actual script isn't "help" I'm just using this as an example to make it more simple.

Last edited by Liche_; 13/05/14 08:47 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
In that case you're looking for something like this:
Code:
on *:TEXT:!help *:#: {
  if (%cooldown) {
    msg # Please wait $v1 second $+ $iif($v1 > 1,s.,.)
    return
  }
  inc %x
  if (%x == 3) { 
    set -z %cooldown 30
    unset %x
  }
  var %help $rand(1,2)
  var %rdm.users $nick($chan,0)
  var %rdm.choose $rand(1,%rdm.users) 
  var %rdm $nick($chan,%rdm.choose) 
  if %help == 1 { /msg $chan Help %rdm with this }
  if %help == 2 { /msg $chan Help %rdm with that }
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 5
L
Liche_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: May 2014
Posts: 5
That is great! Thank you so much for your help!


Link Copied to Clipboard