1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
void ReadScript(int WhichScript)
{
bool Started = false;
bool InCondition = false;
fpos_t pos;
char temp[500];
sprintf(temp, "Script/%d%s", WhichScript, ".jrpscript");
myScriptFile[WhichScript] = fopen(temp, "r");
if (myScriptFile[WhichScript])
{
char YO[50];
while (feof(myScriptFile[WhichScript]) == false || strcmp(YO ,"Stop") == 0)
{
fscanf(myScriptFile[WhichScript], "%s", &YO);
if (strcmp(YO , "Start") == 0)
{
Started = true;
}
else if (strcmp(YO, "If") && Started == true)
{
fscanf(myScriptFile[WhichScript], "%s", &YO);
fgetpos (myScriptFile[WhichScript],&pos);
fscanf(myScriptFile[WhichScript], "%s", &YO);
if (strcmp(YO, "And") == 0)
{
fscanf(myScriptFile[WhichScript], "%s", &YO);
InCondition = true;
}
else
{
fsetpos(myScriptFile[WhichScript], &pos);
}
}
else if (strcmp(YO, "EndIf") == 0)
{
InCondition = false;
}
}
fclose(myScriptFile[WhichScript]);
}
}
|