mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2023
Posts: 5
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: May 2023
Posts: 5
Hi

Hope anyone can help me or send me in the right direction what to do smile

I want to make a script that messages a bot each hour private. Im not really sure how to do this so hope some have any ideas

something???/query bot im heeere something???


Thanks in advance smile

Joined: Jul 2006
Posts: 4,182
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,182
With timers, you can execute a command such as "/query bot message" in the future by either specifying the number of second to wait from the moment you execute the timer, or by specifying a time (24h format)

/.timer 1 5 echo -ag this message will be displayed in 5 seconds
/.timer 14:30 1 0 echo -ag this message will be displayed at 14:30

1 represents the number of repetition, 5 and 0 are the number of second to wait

If you meant every hour starting at any point in time, aka it's 14:48 and you'll send a message right now and at 15:48 16:48 etc, you can just use the first method with a repetition of 0 to it repeats indefinitely (if you want to stop then stop the timer) and a number of second of 3600 (1 hour).
If you meant every hour starting at an hour when the number of minutes and second is 0 such as 12:00 or 15:30, you can use the second method to first make sure it's the correct hour and only then use the first method to repeat it every hour.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: May 2023
Posts: 5
C
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: May 2023
Posts: 5
Many many thanks! smile

Joined: May 2022
Posts: 78
F
Babel fish
Offline
Babel fish
F
Joined: May 2022
Posts: 78
And what if I'd like my bot to send a public message in chan if nobody write for 30 minutes? Thanks

Joined: Jul 2006
Posts: 4,182
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,182
For that you can create a timer which sends the message in 30 minutes everytime someone sends a message, by naming the timer it'll overwrite itself and reset the 30mins counter:

on *:text:*:#yourchannel:.timerresetcounter 1 1800 msg $unsafe($chan) This message is sent because nobody said anything for 30minsIf you want to stop that, just use "/.timerresetcounter off"


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: May 2022
Posts: 78
F
Babel fish
Offline
Babel fish
F
Joined: May 2022
Posts: 78
Originally Posted by Wims
For that you can create a timer which sends the message in 30 minutes everytime someone sends a message, by naming the timer it'll overwrite itself and reset the 30mins counter:

on *:text:*:#yourchannel:.timerresetcounter 1 1800 msg $unsafe($chan) This message is sent because nobody said anything for 30minsIf you want to stop that, just use "/.timerresetcounter off"

Thanks for reply. And what if I want the timer stop also if a user write any word? For example an user say "HELLO" and timer stop.

Joined: Jan 2012
Posts: 323
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 323
Originally Posted by Fernet
And what if I want the timer stop also if a user write any word? For example an user say "HELLO" and timer stop.

Try using this variant code:
Code
on *:TEXT:*:#channel:{
  if (HELLO === $1 && $timer(COUNTER)) { .timerCOUNTER off | .hadd -mz counter timer 1800 | msg $chan The timer is disabled and can be started after 1800 secs = 30 mins. }
  if (!$hget(counter,timer)) { .timerCOUNTER 1 1800 msg $unsafe($chan) This message is sent because nobody said anything for 1800 secs = 30 mins. }
}

Timer named "COUNTER" will restart every time users write something on the channel. If no one communicates on the channel for 30 minutes, a message will be sent that follows the timer. But if someone writes the magic word "HELLO" while the timer is running, then it will stop, and after that it will be impossible to restart the timer for the next 30 minutes.


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: May 2022
Posts: 78
F
Babel fish
Offline
Babel fish
F
Joined: May 2022
Posts: 78
I try to explain better...

Last edited by Fernet; 02/03/24 07:57 PM.
Joined: May 2022
Posts: 78
F
Babel fish
Offline
Babel fish
F
Joined: May 2022
Posts: 78
Originally Posted by Epic
Originally Posted by Fernet
And what if I want the timer stop also if a user write any word? For example an user say "HELLO" and timer stop.

Try using this variant code:
Code
on *:TEXT:*:#channel:{
  if (HELLO === $1 && $timer(COUNTER)) { .timerCOUNTER off | .hadd -mz counter timer 1800 | msg $chan The timer is disabled and can be started after 1800 secs = 30 mins. }
  if (!$hget(counter,timer)) { .timerCOUNTER 1 1800 msg $unsafe($chan) This message is sent because nobody said anything for 1800 secs = 30 mins. }
}

Timer named "COUNTER" will restart every time users write something on the channel. If no one communicates on the channel for 30 minutes, a message will be sent that follows the timer. But if someone writes the magic word "HELLO" while the timer is running, then it will stop, and after that it will be impossible to restart the timer for the next 30 minutes.

I try to explain better:
-I have a bot named PLUTO that start and stop talking using simply ON and OFF;
-On connect, bot is ON and it talk every 60 sec saying something;

Now I wish that:

-If an user say any word, this ADDON should have to say: !OFF , and so PLUTO stop to talk, so I think is maybe:

if ( ?????? ) $1 && $timer(COUNTER)) { .timerCOUNTER off | .hadd -mz counter timer 180 | /bs say #mychannel !OFF ---->And so PLUTO SHUT UP

-If there're no more words from any user after for example 20 minutes, this ADDON should have to say: !ON , and so PLUTO restart to talk, so I think is something like:

if (!$hget(counter,timer)) { .timerCOUNTER 1 180 /bs say #mychannel $unsafe($chan) ON ---->And so PLUTO restart to talk every 60 sec
}
}


-Of course if another user join and talk, addon restart the task.

I hope I been more clear, sorry but I'm not an expert

Thanks

Joined: Jan 2012
Posts: 323
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 323
Ok. Try testing this code:
Code
on *:TEXT:*:#channel:{
  if ($nick == ServicesBot && $1 == !ON) || ($nick == PLUTO) { return }
  if (!$hget(pluto,work)) { .hadd -m pluto work true }
  if ($hget(pluto,work) == true) { pluto_stop $chan }
  if ($hget(pluto,work) == false) { .timerPLUTOSTART 1 1200 pluto_start $chan }
}
alias -l pluto_start { .hadd -m pluto work true | bs say $1 !ON }
alias -l pluto_stop { .hadd -m pluto work false | bs say $1 !OFF }

Note:

  • Change the nick "ServicesBot" in the code to the nick of your service bot, which is present on the channel and will write commands "!ON" and "!OFF".
  • You can change the 1200 secs = (20 mins) specified for the timer named "PLUTOSTART" to any other time in seconds.


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples

Link Copied to Clipboard