|
Joined: Dec 2002
Posts: 15
Pikka bird
|
OP
Pikka bird
Joined: Dec 2002
Posts: 15 |
heres parts of a dialog i made:
button "Add", 6, 220 30 23 12
button "Remove", 7, 220 45 23 12
edit "", 21, 122 20 95 10
list 22, 122 32 95 34, size vsbar
}
on *:dialog:blaway:sclick:6: { did -a $dname 22 $did(21) | did -r $dname 21 }
on *:dialog:blaway:sclick:7: { did -d $dname 22 $did($dname,22).sel }
this is part of an away script it adds reasons to the list box How would i go about somehow saving the list, so that next time i open the dialog, its still there in the list box ? Would i have to add and remove them from a txt file as i click the add and remove buttons, or is there a way to directly load up the list.
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
on *:dialog:blaway:init:0:{
var %line = 1
while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
did -a $dname 22 $eval(% $+ blawayl $+ %line,2)
inc %line
}
}
on *:dialog:blaway:close:0:{
var %line = 1
while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
unset $eval(% $+ blawayl $+ %line)
inc %line
}
var %line = 1
while ( $did(blaway,22,%line).text != $null ) {
set %blawayl $+ %line $did($dname,22,%line).text
inc %line
}
}
|
|
|
|
Joined: Dec 2002
Posts: 15
Pikka bird
|
OP
Pikka bird
Joined: Dec 2002
Posts: 15 |
that didnt work i made sure i had no other on *:dialog:blaway:init: or on *:dialog:blaway:close: commands and it still didnt work would there be any other way to go about it ?
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
I tested it on a fresh install of mIRC, worked fine. Some reasons why it wouldn't work is an outdated mIRC or not using "/dialog -m blaway blaway" to make the dialog. The other ways of doing it would be putting while or goto loops in aliases and using the alias every time you opened/closed the dialog, but that is just a different way of writing the same thing. No idea why it doesn't work for you, hopefully someone else can help Here is the entire script I used: dialog blaway {
title "blaway"
size -1 -1 223 145
option dbu
list 22, 5 25 100 100
}
on *:dialog:blaway:init:0:{
var %line = 1
while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
did -a $dname 22 $eval(% $+ blawayl $+ %line,2)
inc %line
}
}
on *:dialog:blaway:close:0:{
var %line = 1
while ( $eval(% $+ blawayl $+ %line,2) != $null ) {
unset % $+ blawayl $+ %line
inc %line
}
var %line = 1
while ( $did(blaway,22,%line).text != $null ) {
set %blawayl $+ %line $did($dname,22,%line).text
inc %line
}
}
|
|
|
|
Joined: Dec 2002
Posts: 15
Pikka bird
|
OP
Pikka bird
Joined: Dec 2002
Posts: 15 |
ok i wen through my hole script i had an extra "}" b4 the script start so it was stuffing it up but now if i remove a reason form the list box the next time i open it its still there
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
Dunno why that is, it shouldn't happen because all variables are unset and then set again when you close it. Works for me, very odd, and annoying,..
|
|
|
|
Joined: Dec 2002
Posts: 15
Pikka bird
|
OP
Pikka bird
Joined: Dec 2002
Posts: 15 |
im using 6.03 so i dunno... ill fiddle around with it
thanks a bunch mate
|
|
|
|
Joined: Dec 2002
Posts: 699
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 699 |
on *:dialog:blaway:init:*:{
if ($exists(blawaybuf.txt)) loadbuf -o $dname 22 blawaybuf.txt
}
on *:dialog:blaway:close:*:{
savebuf -o $dname 22 blawaybuf.txt
}
|
|
|
|
Joined: Dec 2002
Posts: 15
Pikka bird
|
OP
Pikka bird
Joined: Dec 2002
Posts: 15 |
that works perfectly thanks
|
|
|
|
Joined: Dec 2002
Posts: 580
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 580 |
Besides using loadbuf, also check out /didtok and $didtok
|
|
|
|
|