Custom grid view I added, doesn't show up in the grid view window. I created a new "custom" named gridview that never appears to be edited, which means I have to recreate it everytime. The grid view name also doesn't appear in the list of gridviews next to the add button
fixed in the update today
Yeah, I've failed miserably to add a custom scripted role. It would be nice if I could add a scripted role when: defining the grid view and adding a scripted role. Instead I have to jump into the right .ini file and make changes... and even when I think I make the right changes, I don't see the script showing as a role to add...
if you don't know what you're doing, you really shouldn't edit the ini directly. you can edit your script in the custom role editor. once you've added a custom role, it will be available as a column to add to any custom views, just like any other column.
argh...I don't know what I'm fucking up, but here is my script that does show in the grid view but as nan (albeit the prior mentioned bugs)
//highest weapon, axedwarf (38), speardwarf (43), hammerdwarf (42), swordsdwarf (39), macedwarf (41), knife user (40)
var skills = new Array(d.skill_level(38,false,true), d.skill_level(39,false,true), d.skill_level(40,false,true), d.skill_level(41,false,true), d.skill_level(42,false,true), d.skill_level(43,false,true));
//skills.sort();
skills.reverse();
skills[0];
this isn't going to do what you want. you should have just used the code i sent you in the pm. reverse simply reverses the values in the array, it's not sorted in any way doing this. furthermore, i already sent you better code with a function to sort it with a comparison function, which is a better solution.
//highest weapon, axedwarf (38), speardwarf (43), hammerdwarf (42), swordsdwarf (39), macedwarf (41), knife user (40)
var skills = {
new Array(d.skill_level(43,false,true));
skills.sort();
skills.reverse();
skills[0]
};
this also isn't going to work, because you're attempting to assign the entire script as a variable, of an array type, with code statements as the values.
read the documentation on the qscript language, it's very similar to javascript. edit the
custom role from the menu, and add this into the script section:
function float_desc(a,b) {return a < b ? 1 : a > b ? -1 : 0;}
var skills = new Array(d.skill_level(38,false,true), d.skill_level(43,false,true), d.skill_level(42,false,true), d.skill_level(39,false,true), d.skill_level(41,false,true), d.skill_level(40,false,true));
skills.sort(float_desc);
skills[0] <= 0 ? 0 : skills[0] / 20 * 100;
the first line declares a function to use for comparison. the second line loads an array of the melee skills, with interpolated values. the next line sorts the array with the comparison function from the first line. finally the first item (highest skill) of the array is checked for negatives, and if it's a positive value, returns a percent as the rating for the role.