mIRC Home    About    Download    Register    News    Help

Print Thread
#210084 04/03/09 07:33 AM
Joined: Mar 2009
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Mar 2009
Posts: 3
so, i have a $submenu populated w/ a hash table filled with the levels of the network's anope levels list.
else { return $hget($network $+ .levels,$1).item $hget($network $+ .levels,$1).data : cs levels $chan set $hget($network $+ .botlist,$1).item $?="Enter new level:" }

the only problem is that when i right click, instead of the normal popup menu coming up, i get the question box $?="Enter new level:" and no matter what you click/how many times you click, it doesn't go away. is there a way to retrieve user input for a $submenu item?

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
CReate an alias that does what you need.

Code:
else return $hget($network $+ .levels,$1).item $hget($network $+ .levels,$1).data :cs_x $chan $hget($network $+ .botlist,$1).item

alias cs_x cs levels $1 set $2 $?="Enter new level:"

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
The submenu return is always evaluated, thus you're prompted for input the very moment you do the right-click.
You may prevent this pre-evaluation in the submenu definition like:
Code:
menu channel {
  TEST
  .$submenu($testsub($1))
}

alias -l testsub {
  if ($1 isnum 1-3) { return <your hget for menuitem> : .msg chanserv levels $!chan set <your hget for command> $$!?"Enter new level:" }
}
Note the exclamation mark in the $$!?"<prompt>" and in $!chan.
If you prefer the alias-method DJ_Sol suggested I *highly recommend* to add the exclamation mark to the $chan identifier (command part) there, or you'll end up evaluating possible channel names like "#$me" - and this is annoying at best, dangerous at worst.

Horstl #210102 04/03/09 07:38 PM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
DuH! Now why didn't I think of that. I would be much better to use Horstl's solution.

Joined: Mar 2009
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Mar 2009
Posts: 3
ah, thanks for your input!

Last edited by twilightNoir; 05/03/09 04:32 AM.

Link Copied to Clipboard