mIRC Homepage
Posted By: synth7 How to make dialogs..work - 12/11/05 01:15 PM
I have an away script I wrote, and right now the config area is in the code itself, so anyone I gave it to would have to go to the Script Editor to change settings, which is a bit overwhelming for some people.

Here is my code now
(the dialog is question is at the very bottom)

I've got the Configuration window designed and all (it's in there named away_config_main), but I have no idea how to go about making it change and save the settings when I change them in the dialog. And even though it does 99% of the time, the /help files simply aren't working for me on this one. Any example code to show me how to do it would be great.

~ synth7

EDIT___________________________

I got this far, sort of, for changing whether the away script will change the users nick based on if they have the box checked or not.

Code:
on *:DIALOG:away_config_main:sclick:1: {
  if ($away.chgnick == 1) {
    did -c away_config_main 1 
  }
}
Posted By: nycdiesel Re: How to make dialogs..work - 12/11/05 02:33 PM
Something like this would do:

Code:
dialog away_config_main {
  title "Away Script Config"
  size -1 -1 102 132
  option dbu
  check "Change nick on away?", 1, 5 6 91 10
  text "Default away reason:", 2, 5 22 82 8
  edit "", 3, 5 31 92 29
  text "Default away reason:", 4, 5 68 82 8
  edit "", 5, 5 77 92 29
  button "Save and OK", 6, 59 113 37 12, ok
  button "Cancel", 7, 18 113 37 12, cancel
} 

on *:dialog:away_config_main:init:*:{
  if (%away.chg_nick) did -c $dname 1
  if (%away.reason_msg) did -a $dname 3 $ifmatch
  if (%away.reason_msg2) did -a $dname 5 $ifmatch
}

on *:dialog:away_config_main:sclick:6:{
  %away.chg_nick = $iif($did($dname,1).state,1,0)
  if ($did($dname,3).text) %away.reason_msg = $ifmatch
  if ($did($dname,5).text) %away.reason_msg2 = $ifmatch
}


If you need a detailed explanation, just ask smile
© mIRC Discussion Forums