mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2005
Posts: 19
W
Wishie Offline OP
Pikka bird
OP Offline
Pikka bird
W
Joined: Mar 2005
Posts: 19
Hello!

I've just started to script dialogs for my bot, and well.. I am stuck at how to set the value of a variable depending on whether a checkbox is checked or not.

This is the specific code I am trying to use to set %banprot to 1 if the checkbox with ID 4 is checked:
Code:
on *:dialog:config:sclick:4: {
  set %banprot 1
}


However, I have no idea whatsoever on how to make %banprot 0 if the checkbox stays unchecked.

Any help at all will be hugely appreciated! smile

Regards,
Wishie

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Hey, you could try something like..

Code:
On *:dialog:config:init:0: {
  $iif(%banprot == 1,did -c config 4)
}

On *:Dialog:config:sclick:4: {
  $iif($did(config,4).state == 0,set %banprot 0,set %banprot 1)
}


All the best,

-Andy.

Joined: Mar 2005
Posts: 19
W
Wishie Offline OP
Pikka bird
OP Offline
Pikka bird
W
Joined: Mar 2005
Posts: 19
Yippie-kay-yay! It's working. laugh

At first it interfered with one of my own scripts:
Code:
on *:dialog:config:*:*: {
  if ( $devent == init ) { 
    if ( %banprot == 1 ) {
      did -c config 4
    }
  }
}

And as long as I kept that, the script you mentioned wouldn't work. But as soon as I had removed my own, yours worked perfectly. Thanks a lot SladeKraven. smile

Regards,
Wishie

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You can change to what you originally had if you like.

You can accomplish this by doing..

Code:
on *:dialog:config:*:*: {
  if ( $devent == init ) { 
    $iif(%banprot == 1,did -c config 4)
  }
  if ( $devent == sclick) {
    if ($did == 4) { $iif($did(config,4).state == 0,set %banprot 0,set %banprot 1) }
  }
}


The code below will work just the same..

Code:
On *:dialog:config:init:0: {
  $iif(%banprot == 1,did -c config 4)
}

On *:Dialog:config:sclick:4: {
  $iif($did(config,4).state == 0,set %banprot 0,set %banprot 1)
}


It is entirely up to you which method you use. smile

All the best,

-Andy.

Joined: Mar 2005
Posts: 19
W
Wishie Offline OP
Pikka bird
OP Offline
Pikka bird
W
Joined: Mar 2005
Posts: 19
I'll just use what I've got at the moment, since I wouldn't want to change something that's working. smile Thanks for the additional information though!

Regards,
Wishie

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Hehehe, I guess you're right if it's working. You're welcome. smile


Link Copied to Clipboard