zarqon
Well-known member
Make to_int(<type>) and to_<type>(int) consistently reversible for all possible types
Presently, there are integers associated with most of the ASH plural typed constants, as revealed by to_int():
to_int(item) : yes
to_int(location) : no
to_int(monster) : no
to_int(element) : yes
to_int(familiar) : yes
to_int(skill) : yes
to_int(effect) : yes
to_int(stat) : yes
to_int(class) : yes
to_int(coinmaster) : no
to_int(phylum) : yes
So, aside from locations, monsters, and coinmasters, all the ASH typed constants have associated integers. Where associated integers exist, I think most scripters would expect casting functions to exist in both directions. However, this is not consistently the case:
to_item(int) : yes
to_element(int) : no
to_familiar(int) : yes
to_skill(int) : yes
to_effect(int) : yes
to_stat(int) : no
to_class(int) : no
to_phylum(int) : no
So, I am requesting that to_<type>(int) be made to work for elements, stats, classes, and phyla. I had actually used some of these functions, assuming that since to_int(type) worked that to_type(int) would work as well, but my integers were evidently being silently cast to strings, causing the functions to always return $type[none] -- and confusing me greatly until I realized what was going on.
Presently, there are integers associated with most of the ASH plural typed constants, as revealed by to_int():
to_int(item) : yes
to_int(location) : no
to_int(monster) : no
to_int(element) : yes
to_int(familiar) : yes
to_int(skill) : yes
to_int(effect) : yes
to_int(stat) : yes
to_int(class) : yes
to_int(coinmaster) : no
to_int(phylum) : yes
So, aside from locations, monsters, and coinmasters, all the ASH typed constants have associated integers. Where associated integers exist, I think most scripters would expect casting functions to exist in both directions. However, this is not consistently the case:
to_item(int) : yes
to_element(int) : no
to_familiar(int) : yes
to_skill(int) : yes
to_effect(int) : yes
to_stat(int) : no
to_class(int) : no
to_phylum(int) : no
> ash foreach i in $elements[] print(to_int(i)+" : "+i)
1 : cold
2 : hot
3 : sleaze
4 : spooky
5 : stench
6 : slime
Returned: void
> ash to_element(3)
Returned: none
So, I am requesting that to_<type>(int) be made to work for elements, stats, classes, and phyla. I had actually used some of these functions, assuming that since to_int(type) worked that to_type(int) would work as well, but my integers were evidently being silently cast to strings, causing the functions to always return $type[none] -- and confusing me greatly until I realized what was going on.