Use `with_mapping_count` instead of pack and `list.length`

* Fixes script errors anytime section tree is rendered
Merge pull request #1229 from reciprocity/hotfix/fix-section-script-error

Hotfix: Use `with_mapping_count` instead of pack and `list.length`