mIRC Home    About    Download    Register    News    Help

Print Thread
#269337 01/09/21 11:18 AM
Joined: Sep 2021
Posts: 3
T
Self-satisfied door
OP Offline
Self-satisfied door
T
Joined: Sep 2021
Posts: 3
My server have a samove-command, that I would like to implement into a script where I can rightclick a user and type in the moveto-channel

I've written both a sajoin and sapart without problems, but
.sajoin:/sajoin $* $$?="Move to:"
.sapart:/sapart $* # See you later, Alligator!


My trouble starts when I get three inputs; nick, fromchan and tochan

The excisting command (that works if I type it in) is /samove username fromchan tochan


I'm on a little bit deep water here, but I've tried: .samove:/samove $1 $chan $* $$?="Move to:"
..but obviously it isnt right.

Does anyone know how to solve it?

thexplorer #269338 01/09/21 04:37 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
.samove:/samove $* $chan $$?="Move to:"


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
thexplorer #269339 01/09/21 07:37 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
While debugging a script, it's usually helpful to use an echo until you have it correct, then remove the echo as the last step. Either an additional debug message above the command being used, or as a replacement. Your example isn't working because you usually don't want to use $1 and $* at the same time. $* means to repeat the command for each token in the $1- string, and in this context the $1 and $2 etc are filled by having more than 1 nick highlighted.

Note that $2 is filled only in the command and not in the menu label, so if you have a line in your menu popup like

Code
test $1 and $1- : echo -a $1 and $1-

... and then highlight 2-or-more nicks, the echo shows $1- is filled with the list of all the nicks that are highlighted, but the menu label only recognizes the $1 portion. So you need an echo to see the entire $1-
You can't use $* in your menu label either

Also, you might want to consider using $input(prompt,e,window title) instead of using $$?="prompt" because $input is easier to read and understand, as well as gives you additional features options not listed here.

Here in this example I fill $1 $2 $3 with 3 nicks so you can see how the echo repeats:

Code
//tokenize 32 nick1 nick2 nick3 | echo -a samove $* $chan $$?="Move to:"

samove nick1 #ThisChan #newchan
samove nick2 #ThisChan #newchan
samove nick3 #ThisChan #newchan

So you can make your menu command like this, noting that your label containing $1 $2 or $1- is limited to showing only the $1 portion of $1- and $2 $3 etc are not filled.

Code
bad
.samove $1-:/samove $1 $chan $* $$?="Move to:"
good
.samove $1-:/samove $* $chan    $$?="Move to:"

or replace the $$? with $input(Move to:,e,any window title)

Wims #269343 02/09/21 09:21 PM
Joined: Sep 2021
Posts: 3
T
Self-satisfied door
OP Offline
Self-satisfied door
T
Joined: Sep 2021
Posts: 3
Thank you!

Could I ask what if I want to have a .samove #test:/ ..... which move a user directly to #test without any input-box?

maroon #269344 02/09/21 09:23 PM
Joined: Sep 2021
Posts: 3
T
Self-satisfied door
OP Offline
Self-satisfied door
T
Joined: Sep 2021
Posts: 3
Thank you for the long explanation

I'll definitely take a closer look at this. I cant say that I understood it immediately, so I need to sit down when I got time smile

thexplorer #269347 03/09/21 08:33 PM
Joined: Jan 2012
Posts: 299
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
Probably the question is related to the command provided by the module for InspIRCd: https://github.com/inspircd/inspircd-contrib/blob/master/3.0/m_samove.cpp

The correct syntax would be: "/SAMOVE <nick> <channel1> <channel2> [reason]" ➔ [reason] - unknown if this optional parameter might work in your version of the module.

Originally Posted by thexplorer
What if I want to have a .samove #test:/ ..... which move a user directly to #test without any input-box?

In this case, the command for the nickname list menu should look like this: ".samove #test: /samove $* $chan #test".

This command will move all selected users in the list of nicknames of the open channel to another channel, which you yourself specify in your menu.
It is as if you were executing two commands at the same time: "/SAPART" and "/SAJOIN". Note: Such commands are only available to users with IRCop rights.



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

Link Copied to Clipboard