mIRC Home    About    Download    Register    News    Help

Print Thread
Variable-Token-Dialog Problem #78698 09/04/04 10:47 PM
Joined: Feb 2004
Posts: 33
M
masterofpuppets Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
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
}


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
Re: BlackList #78699 09/04/04 11:16 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
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)


billythekid
Re: BlackList #78700 09/04/04 11:24 PM
Joined: Feb 2004
Posts: 33
M
masterofpuppets Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Yes. It adds it to the list. But it doesn't add it to the variable!


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
Re: BlackList #78701 09/04/04 11:28 PM
Joined: Dec 2002
Posts: 102
M
MIMP Offline
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 102
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.


-
MIMP
Re: BlackList #78702 09/04/04 11:39 PM
Joined: Feb 2004
Posts: 33
M
masterofpuppets Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
... 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?


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
Re: BlackList #78703 09/04/04 11:45 PM
Joined: Feb 2004
Posts: 33
M
masterofpuppets Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
Also, billythekid, that script only deletes the top item on the list. Not the selected one.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
Re: BlackList #78704 10/04/04 02:06 AM
Joined: Feb 2004
Posts: 33
M
masterofpuppets Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
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.


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!