mIRC Homepage
Posted By: masterofpuppets Variable-Token-Dialog Problem - 09/04/04 10:47 PM
I am building a black-list system. I use a variable for the nicks and a dialog to add stuff. I have used didtok to return the data of the variable on init. But I don't know how to add or remove the data with an edit box and 2 buttons. The ID for the editbox is 2. The ID for the Add data button is 3 and the one to remove data is 5. I need to know how to add and remove data in the variable with those objects. This is the code so far:
Code:
;Annoyance.Inc BlackList
;Version 0.1
;MoP

Dialog shitlist {
  Title "Annoyance.Inc Black-List"
  Size -1 -1 475 341
  Box "BlackList", 1, 335 33 133 264, 
  Edit "Nickname", 2, 343 270 73.489932885906 20, 
  Button "+", 3, 421 270 20 20, 
  List  4, 342 51 117 213, 
  Button "-", 5, 444 270 20 20, 
  Button "OK", 6, 379 305 89 23,OK
  Box "Settings", 7, 8 33 287 264, 
  Icon 8, 60 -3 370 36, $scriptdir/img/inclogo.bmp
  Check "Enable", 9, 30 61 89 13, 
  Text "Black-Listed Message:", 10, 30 99 110.738255033557 15, 
  Edit "", 11, 143 96 89.5973154362416 19, 
}

alias shitlistconfig {
  dialog -m shitlist shitlist
}

on 1:dialog:shitlist:init:*: {
  //didtok shitlist 4 32 %shitlist
}
Posted By: billythekid Re: BlackList - 09/04/04 11:16 PM
use something like:
Code:
on 1:dialog:shitlist:sclick:*:{
if $did == 3 { did -a shitlist 4 $did(shitlist,2) }
elseif $did == 5 { did -d shitlist 4 $did(shitlist,4,0).sel }
}
  

i think thats what you want, apologies if i missed the point! ;o)
Posted By: masterofpuppets Re: BlackList - 09/04/04 11:24 PM
Yes. It adds it to the list. But it doesn't add it to the variable!
Posted By: MIMP Re: BlackList - 09/04/04 11:28 PM
Usually what I do is have it trigger based on the sclick event on the OK button (this way if they hit cancel instead it won't change it.) If it's a tokenized string you'd just $addtok() the value you pull from $did($dname,4) or do another new $didtok() on it.
Posted By: masterofpuppets Re: BlackList - 09/04/04 11:39 PM
... and how do i do that?

I am quite new to dialogs. So I'm not all up on stuff like tokens. Can you give me an example?
Posted By: masterofpuppets Re: BlackList - 09/04/04 11:45 PM
Also, billythekid, that script only deletes the top item on the list. Not the selected one.
Posted By: masterofpuppets Re: BlackList - 10/04/04 02:06 AM
Ok. I got the adding of nicks to the variable working. Now I need a way of removing them from the variable and I also need a way of changing the message and setting the enable box to actually ENABLE it. I also need a way for it to keep the settings afterwards.
© mIRC Discussion Forums