Originally Posted by
Dimentio
Step 1: Be using the lens
Step 2: Use another item that has an item script
Step 3: Watch as the item script that is supposed to run will repeatedly run every single/other frame until you stop using the lens
Basically, the lens is like a machine gun, only with scripts. Any item that has an item script will have it's item script be run repeatedly and rapidly if you use the item while you have the lens on until you turn off the lens. Tested in both Zodiac: Story of the Guardian and Link's Quest for the Hookshot 2. Only tested with swords that have an item script so far. Could someone please test if this is the case for other item types besides sword?
I'll check it tomorrow, however, there was another rapid-fire bug related to swords, and items that had a magic cost, that caused them to repeatedly act, that was fixed in 2.50.3 Evan reported that one, and "Saffith fixed it, so this may have been fixed at that time.
No, this is clearly still a bug. I do not know how it went unnoticed for three years, but it certainly is a thing. It might stem from this code which is shared between the lens code, and items running scripts:
Code:
if(dowpn>-1 && itemsbuf[dowpn].script!=0 && !did_scripta && checkmagiccost(dowpn))
{
ZScriptVersion::RunScript(SCRIPT_ITEM, itemsbuf[dowpn].script, dowpn & 0xFFF);
did_scripta=true;
}
Ah, I think that I see it.
Code:
ZScriptVersion::RunScript(SCRIPT_ITEM, itemsbuf[dowpn].script, dowpn & 0xFFF);
When the item script runs, it sets dowpn to its ID, and then the lens begins running the script from another item.
Verified. This is indeed the problem. Tentatively fixed, although my fix allows the lens to run its script every frame. I believe that this was the original intent. ???
This is the change, in Link.cpp:
Code:
if(isWpnPressed(itype_lens) && !LinkItemClk() && !lensclk && checkmagiccost(itemid))
{
if(lensid<0)
{
lensid=itemid;
if(get_bit(quest_rules,qr_MORESOUNDS)) sfx(itemsbuf[itemid].usesound);
}
paymagiccost(itemid);
if(itemid>=0 && itemsbuf[itemid].script != 0 && !did_scriptl)
{
ZScriptVersion::RunScript(SCRIPT_ITEM, itemsbuf[itemid].script, itemid & 0xFFF);
did_scriptl=true;
}
lensclk = 12;
}
I will push this after I clean up my master repo and apply the change there, too.
Pull requests 118 and 119 resolve this for master, and for 2.50.x, respectively.