mIRC Home    About    Download    Register    News    Help

Print Thread
#162664 21/10/06 10:18 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
var %email = $input(Enter email, qe, email, email), %p = $input(password, pqe, enter password)

if i click the cance button on email, how do i get it to shop showing the input for password

Last edited by pouncer; 21/10/06 10:18 AM.
#162665 21/10/06 10:31 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Code:
var %email = $input(...)
if (* iswm %email) {
  ; verify if entered email has correct syntax 
  ; ask for password
  var %p = $input(...)
}
else {
  ; no email was entered, take necessary steps
}



Gone.
#162666 21/10/06 10:47 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
thanks, didn't work though, when i click cancel it still goes to the password box

the email input box has a default value of 'email' in it

i thought i might need to use $true or $false to show the cancel button has been clicked

#162667 21/10/06 10:59 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
There is no way that it asked for the password if you used my code exactly as it is above.

It will only ask your password if you clicked OK, not if you click Cancel, because when you click cancel, the input like you have it returns nothing ($null) so the if (* iswm %email) check is $false, which means it jumps to the else part where I didn't put any code.

Code:
alias test {
  var %email = $input(Enter email, qe, email, email)
  if (* iswm %email) {
    ; verify if entered email has correct syntax 
    ; ask for password
    var %p = $input(password, pqe, enter password)
    echo -a Email: %email -- Password: %p
  }
  else {
    ; no email was entered, take necessary steps
    echo -a No email was entered
  }
}

/test

Using mIRC 6.2 btw.


Gone.
#162668 21/10/06 11:45 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
ok, sorted it, thanks alot.

#162669 21/10/06 07:19 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
you can also use $?*="Title" to have it return ******* for your password


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#162670 21/10/06 07:23 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
It already works like that. The 'p' flag in $input() enables the password chars.

#162671 22/10/06 10:25 AM
Joined: Oct 2004
Posts: 73
M
Babel fish
Offline
Babel fish
M
Joined: Oct 2004
Posts: 73
Code:
var %email =  [color:red]$[/color]$input(Enter email, qe, email, email), %p = $input(password, pqe, enter password) 

#162672 22/10/06 11:33 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That would not only stop the current code without warning, but also any other code where his alias was called from, in case cancel was pressed (or nothing entered).

In other words, hardly good advice.


Gone.
#162673 22/10/06 01:35 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Agreed. I'd take a large script that reports errors to me over a small script that gives me no feedback any day.

#162674 23/10/06 10:06 AM
Joined: Oct 2004
Posts: 73
M
Babel fish
Offline
Babel fish
M
Joined: Oct 2004
Posts: 73
Sorry, I didn't check that pressing cancel on an $$input doesn't cause code after an :error in the alias to be executed. Is there a reason why it shouldn't?

#162675 23/10/06 04:55 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I don't think you understand the usage of $$.

When an identifier starts with $$ rather than $, it means the running script (and any higher level code from which this script is called) will halt completely if the identifier returns $null. If you press cancel on the $$input that asks for an email, the identifier returns $null, so this code stops immediately (think of it like a /halt is inserted at the code where you have the indentifier with $$)

To answer your question: why doesn't it jump to the :error label? Well why should it? No mIRC error occured, so there's no reason to jump to the error label.

$$ has its usages, though in a case like this, it's clearly a better option to let the script handle it when an email was not supplied (like echoing a message about missing email, and taking some other steps) than to simply have the entire script halted without a warning whatsoever from the script.


Gone.
#162676 24/10/06 08:13 AM
Joined: Oct 2004
Posts: 73
M
Babel fish
Offline
Babel fish
M
Joined: Oct 2004
Posts: 73
Thank you for that explanation. The /halt analogy works for me smile


Link Copied to Clipboard