mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Epic #272485 07/03/24 12:13 PM
Joined: May 2022
Posts: 78
F
Fernet Offline OP
Babel fish
OP Offline
Babel fish
F
Joined: May 2022
Posts: 78
Originally Posted by Epic
If you want the script to send messages not through the service bot, but directly through the mIRC bot, then change 2 lines in the code with the commands "bs say" to "msg".

After the change, the code script will look like this:
Code
on *:TEXT:*:#channel:{
  if ($nick == ServiceBot) { return }
  if ($nick isop $chan && $1 === !ON) { bot_stop | bot_start $chan }
  elseif ($nick isop $chan && $1 === !OFF) { bot_stop }
  else { bot_stop | .timerBOTSTART 1 1800 bot_start $unsafe($chan) }
}
alias -l bot_start {
  msg $1 Va beh...nessuno parla allora parlo io...
  rand_msg $1 | .timerRANDMSG 0 60 rand_msg $unsafe($1)
}
alias -l bot_stop { .timerBOTSTART off | .timerRANDMSG off }
alias -l rand_msg {
  var %colors 2,3,4,5,6,7,8,9,10,11,12,13
  var %rc $gettok(%colors,$rand(1,$numtok(%colors,44)),44)
  msg $1 $+(,%rc,$read(addons\miefrasibot\frasibot.txt,nt),)
}

Nothing to change here?---> if ($nick == ServiceBot) { return }
And does it display messages also on same script window? I mean: usually messages are displayed only on other users window, not in owner window...

Last edited by Fernet; 07/03/24 05:17 PM.
Fernet #272486 07/03/24 06:18 PM
Joined: Jan 2012
Posts: 322
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 322
You can decide for yourself whether you should use line if ($nick == ServiceBot) { return } in this code or remove it. It helps the script not to react to messages in the channel from the service bot nick. You can also specify any other nick that the script should ignore. But there is no point in indicating the nick of the mIRC bot in which this script is installed.

The "msg #channel text" command sends messages to the specified channel and these messages will be seen by all users of this channel, including the owner of the mIRC bot.
In line "msg $1 text", the parameter $1 contains the value of your #channel name, which was passed as an argument to two aliases "bot_start" and "rand_msg".

Learn more about this here:




The script has been tested and works properly. All you need to do is save the script in a new script editor window in the "Remote" tab of your mIRC that you are using as a bot. For the test, you can reduce the timers to 10 secs.


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Epic #272487 08/03/24 06:52 AM
Joined: May 2022
Posts: 78
F
Fernet Offline OP
Babel fish
OP Offline
Babel fish
F
Joined: May 2022
Posts: 78
Originally Posted by Epic
You can decide for yourself whether you should use line if ($nick == ServiceBot) { return } in this code or remove it. It helps the script not to react to messages in the channel from the service bot nick. You can also specify any other nick that the script should ignore. But there is no point in indicating the nick of the mIRC bot in which this script is installed.

The "msg #channel text" command sends messages to the specified channel and these messages will be seen by all users of this channel, including the owner of the mIRC bot.
In line "msg $1 text", the parameter $1 contains the value of your #channel name, which was passed as an argument to two aliases "bot_start" and "rand_msg".

Learn more about this here:




The script has been tested and works properly. All you need to do is save the script in a new script editor window in the "Remote" tab of your mIRC that you are using as a bot. For the test, you can reduce the timers to 10 secs.

Thanks all for kind help. Yes M. Epic, better me to start to study better :-P Thanks again

Epic #272517 25/03/24 01:47 PM
Joined: May 2022
Posts: 78
F
Fernet Offline OP
Babel fish
OP Offline
Babel fish
F
Joined: May 2022
Posts: 78
Originally Posted by Epic
If you want the script to send messages not through the service bot, but directly through the mIRC bot, then change 2 lines in the code with the commands "bs say" to "msg".

After the change, the code script will look like this:
Code
on *:TEXT:*:#channel:{
  if ($nick == ServiceBot) { return }
  if ($nick isop $chan && $1 === !ON) { bot_stop | bot_start $chan }
  elseif ($nick isop $chan && $1 === !OFF) { bot_stop }
  else { bot_stop | .timerBOTSTART 1 1800 bot_start $unsafe($chan) }
}
alias -l bot_start {
  msg $1 Va beh...nessuno parla allora parlo io...
  rand_msg $1 | .timerRANDMSG 0 60 rand_msg $unsafe($1)
}
alias -l bot_stop { .timerBOTSTART off | .timerRANDMSG off }
alias -l rand_msg {
  var %colors 2,3,4,5,6,7,8,9,10,11,12,13
  var %rc $gettok(%colors,$rand(1,$numtok(%colors,44)),44)
  msg $1 $+(,%rc,$read(addons\miefrasibot\frasibot.txt,nt),)
}

I have a .txt file with some messages (those are simply curiosity from the world), and set 1800 as timer (30 minutes). In spite I have more than 1000 "curiosity" , I noticed there're ripetitions, the same messages may come out 4 times ! And of course there're not repeat messages in .txt file.
How to avoid it?
Thanks

Last edited by Fernet; 25/03/24 03:55 PM.
Fernet #272609 01/05/24 08:22 AM
Joined: Jan 2012
Posts: 322
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 322
It seems your question has already gone far beyond the title of the topic under discussion :-]

Ok. You can do it like this:

  • Save to variable a random file line number.
  • Save to variable file line with the specified number.
  • Remove the specified line number from the file.
  • Write this line to a new adjacent file.
  • When the old file becomes empty, it must be deleted, and the new file must be renamed to the old file name.



So, after the above plan, you can try using this code modification:
Code
on *:TEXT:*:#channel:{
  if ($nick == ServiceBot) { return }
  if ($nick isop $chan && $1 === !ON) { bot_stop | bot_start $chan }
  elseif ($nick isop $chan && $1 === !OFF) { bot_stop }
  else { bot_stop | .timerBOTSTART 1 1800 bot_start $unsafe($chan) }
}
alias -l bot_start {
  msg $1 Va beh...nessuno parla allora parlo io...
  rand_msg $1 | .timerRANDMSG 0 60 rand_msg $unsafe($1)
}
alias -l bot_stop { .timerBOTSTART off | .timerRANDMSG off }
alias -l rand_msg {
  var %colors 2,3,4,5,6,7,8,9,10,11,12,13, %cc $chr(3)
  var %rc $gettok(%colors,$rand(1,$numtok(%colors,44)),44)
  var %file addons\miefrasibot\frasibot.txt
  var %file1 $+($file(%file).path,$file(%file).name,1,.txt)
  var %rn $rand(1,$lines(%file)), %str $read(%file,nt,%rn)
  .write $+(-dl,%rn) %file | .write -i $qt(%file1) %str
  if ($lines(%file) == 0) { .remove $qt(%file) | .rename $qt(%file1) $qt(%file) }
  msg $1 $+(%cc,%rc,%str,%cc)
}


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

Link Copied to Clipboard