Interesting, looks like v1 should be avoided in most cases?
When I test Obelisk Rune option (script 35, option 43) on the official scenario Heroes of Might Not Magic (SoD map), there were several ERM error popping out, saying x coordinate was not right.
The code:
Code:
!?PI;
!!UN:P43/?y-1; [Check if script is enabled: y-1]
!!FU&y-1<>1:E; [Exit if script isn't enabled]
!!UN:U57/-1/?y-2; [Number of Obelisks on map: y-2]
!!VRv1:S-1; [Initialize v1 to -1 to work with new faster UN:U syntax]
!!DO5312/1/y-2/1&y-2>0:P; [Loop through all Obelisks to set spell]
!?FU5312;
!!UN:U57/-1/-1/1; [Store next Obelisk coordinates in v1/v2/v3]
!!FU$spell$:P0/0/1/0/1/0; [Determine random non-banned Adventure Spell number: y-99]
!!IF:M^%v1, %v2, %v3, %v4^;[For TESTING]
!!POv1/v2/v3:Sy-99; [Set spell number (S) to y-99 -- will be -1 if all spells banned]
Looks fine to me at the first glance. However, the value returned of v1 was
47379860.
Any idea why this happened?
It was an easy fix after I figure out v1 was the issue. Used v2 instead and everything's fine again.