mIRC Homepage


Posted By: thexplorer

samove - 01/09/21 11:18 AM

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?
Posted By: Wims

Re: samove - 01/09/21 04:37 PM

.samove:/samove $* $chan $$?="Move to:"
Posted By: maroon

Re: samove - 01/09/21 07:37 PM

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

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:

//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.

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

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

Re: samove - 02/09/21 09:21 PM

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?
Posted By: thexplorer

Re: samove - 02/09/21 09:23 PM

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
Posted By: Epic

Re: samove - 03/09/21 08:33 PM

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.

© 2022 mIRC Discussion Forums