13m. text
14n. debug commands
14n1. help
- 14n2. stop
+ 14n2. resume
14n3. quit
14n4. save
15o. Save format
CAN be embedded. So this is valid:
if selected == 2
- if previous >= 5
- text 'You win!'
- fi
- if previous <= 5
- text 'You lose!'
- fi
+ if previous >= 5
+ text 'You win!'
+ fi
+ if previous <= 5
+ text 'You lose!'
+ fi
fi
The behavior of VNDS would be to 'if previous <= 5' on
failure of selected == 2 This is really not proper:
-I keep an if-count instead of an in-if value.
+vnds just jumps. I keep an if-count instead of
+an in-if bool value.
= 6f. ================================================
My implementation provides an extra form of jump:
- jump script line
+ jump script [line]
Which goes directly to line in the file. This
-is utilized for saving.
+is utilized for saving. As such, you can't
+turn off that extension. Period.
= 8h. ================================================
setvar and gsetvar are used to set variables. gsetvar
specifically sets the 'global' state, that is, common
-to all saves.
+to all saves. In my implementation - that is moot.
+Thus, gsetvar just calls setvar.
[g]setvar var mod value
setvar ~ ~
-Which means reset all vars.
+Which means reset all vars. This ignores globals -
+e.g. prefixed with a lowercase 'g'.
+
+As well, my extension provides the ability to set
+a variable to another variable.
+
+ [g]setvar var op var2
+
+Again, this only works in extensions mode.
= 12l. ===============================================
I've implemented a few extensions that help generally
with NVL games.
- --- - At the beginning of a line,
+ --- - At the beginning of a line,
clears before text output.
- " - More on this once finished.
- Will stop any previous sfx
- if encountered. 'smart'
- voice stop.
+ " - In the sound function
+ if lookahead finds a text
+ with quotes, it's assumed
+ that sound is a voice and
+ linked to the text. AKA
+ smart voice stopping.
= 14n. ===============================================
The console should now prompt you with this;
[scr command] $
-You can enter any command above; I recommend against
-entering choice, since it can't possibly work in
-this mode. if may also not work as expected.
+You can enter any command above; Some won't work
+right. choice, if, and jump probably won't work
+properly.
No commands run in this state will advance the
program, but flags set will affect it.
= 14n2. ==============================================
-stop will disable debugging and kill the console.
-You can SIGINT again at any point to come back
-to the debug state.
+resume (renamed from stop) will disable debugging
+and kill the console. You can SIGINT again at any
+point to come back to the debug state.
= 14n3. ==============================================
void op_delay(int* frames);
void op_fi();
void op_gsetvar(char* var, int *modifier, char *value);
-void op_if(char* var, int* op, int* val);
+void op_if(char* left, int* op, char* right);
void op_music(char* file);
void op_random(char* var, int* low, int* high);
void op_setimg(char* file, int* x, int* y);
else if(!strcmp(tokens[2], ">="))
value_1 = 5;
- sscanf(tokens[3], "%d", &value_2);
- op_if(tokens[1], &value_1, &value_2);
+ op_if(tokens[1], &value_1, tokens[3]);
}
else if(!strcmp(tokens[0], "fi"))
op_fi();
if(!strcmp(buffer, "help") || strlen(buffer) < 1) {
printf("%s\n", "Commands available:");
- printf("\t%s\t\t\t%s\n", "(debug) stop", "Stops debug mode");
+ printf("\t%s\t\t\t%s\n", "(debug) resume", "Stops debug mode");
printf("\t%s\t\t\t%s\n", "(debug) quit", "Quits game");
printf("\t%s\t\t%s\n", "(debug) save [file]", "Saves immediately to file");
printf("\t%s\t%s\n", "setvar [var] [mod] [val]", "Set save flag");
GetData()->ctx->SetQuit();
DebugContinue = false;
}
- else if (!strcmp(buffer, "stop")) {
+ else if (!strcmp(buffer, "resume")) {
printf("[debug] Exiting debug shell and resuming.\n");
DebugContinue = false;
GetData()->wait_input = true;
line_copy[i] = '\0';
}
+ // The next line is null, because the file is finished.
+ if(feof(GetData()->accessScriptHandle) && strlen(GetData()->next_line) == 0) {
+ // We've reached EOF. Jump back and return.
+ op_jump(GetData()->main_scr[0], NULL, true);
+ }
+
GetData()->next_line = (char*)calloc(sizeof(char), 400);
fgets(GetData()->next_line, 400, GetData()->accessScriptHandle);
// Load the next line.
- // The next line is null, because the file is finished.
- if(feof(GetData()->accessScriptHandle) && strlen(GetData()->next_line) == 0) {
- // We've reached EOF. Jump back and return.
- op_jump(GetData()->main_scr[0], NULL, true);
- }
-
return;
}
* ('<=':0 '<':1 '==':2 '!=':3 '>': '>=':5)
*/
-void op_if(char* var, int* op, int* val) {
+void op_if(char* left, int* op, char* right) {
if (GetData()->if_fail != 0) {
GetData()->if_fail += 1;
return;
}
- int var_val = GetData()->s_flags[0][std::string(var)];
+ int r_val = 0, ret = 0;
+
+ ret = sscanf(right, "%d", &r_val);
+
+ if(ret == 0 && GetData()->vndc_enabled) { // This is a var name. We couldn't scan a number.
+ r_val = GetData()->s_flags[0][std::string(right)];
+ }
+
+ int l_val = GetData()->s_flags[0][std::string(left)];
//printf("op_if(%s, %d, %d)\n", var, op[0], val[0]);
//printf("GetData()->s_flags[0][%s] = %d\n", var, GetData()->s_flags[0][std::string(var)]);
switch (op[0]) {
case 0:
- if ( !(var_val <= val[0]) )
+ if ( !(l_val <= r_val) )
GetData()->if_fail += 1;
break;
case 1:
- if ( !(var_val < val[0]) )
+ if ( !(l_val < r_val) )
GetData()->if_fail += 1;
break;
case 2:
- if ( !(var_val == val[0]) )
+ if ( !(l_val == r_val) )
GetData()->if_fail += 1;
break;
case 3:
- if ( !(var_val != val[0]) )
+ if ( !(l_val != r_val) )
GetData()->if_fail += 1;
break;
case 4:
- if ( !(var_val > val[0]) )
+ if ( !(l_val > r_val) )
GetData()->if_fail += 1;
break;
case 5:
- if ( !(var_val >= val[0]) )
+ if ( !(l_val >= r_val) )
GetData()->if_fail += 1;
break;
}