[color:000080]Strategy[/color]Let's assume for the sake of this example (since you didn't say which ID was the listbox) that your listbox ID is 10 and that you have added these skills separated by a space $chr(
32) as suggested earlier. You can use:
[*]
$gettok( [color:#840017]value, 1, 32)[/color] returns the
1st Skill in
value[*]
$gettok( [color:#840017]value, 2, 32)[/color] returns the
2nd Skill in
value[*]
[*]
[*]
[*]
$gettok( [color:#840017]value, N, 32)[/color] returns the
Nth Skill in
valuewhere
value is your
$hget(CharSheet,Skill).
All you have to do is use a loop index like
%i in place of the
1 in
$gettok( [color:#840017]value, 1, 32)[/color]. You start
%i at
1 and let it increment
%i until it runs out of Skills in
value to add to the listbox.
[color:000080]Script[/color]
on *:DIALOG:sheet:init:0:{
var [color:#000080]%i[/color] = 1
while ([color:#800090]$gettok( [color:#840017]$hget(CharSheet,Skill)[/color], [color:#000080]%i[/color], [color:#006600]32[/color])[/color]) {
did -a $dname 10 $ifmatch
inc [color:#000080]%i[/color]
}
}
[color:000080]Colors[/color]The garish colors were to help you track which numbers mean what in which positions throughout.
[color:000080]Listbox[/color]I used a listbox rather than a series of editboxes for simplicity. A listbox is much better suited to this kind of task than is an editbox where the skill would be "editable," which is not, I think, what you had in mind.
One of the drawbacks is that you might end up with more skills than you have editboxes, whereas with a listbox, you can just keep adding till you add them all. If you wanted to, you could display Option settings for each skill that change as you sclick on each item in the listbox, perhaps disabling some enabling others, filling the appropriate controls with the data that's appropriate for that Skill.
If you really do want to use an editbox, then you will need an outer loop to loop through a tokenized list of editbox control IDs, such as 20:22:24:26:29:30:32:34:36 ... again, using $gettok to loop through each.