D0: Item ID. Use a negative value for a counter ID.
D1: Counter minimum if D0 is < 0.
D2: Door direction to open. Uses standard direction values (see std_constants.zh)
Code:
ffc script OpenShutters
{
void run(int itm, int quantity, int direction)
{
bool do_open;
while(1)
{
if ( itm < 0 ) //counter
{
if ( Game->Counter[itm*-1] >= quantity )
{
do_open = true;
}
}
else if ( itm > 1 && itm < 256 )
{
if ( Link->Item[itm] )
{
do_open = true;
}
}
if ( do_open )
{
Screen->Door[direction] =D_OPEN;
Game->PlaySound(SFX_SHUTTER);
this->Data = 0; Quit();
}
Waitframe();
}
}
}