The
short list of ref manipulation can be seen here: http://geck.gamesas.com/index.php/Reference_variables.
That didn't stop me also experimenting with casting int's to ref's and vice versa though

I think 'myref == 0' is a special case.
Assigning 0 is a valid way to clear a ref, so 0 probably acts as a ref in that context.
If the rhs was +ve then it may do an integer comparison. (so the ref will always be 0 when cast to int)
My guess is irrelevant though as it we couldn't change that even if we wanted to.
I was experimenting with a view of adding mod compatibility without having to include the foriegn mod as a dependency.
ie. We can look at some foreign mods FormID's, and if we could use casting then we could calculate the ID on-the-fly with NVSE.
Adding ref2int would be fairly straightforward I think, (just clone GetModIndex without the bitshift).
I then started to write how I'd use the new function in GECK scripting, and decided that just that one function would lead to kludgy code if there were many ref's to calc.
So had a little brainstorming new functions with a view of submitting an nvse patch eventually... but that probably will never happen. I'd forgotten all about it until this thread lol.
Spoiler int iModBaseint iItemref rObj;Adding a single itemif IsModLoaded "OtherMod.esp" set iModBase to GetModIndex "OtherMod.esp" set iModBase to LeftShift iModBase 24 set iItem to LogicalOr iModebase 123 set rObj to Int2Ref iItem if IsFormValid rObj if IsReference rObj == 0 ListAddForm MyForm rObj endif endifendif;Adding a few itemsif IsModLoaded "OtherMod.esp" set iModBase to GetModIndex "OtherMod.esp" set iModBase to LeftShift iModBase 24 set iItem to LogicalOr iModebase 123 set rObj to Int2Ref iItem rObj.ListAddRef TempForm set iItem to LogicalOr iModebase 456 set rObj to Int2Ref iItem rObj.ListAddRef TempForm Label 1 if ListGetCount TempForm set rObj to ListRemoveNth TempForm 0 if IsFormValid rObj if IsReference rObj == 0 ListAddForm MyForm rObj endif endif Goto 1 endifendif;Adding *lots* of items (this is where Ref2Int would be handy)if IsModLoaded "OtherMod.esp" set iModBase to GetModIndex "OtherMod.esp" set iModBase to LeftShift iModBase 24 set rObj to Int2Ref 123 rObj.ListAddRef TempForm set rObj to Int2Ref 456 rObj.ListAddRef TempForm set rObj to Int2Ref 789 rObj.ListAddRef TempForm Label 1 if ListGetCount TempForm set rObj to ListRemoveNth TempForm 0 set iItem to Ref2Int rObj set iItem to LogicalOr iItem iModebase set rObj to Int2Ref iItem if IsFormValid rObj if IsReference rObj == 0 ListAddForm MyForm rObj endif endif Goto 1 endifendif;Adding *lots* of items (this is where ListAddInt & ListRemoveNthInt would be handy)if IsModLoaded "OtherMod.esp" set iModBase to GetModIndex "OtherMod.esp" set iModBase to LeftShift iModBase 24 ListAddInt TempForm 123 ListAddInt TempForm 456 ListAddInt TempForm 789 Label 1 if ListGetCount TempForm set iItem to ListRemoveNthInt TempForm 0 set iItem to LogicalOr iItem iModebase set rObj to Int2Ref iItem if IsFormValid rObj if IsReference rObj == 0 ListAddForm MyForm rObj endif endif Goto 1 endifendif
I don't know if adding int's to formlists is feasable but there have been dozens of times I wished for numerical arrays while coding.