import "std.zh"ffc script One {
void run() {
Game->SetScreenD(Game->GetCurScreen()+1, 1, 1);
}
}
ffc script Two { //for the screen right of One
void run() {
if (Screen->D[1] == 1) Game->PlaySound(SFX_PICKUP);
}
}
For these scripts, the call to PlaySound will never happen.
Something which I also suspect, but haven't confirmed, is that...
Screen->D[1] == Game->GetScreenD(Game->GetCurScreen(), 1)
...will sometimes be false.
Well, GetCurScreen() returns the index of the current screen in the current map, whereas Set/GetScreenD() takes the index of the screen in the current dmap.
As far as I know there isn't a method to return the screen index in the current dmap, though one might be useful.
So, how exactly would I write ffscript One without using Game->GetCurScreen()?
Assuming you don't know ahead of time which screens will contain the FFCs? It's ugly, but here's my solution:
import "std.zh"//Note that this script is *catastrophic* if run on the last screen of a dmap!
ffc script One {
void run() {
int oldval = Screen->D[0];
int testvalue = Rand(10000);
Screen->D[0] = testvalue;
int i=0;
while(Game->GetScreenD(i++, 1) != testvalue);
Screen->D[0] = oldval;
Game->SetScreenD(i, 1, 1);
}
}
ffc script Two { //for the screen right of One
void run() {
if (Screen->D[1] == 1) Game->PlaySound(SFX_PICKUP);
}
}
Bottom line: we need a method GetCurDMapScreen().