|
Joined: Oct 2005
Posts: 827
Hoopy frood
|
OP
Hoopy frood
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.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
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.
|
|
|
|
Joined: Oct 2005
Posts: 827
Hoopy frood
|
OP
Hoopy frood
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
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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. 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.
|
|
|
|
Joined: Oct 2005
Posts: 827
Hoopy frood
|
OP
Hoopy frood
Joined: Oct 2005
Posts: 827 |
ok, sorted it, thanks alot.
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
you can also use $?*="Title" to have it return ******* for your password
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
It already works like that. The 'p' flag in $input() enables the password chars.
|
|
|
|
Joined: Oct 2004
Posts: 73
Babel fish
|
Babel fish
Joined: Oct 2004
Posts: 73 |
var %email = [color:red]$[/color]$input(Enter email, qe, email, email), %p = $input(password, pqe, enter password)
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Oct 2004
Posts: 73
Babel fish
|
Babel fish
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?
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
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.
|
|
|
|
Joined: Oct 2004
Posts: 73
Babel fish
|
Babel fish
Joined: Oct 2004
Posts: 73 |
Thank you for that explanation. The /halt analogy works for me
|
|
|
|
|