mIRC Home    About    Download    Register    News    Help

Print Thread
#199251 11/05/08 05:08 PM
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
I don't want the if-then-else statement to execute if either or both or there are $true ('set abc $true'). Technically neither will be '$true' at the same time. I unset the variables at the end of the execution, so they are $null (not 0 or false). So the only way I could get this to work was if I checked for a negative $null:

abc= $null (was unset at the end of it's routine)
cbs = $true (is set to $true before this routine)

if (!abc = $null) || (!%cbs = $null) {
...
}

Is there a better way to do this? Should I not unset vars (causes a $null), but change them to 'set %abc 0'?


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

This would check if either variable is set with any value

if ((%abc != $null) || (%cbs != $null)) {

This would check if either variable is set with any value except $null $false or 0

if ((%abc) || (%cbs)) {

This would check if either variable is set only with $true

if ((%abc == $true) || (%cbs == $true)) {

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Looks like I got it to work with 'if (!(%abc == $null) || (%cbs = $null)) { ...'

Hum... well now it's not working again. ???


I registered; you should too.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Sorry, I misread your original post. Try this.

if ((%abc != $true) && (%cbs != $true)) {

This will not execute if either variable is set to $true. With this you could either unset the variables or set them to anything except $true.

You could also try this

if ((%abc != $null) || (%cbs != $null)) {

This would trigger if either variable is set with any value at all.

Last edited by RoCk; 11/05/08 05:34 PM.
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Thanks, that seems to have fixed it.


I registered; you should too.

Link Copied to Clipboard