mIRC Home    About    Download    Register    News    Help

Print Thread
#10554 11/02/03 12:25 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
ok i am having troble with this coding it sets the %away.nick but it wont set the other 2 wtf??????
Code:
on *:DIALOG:away:sclick:56: {
  if ($did(away,18) == $null) { .dialog awayerr error1 }
  elseif ($did(away,7) != $null) { .set %away.nick $did(away,7) }
  elseif ($did(away,9) != $null) { .set %away.back $did(away,9) }
  elseif ($did(away,18) != $null) { .set %away.reason $did(away,18) }
}


Need amazing web design for low price: http://www.matrixn3t.net
#10555 11/02/03 12:54 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Perhaps use if instead of elseif?

#10556 11/02/03 01:30 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
ok i fixed that tid bit but now i am having a new problem with the radios when ever i click on the radios and then ok it dosnt save it right what i want it to do is -

when u click on, Pager on it sets the var to 1 and if u click off then ok it sets it to 0

and save this so when i come back it sets it so it is the opposite of the other e.g. 1=off 0=on

click on On:set to 1
click on Off:set to 0

so when i come back it says the script is on and running but the radio says off so when i click on Off it turns off the script

(i tried to make it as clear as possible)
i tried to make this coding as clean as possible :tongue:
Code:
on *:DIALOG:away:sclick:56: {
  if ($did(away,7) == $null) { .set %err1 You made an error in the Away Nick Edit Box. | .dialog -m awayerr error1 | halt }
  if ($did(away,9) == $null) { .set %err1 You made an error in the Return Nick Edit Box. | .dialog -m awayerr error1 | halt }
  if ($did(away,18) == $null) { .set %err1 You made an error in the Reason Edit Box. | .dialog -m awayerr error1 | halt }
  if ($did(away,7) != $null) { .set %away.nick $did(away,7) }
  if ($did(away,9) != $null) { .set %away.back $did(away,9) }
  if ($did(away,18) != $null) { .set %away.reason $did(away,18) | .ame is away because, %away.reason $+ , Logging: [ $+ %away.logging $+ ] Pager: [ $+ %away.pager $+ ] | .amsg To conntact me type /ctcp $me pager <message> | .nick %away.nick | .timer1 0 300 .ame is away because, %away.reason $+ , Logging: [ $+ %away.logging $+ ] Pager: [ $+ %away.pager $+ ] }
  if (%away.pager == 0) { .set %away.pager 1 }
  if (%away.pager == 1) { .set %away.pager 0 }
  if (%away.logging == 0) { .set %away.logging 1 }
  if (%away.logging == 1) { .set %away.logging 0 }
}

Last edited by ATMA; 11/02/03 01:42 AM.

Need amazing web design for low price: http://www.matrixn3t.net
#10557 11/02/03 01:53 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
I don't understand why would you like to set opposite values, but anyway, the last 4 lines need to be looking like:
Code:

if (%away.pager == 0) { set %away.pager 1 }
else { set %away.pager 0 }
if (%away.logging == 0) { set %away.logging 1 }
else { set %away.logging 0 }

or in short
Code:

set %away.pager $iif(%away.pager == 1,0,1)
set %away.logger $iif(%away.logger == 1,0,1)

The reason why else is required instead of another if, is because of the way if-then-else works.

If, for example, %away.pager is set to 0, both if (%away.pager == 0) and if (%away.pager == 1) will be executed, as the first statement sets it to 1 before moving to the next one, and you'll end up with the same value.

Again, else would solve it.

#10558 11/02/03 05:10 AM
Joined: Jan 2003
Posts: 94
S
Babel fish
Offline
Babel fish
S
Joined: Jan 2003
Posts: 94
and even with that you can sorten it down...
$iif(%away.logger == 1,0,1)
could be
$iif(%away.logger,0,1)

since your only dealing with 0 1


-
E-Mail: mirc_sabby@hotmail.com
Network: irc.enterthegame.com
Channel: #Helpdesk

Link Copied to Clipboard