First, keep in mind that there are multiple menus you can use. You can have the channel one appear only in the channel and the "other" appear somewhere else (status, query, etc). So you don't necessarily have to put both in the same menu and you don't necessarily have to include the channel name if you're separating them. That's entirely up to you, of course.

Second, $N's are not filled from $?="" in that way. You will need to either fill $N's using /tokenize or else store the information in variables to use a second time (in the notice). For example, tokenize the two inputs and then use $1 and $2 in both the services command and the notices command. The problem with using $N with tokenize to fill them is that someone might enter invalid information in the inputs - something with spaces - and that will cause problems. You would probably be better off just storing the two inputs into variables and then you can only take the first "word" from each to avoid that kind of problem. To kind of explain what I mean, think what would happen if someone entered "this is my nick" into the nick input. You then use "/notice this is my nick you are now a SOP". That notice is going to be sent to "this" and the message will be "is my nick you are now a SOP". Definitely a potential problem. If this is just for your personal use, then you don't need to worry about that, but if you want to share it, you should try to avoid situations where a user can mess things up.

Third, your .'s represent the level of the menu/submenu. Your "title" of Add/Delete Owners is currently on the same level as the sub items. They really should be on separate levels if you use a "title" or heading.

It can also be very useful to use aliases when you are doing a similar thing more than once. Here's just an example of one way you could do this. Note that if you want to include a delete command, it can be added just like the Add command.

Code:
menu channel {
  Add/Delete Owners
  .Add Owners:AddOwner $chan $$?="Enter Nick:"
}
menu status {
  Add/Delete Owners
  .Add Owners:AddOwner $$?="Enter Room:" $$?="Enter Nick:"
}
menu nicklist {
  Add/Delete Owners
  .Add Owners:AddOwner $$?="Enter Room:" $$1
}

alias AddOwner {
  Services SOP $iif($left($1,1) == #,$1,#$1) ADD $2
  .notice $2 You are now a SOP in $iif($left($1,1) == #,$1,#$1)
}


Now, again, that doesn't consider the possibility of someone entering multiple words in the inputs and that can cause problems. But it's not too much work to avoid that if you are going to share the script with others. You would just want to decide whether you want to only use the first "word", if you want to remove spaces, or if you want to throw an error if multiple "words" are used. Based on that choice, you can prevent the potential problem with a couple minor changes.

Notice with this option that I have 3 separate menus:
  • Right clicking in the channel, where you know $chan, but do not know $nick, so you ask for it.
  • Right clicking in status, where you don't know $chan or $nick.
  • Right clicking on a nick, where you know $nick, but may or may not know $chan (depending if the nick is clicked in the channel or in query), so you play it safe and ask for the channel. $1 would be the $nick when right clicking on a nick, so that's why you see it there.


Then, all 3 send 2 pieces of information to the alias... $chan and $nick. $chan becomes $1 and $nick becomes $2 in the alias.

Notice the $iif($left($1,1) == #,$1,#$1) parts in the alias. This makes it so the user can enter the channel with and without the # character and it will end up with just one # character when done. If you force a # character (#$$?="Enter Room:") and the user enters #channel, then you end up with ##channel. And, if you don't do anything, channel remains channel. By using $iif(), we can guarantee #channel regardless of the user entering #channel or channel.

Last edited by Riamus2; 13/08/11 02:30 AM.

Invision Support
#Invision on irc.irchighway.net