refactor np scripting: extract non-template into .cpp, better include handling