mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2021
Posts: 119
Simo Online OP
Vogon poet
OP Online
Vogon poet
Joined: Nov 2021
Posts: 119
Greetings gentz,

I am wondering if this alias could be changed to have a popup to ask for permission to change the topic wich is took when we execute /top #channel some topic here , so when we reply with yes in the popup it goes ahead and changes the topic we already gave it with the: /top #channel some topic here, if that is possible.

here is what we work with :
Code

alias top { 
  var %chan = $active | if (%chan !ischan) { echo -stac own This command can only be used on a channel. | halt }
  if (!$1 || $chr(35) !isin $1) { topic %chan  }
  elseif ($nick(%chan,$me,~&@) || o isin $usermode ) { topic %chan $$?="Your topic here" }
}



Thanks in advance,

Joined: Jan 2012
Posts: 323
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 323
I have made changes to the script code you provided so that it does what you request.

Try using this variant:
Code
alias top {
  if ($active !ischan) { echo -sac own This command can only be used on a channel. | return }  
  if ($1 == -v) { if ($chan($active).topic) topic $active | else { echo -sac own No topic. } }
  elseif ($1 == -r && $nick($active,$me,~&@) && $chan($active).topic) { 
    if ($?!="Are you sure you want to remove the channel topic?") { topic -r $active }
  }
  elseif ($nick($active,$me,~&@)) { 
    var %newtopic $$?="Enter your channel topic:"
    if ($?!="Are you sure you want to change the channel topic?") { topic $active %newtopic }
  }
}


Available commands:

  • Call a pop-up window for entering a new topic in the active channel window: /top
  • View topic in active channel window: /top -v
  • Remove topic in the active channel window: /top -r



🕮 Also useful information to study: https://en.wikichip.org/wiki/mirc/identifiers/$%3F


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Nov 2021
Posts: 119
Simo Online OP
Vogon poet
OP Online
Vogon poet
Joined: Nov 2021
Posts: 119
Thanks Epic that seems to work as desired.

Joined: Jan 2012
Posts: 323
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jan 2012
Posts: 323
I found a few minor oversights that were causing incorrect behavior, so I decided to update the previous script code.
Additionally, you can now directly add text next to a command, or still use just one command to trigger the popup for text entry.

  • Syntax: /top [-vr] [text]
  • Example: /top my new channel topic


Try using this variant:
Code
alias top {
  if ($active !ischan) { echo -ac own This command can only be used on a channel. | return }  
  if ($1 == -v) { if ($chan($active).topic) { topic $active } | else { echo -ac own No topic. } }
  if ($1 == -r && $chan($active).topic && $nick($active,$me,~&@) && $popup_remove) { topic -r $active }
  if (!$istok(-v -r,$1,32) && $nick($active,$me,~&@)) { 
    if ($1) { var %newtopic $1- } | else { var %newtopic $popup_enter }
    if (%newtopic && $popup_change) { topic $active %newtopic }
  }
}
alias -l popup_enter { return $$?="Enter your channel topic:" }
alias -l popup_change { return $?!="Are you sure you want to change the channel topic?" }
alias -l popup_remove { return $?!="Are you sure you want to remove the channel topic?" }


🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Nov 2021
Posts: 119
Simo Online OP
Vogon poet
OP Online
Vogon poet
Joined: Nov 2021
Posts: 119
excellent thanks epic


Link Copied to Clipboard