mIRC Home    About    Download    Register    News    Help

Print Thread
#102647 11/11/04 01:11 PM
Joined: Nov 2004
Posts: 12
M
myrddin Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Nov 2004
Posts: 12
Let me start out by showing you the stuff
Code:
menu channel,status {

¤ BotServ
.Botlist:bs botlist
.-
.Assign:bs ASSIGN $chsrv(Channel name. Leave blank for [ # ] ) $$?="Name of bot:" | erase
.UnAssign:bs UNASSIGN $chsrv(Channel name. Leave blank for [ # ] ) | erase
.-

That is just part of the BotServ portion of my popup script.

And for the aliases:
Code:
alias question { 
  set %temp.question $?=" $+ $1- $+ "
  if (%temp.question != $null) { return %temp.question }
  else { return $false }
  unset %temp.*
}

alias chsrv {
  %temp.chsrv = $?" $+ $1- $+ "
  if (%temp.chsrv == $null) { set %temp.chsrv $active }
  if ($chr(35) !isin %temp.chsrv) { %temp.chsrv = $chr(35) $+ %temp.chsrv | return %temp.chsrv }
  else { return %temp.chsrv }
  unset %temp.*
}

alias check if ($left($1,1) != $chr(35)) { return $chr(35) $+ $1- } | else { return $1- }

alias erase {
  if (%temp.chsrv != $null) { .timer 1 1 unset %temp.chsrv }
  if (%temp.question != $null) { .timer 1 1 unset %temp.question }
}


The problem is, whenever I unassign a bot, or do something similar with this script, even if I press cancel on the dialog box, it runs the command anyway as if I didn't type anything in the window, and pressed ok. frown
I want it to not run the command if I press cancel.

The tricky part is that I also want to be able to not type a channel in the dialog box, and have it fill in the current active channel for me, like it's doing now.

Any help is greatly appreciated smile

#102648 11/11/04 07:45 PM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Your best bet would be to use $$input($1-,e,,$active) where it adds $active to the prompt's editbox as the default value so pressing OK immediately would have the same desired effect. The double $ makes the script halt if the identifier returns $null

Either that, or you'd have to create a custom modal dialog called through $dialog that returns values more precisely than $? or $input. With the latter two identifiers, $null is returned both when null input is given and when cancel is clicked so it seems to be impossible to distinguish

#102649 11/11/04 10:50 PM
Joined: Nov 2004
Posts: 12
M
myrddin Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Nov 2004
Posts: 12
I tried making a custom dialog. But like you said, it would return null either way.

I'll try your other suggestion. If anyone else has any ideas, lemme know.
Thanks

EDIT: Thanks! It works great.
I think I'll stick with this, but if anyone still wants to comment about this, feel free to do so.

Last edited by myrddin; 11/11/04 10:54 PM.

Link Copied to Clipboard