mIRC Home    About    Download    Register    News    Help

Print Thread
identifier $input #267358 12/06/20 10:36 PM
Joined: Jul 2014
Posts: 182
TECO Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Jul 2014
Posts: 182
Hi
I need your help people. I want to put first one IF the input is not filled and the OK button is pressed, return the following input "you must fill in the field". I put it like this:

Code

 var %x = $$input(Enter an exclude in nick!ident@host format!,evu,Add)
 if (%x == $null) && (%x != $false) { return $input(You need to fill in the field!,io,Info) }
 elseif (*!*@* !iswm %x) { errdialog You have to enter an exclude in nick!ident@host format! }
 elseif ($hget(pexclude,%x)) { errdialog You already added this exclude! }


But I do not want that when the Cancel button is pressed the input appears and I am not getting it.

Is there a way to solve it?

Last edited by TECO; 12/06/20 10:42 PM.

TECO
irc.PTirc.org (Co-Admin)
Re: identifier $input [Re: TECO] #267359 12/06/20 10:59 PM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
Use the 'f' switch, if ok is pressed, you'll get the content as usual, but if cancel or no is pressed, you'll get $cancel or $no (plain text)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: identifier $input [Re: TECO] #267360 13/06/20 05:16 AM
Joined: Jan 2004
Posts: 1,328
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,328
It appears the 'v' switch has no effect in combo with the 'e' switch. I can't get there to be any difference in clicking with an empty editbox on yes/no/cancel:

//echo -a $input(test,evn)

I dunno if that's 'by design' or something that could be added by a feature request. Obviously there's no reason for the 'yes' button to return $true when there's an editbox, but there could be use cases where clicking on no or cancel would behave the same as if typing $false or $cancel into the editbox then clicking yes.

But also, in your example you're using the double dollar, so that's going to halt rather than setting %x to null.

Re: identifier $input [Re: maroon] #267361 13/06/20 08:59 AM
Joined: Jul 2014
Posts: 182
TECO Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Jul 2014
Posts: 182
I understand what you mean, but in the context I want, I only want to have an input with just two buttons. OK and Cancel. So thanks anyway.


TECO
irc.PTirc.org (Co-Admin)
Re: identifier $input [Re: TECO] #267362 13/06/20 08:59 PM
Joined: Jul 2014
Posts: 182
TECO Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Jul 2014
Posts: 182
I found the solution wink

Thanks Wims for the tip.

Code
 var %x = $input(Enter an exclude in nick!ident@host format!,euf,Add)
 if (%x == $null) && (%x != $false) { return $input(You have to fill out editbox!,iuo,Info) }
 elseif (%x == $false) { $null }
 elseif (*!*@* !iswm %x) { errdialog You have to enter an exclude in nick!ident@host format! }
 elseif ($hget(pexclude,%x)) { errdialog You already added this exclude! }
 else {
    hadd pexclude %x 1
    hsave -ob pexclude $_tabdir(pexclude.tbl)
    did -a $dname 2 %x
    did -e $dname 6
  }

Last edited by TECO; 13/06/20 10:40 PM.

TECO
irc.PTirc.org (Co-Admin)