A simple error I think. Things in containers/inventory aren't references, but base objects. GetObjectType can be called on either references or objects, and you're using the reference syntax with a ref variable holding a base obejct. Change the line to "set itemtype to getobjecttype itemref" and it should work.
new misinterpretation also known as I am still messing up
PrintToConsole "%n is a Type %.0f item", itemref, itemtype set effecttype to GetNthEffectItemCode itemref 1 PrintToConsole "%n has %.0f effect", itemref, effecttype
result
Gold Dust is a Type 25 item.................... alchemy
Gold dust has 1413567044 effect.................??? was trying for the 4 letter code that alchemy ingredients have in each tier.
here I was trying for the novice effect, obviously, doing something wrong. I need to learn more, but appreciate the help, the other GetNth... commands were for active magic items and such, not sure which actually applies
tested effectype with %c, %n, %g, and %.0f