mIRC Home    About    Download    Register    News    Help

Print Thread
#13600 28/02/03 07:35 PM
Joined: Feb 2003
Posts: 20
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Feb 2003
Posts: 20
i need to rest my brain
what am i doing wrong here? thanks

Code:
alias setup {
  if (%nick == $null) || (%pass == $null) {
    :start
    set %nick $?="Enter your normal NickName"
    set %pass $?*="Enter your Password"
    echo -a Setup Completed!
    goto end
    else {
      echo $?!="Your pass and nick are already set $crlf $+  Do u wish to change them?"
      if ($result == $true) goto start
    }
    :end
  }
}

#13601 28/02/03 07:48 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Modifying just the code you posted, rather than rewriting it the way I think is best:
Code:

alias setup {
  if (%nick == $null) || (%pass == $null) {
    :start
    set %nick $?="Enter your normal NickName"
    set %pass $?*="Enter your Password"
    echo -a Setup Completed!
    goto end
  }
  else {
    var %x = $?!="Your pass and nick are already set $crlf $+  Do u wish to change them?"
    if ($result == $true) goto start
  }
  :end
}

However, I'd suggest splitting that into 2 aliases, one that checks and one that sets. Also, I'd suggest that you use $input() over $?. And finally, I'd suggest that you put the newly set values into temp variables so you can test to see if they have entered nothing and then decide what to do if they have.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#13602 28/02/03 08:09 PM
Joined: Feb 2003
Posts: 20
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Feb 2003
Posts: 20
thanks! if u know of a better way go ahead and rewrite it if u dont mind

#13603 01/03/03 06:26 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
$result is irrelevent here, I think tenbucks meant $!.

And why not get rid of this goto mess:
Code:
alias setup {
  if %nick == $null || %pass == $null || $?!="Your pass and nick are already set $crlf $+  Do u wish to change them?" {
    set %nick $$?="Enter your normal NickName"
    set %pass $$?*="Enter your Password"
    echo -a Setup Completed!
  }
}


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard