mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Alright I'm working on a script that will relay a command or message every few minutes (for now 5, 10, 15, minutes) I know there HAS to be a way to get this working with my current commands.ini file, which is where I keep the same commands/messages I'm trying to run on a timer. However, I can't get for the life of me figure it out.


What I have now:


Code:
on *:text:!start:#: {
  if ($nick isop #) { msg # /me AutoCom: ON }
  { timerTwitter 0 600 msg # Twitter Link!  }
  { timerDonate 0 900 msg # Donate Link }
  { timerGT 0 300 msg # Gamertag Link }  
  else { msg # /me $nick -> You are not allowed to use this command. }
}

on *:text:!stop:#: {
  if ($nick isop #) { msg # /me AutoCom: OFF }
  { timerTwitter off } { timerDonate off } { timerGT off } 
  else { msg # /me $nick -> You are not allowed to use this command. }
}

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Unless incorrect brackets, i don't see anything wrong with the code.
You may need to remove unnecessary brackets.
Code:
on *:text:!start:#: {
  if ($nick isop #) { 
    msg # /me AutoCom: ON 
    timerTwitter 0 600 msg # Twitter Link! 
    timerDonate 0 900 msg # Donate Link 
    timerGT 0 300 msg # Gamertag Link   
  }
  else { msg # /me $nick -> You are not allowed to use this command. }
}

on *:text:!stop:#: {
  if ($nick isop #) { 
    msg # /me AutoCom: OFF 
    timerTwitter off | timerDonate off | timerGT off  
  }
  else { msg # /me $nick -> You are not allowed to use this command. }
}

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
This way works fine. What I would like is for the timer's to use the commands.ini file to find the right line and repeat it. Rather than having the { msg # LINEHERE }

I have tried things like this, with no success. More than likely for obvious reasons but I can't see them...
Code:
on *:text:!start:#: {
  if ($nick isop #) { msg # /me AutoCom: ON }
  { timerTwitter 0 600 ($readini(commands.ini,n,commands,$regml(1))) msg # $v1  }
  { timerDonate 0 900 ($readini(commands.ini,n,commands,$regml(1))) msg # $v1 }
  { timerGT 0 300 ($readini(commands.ini,n,commands,$regml(1))) msg # $v1 }  
  else { msg # /me $nick -> You are not allowed to use this command. }
}

on *:text:!stop:#: {
  if ($nick isop #) { msg # /me AutoCom: OFF }
  { timerTwitter off } { timerDonate off } { timerGT off } 
  else { msg # /me $nick -> You are not allowed to use this command. }
}



If that wasn't clear, I'm sorry. If it's not possible the way I'm doing it now will work I suppose.

Thank you for your reply smile

Last edited by Bramzee; 01/05/14 03:55 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
This is untested.

!repeat !twitter 1 --> repeat !twitter command every 1 min.
!repeat !twitter off --> turn off !twitter repeating.

Code:
on *:text:!repeat *:#:{
  if $nick !isop # { msg # You are not allowed | return }
  if !$3 { msg # Usage: !repeat !<command name> <time in minute/off> | return }
  if ($3 !isnum || $3 < 1) && $3 != off { msg # <time> must be number greater than 0 or off | return }
  var %t $+(#,.,$2), %text $readini(commands.ini,n,commands,$2)
  if !%text { msg # $2 does not exists. | return }
  if $timer($+(repeat.,%t)) {
    if $3 == off { 
      $+(.timerrepeat.,%t) off 
      msg # $2 turns off.
    }
    else { msg # $2 was already repeating. }   
  } 
  else { 
    if $3 == off { msg # $2 was never started yet. }
    else { 
      $+(.timerrepeat.,%t) 0 $calc($3 * 60) msg # $replace(%text,|,-,$,-,%,-) 
      msg # $2 turns on. Auto repeat in $3 min $+ $iif($3 > 1,s) $+ . 
    }
  } 
}

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Firstly, thank you for taking the time to write that.

Secondly, and sadly... It didn't work. Whenever I do "!repeat !twitter 5" my bot replies -> !twitter does not exist.

But when I do just !twitter it works fine, reading it from my commands.ini file.

Adding the command !twitter into the remote with:

Code:
on *:TEXT:!twitter:#:{
  msg # twitter.com/twitterlink
}


and trying "!repeat !twitter 5" did nothing as well. I figured I'd try that before saying it didn't work.

Again, thank you for the suggestion.

Last edited by Bramzee; 01/05/14 04:50 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Why you add !twitter command to remote?
You want read it from .ini file right?

Add !twitter command into your .ini file
using: !addcom(orsomething) !twitter twittertexthere

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
I tried it with it just in the commands.ini file. When I typed JUST !twitter in, it worked fine. When I put !repeat !twitter 1 it replied -> !twitter does not exist.

Then I thought I'd try to add it to the remote to see if that was the problem, and it still didn't work. I was just trying to make sure I covered as many possibilities as possible before I posted saying it didn't work.

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
can you show the code that you're using to trigger !command?

Edit: I just tested it and works fine.

Last edited by blessing; 01/05/14 05:11 PM.
Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
I believe this is what you mean... Also, I just realized that I have it set up for my commands.ini file to have commands for 2 channels. So instead of

Code:
(commands.ini,n,command,$regml(1))


I have:

Code:
(commands.ini,n,NICKHERE,$regml(1))


not sure if thats going to make a difference though, because when I used the script you gave me I replaced commands with MYNICK. But, just wanted to point it out.

code I use to trigger !command

Code:
on $*:text:/^!(\S+)/:#:{
  if ((%floodcom) || ($($+(%,floodcom.,$2),2))) { return }
  set -u10 %floodcom On
  set -u30 %floodom. $+ $nick On
  if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
}

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
the code to trigger !command you use do not capture (!)
so it would be !repeat twitter(without !) 5

or you can replace this line %text $readini(commands.ini,n,commands,$2) with %text $readini(commands.ini,n,commands,$right($2,-1)) if you want use !repeat !twitter(with !) 5

Joined: Apr 2014
Posts: 170
Bramzee Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Works. Thank you SO much! idk who I've learned more from on these forums, but I appreciate all the help all you more experienced users give smile


Link Copied to Clipboard