-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
10220 - Control Variables New Entry: GetTime #3124
base: master
Are you sure you want to change the base?
Conversation
Hmmm, I didn't tested the pull request, though I think that having the possibility to directly have a way to get these info is a really good idea. Though, while I know that in terms of writing the format of a command, you may be limited by how the Maniac patch allows you to write things, but wouldn't it make more sense to extend the Control Variables command instead of creating a new command for that? I think it would be a weird thing to create a command just for that instead of extending the Control Variables command, which would allow a bit more possibilities, as well as not creating thousands of commands each time a new command to get a value is created. |
It would be harder to create and maintain commands, since neither vanilla nor maniacs have a way to allow this type of change on a pre existing command. The user would have to edit a xml version of his map or ldb, then editing the command on any way would break it. I could rename this command to xtraVariable to attach more other interesting data to it. |
Just use EasyRPG Editor for this? 😅 Also, should be possible to patch this in. Cherry has added a lot of functionality through binary patches in the official editor. |
Having an unfinished editor just for command snippets sounds worse than using The editor is not fully usable rn, we would have to work on it for 2 or 3 years to have it fully working, and let the CU community use it.
Again, we already have have maniacs patch IMHO, We should bring users of different patches closer to easyRPG, instead of creating more and more alternatives to tweak the editor. The common response for asking for new features was "no, wait for the editor". |
Gets current date information and attach it to a variable. Usage: ```js @raw 2054, "Type_of_Date", targetVar_IsVar, targerVat ``` ```js // "set year to variable 1:" @raw 2054, "getYear", 0, 1 // "set month to variable 2:" @raw 2054, "getMonth", 0, 2 // "set day to variable 3:" @raw 2054, "getDay", 0, 3 // "set hour to variable 4:" @raw 2054, "getHour", 0, 4 // "set minute to variable 5:" @raw 2054, "getMinute", 0, 5 // "set second to variable 6:" @raw 2054, "getSecond", 0, 6 // "set day of week to variable 7:" @raw 2054, "getWeekDay", 0, 7 // "set days in year to variable 8:" @raw 2054, "getYearDay", 0, 8 ```
608b0dd
to
1daf444
Compare
There are valid concerns raised if this should be part of the "Control Variables" command. I will check first if there is a non-shitty way to achieve this currently... With lcf2xml for sure but most are using this closed source TPC thing. |
All I can think is whitelisting some of DynRPG commands to work even without it enabled. |
With that Suggested boilerplate: diff --git a/src/game_interpreter.cpp b/src/game_interpreter.cpp
index c0c1aa9ec..02c6af39d 100644
--- a/src/game_interpreter.cpp
+++ b/src/game_interpreter.cpp
@@ -1250,6 +1250,26 @@ bool Game_Interpreter::CommandControlVariables(lcf::rpg::EventCommand const& com
// Expression (Maniac)
value = ManiacPatch::ParseExpression(MakeSpan(com.parameters).subspan(6, com.parameters[5]), *this);
break;
+ case 200: { // EasyRPG Command
+ auto cmd_size = com.parameters.size();
+ int op, subop;
+ int arg1 = 0;
+ int arg2 = 0;
+ if (cmd_size >= 7) {
+ op = com.parameters[5];
+ subop = com.parameters[6];
+ if (cmd_size >= 8) {
+ arg1 = com.parameters[7];
+ }
+ if (cmd_size >= 9) {
+ arg2 = com.parameters[8];
+ }
+ value = ControlVariables::EasyRpgCommand(op, subop, arg1, arg2);
+ } else {
+ value = 0;
+ }
+ break;
+ }
default:
Output::Warning("ControlVariables: Unsupported operand {}", operand);
return true;
diff --git a/src/game_interpreter_control_variables.cpp b/src/game_interpreter_control_variables.cpp
index d8c0590dd..903970038 100644
--- a/src/game_interpreter_control_variables.cpp
+++ b/src/game_interpreter_control_variables.cpp
@@ -488,3 +488,24 @@ int ControlVariables::Divmul(int arg1, int arg2, int arg3) {
int ControlVariables::Between(int arg1, int arg2, int arg3) {
return (arg1 >= arg2 && arg2 <= arg3) ? 0 : 1;
}
+
+int ControlVariables::EasyRpgCommand(int op, int subop, int arg1, int arg2) {
+ (void)arg1;
+ (void)arg2; // Remove when args are used
+
+ enum class Op {
+ GetDate = 0
+ };
+
+ switch (static_cast<Op>(op)) {
+ case Op::GetDate:
+ switch (subop) {
+ case 0: // TODO
+ break;
+ };
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+}
diff --git a/src/game_interpreter_control_variables.h b/src/game_interpreter_control_variables.h
index a534b83b7..1fcbc717f 100644
--- a/src/game_interpreter_control_variables.h
+++ b/src/game_interpreter_control_variables.h
@@ -45,6 +45,7 @@ namespace ControlVariables {
int Muldiv(int arg1, int arg2, int arg3);
int Divmul(int arg1, int arg2, int arg3);
int Between(int arg1, int arg2, int arg3);
+ int EasyRpgCommand(int op, int subop, int arg1, int arg2);
}
#endif |
Implemented changes you guys asked in a straight forward way, since controlVariables doesn't care about strings at all... It works fine with Maniacs @raw command, but It's impossible to edit and looks ugly AF: that will be solved once we implement #3137, The code will look like: |
This one was requested a lot by the Creative Unconscious devs,
They want to include special events related to christmas date or other holydays:
10220 - Control Variables New Entry: GetTime
Gets current date information and attach it to a variable.
Usage: