GDevelop
GDevelop copied to clipboard
Unify variable instructions and handle local variables
Changes
- Merged from 6 condition and 7 action to 1 condition and 1 action:
- global or scene variable
- string, number and boolean
- Merged from 3 conditions and 4 actions to 1 condition and 1 action:
- object variable
- string, number and boolean
- Instruction for string, number and boolean are actually 3 instructions but the editor switch them according to the chosen variable type
- Variables need to be declared following the same logic as the new expression syntax.
- Local variable can be declared on events
- Extensions still only see old instructions
Out of scope
- Declare a scene/global/object variable from an expression field.
- Drag and drop local variables from one event to another
- Select and delete local variables direcly from the event sheet
- Edit local variables with floating fields direclty from the event sheet
- Scroll and focus on the variable name field when openning the variable editor
- Warn about variables overlapping another one from a wider scope
- Suffix identical labels with the path difference in instruction search results
- Declare local variables on any kind of event?
- Implicitly convert numbers to strings in expressions
- Extensions own variables
- https://github.com/4ian/GDevelop/pull/6557
- Make "For each children" loop accept global variables
- Replace scene variable parameters in other instructions
Demo
- TestAnyVariable.zip
- https://github.com/GDevelopApp/GDevelop-examples/pull/643
This command can help to migrate a project (which is not mandatory to do).
You will still have to:
- Update/Reinstall the extensions because they can not use them yet (or revert the changes with git, they are at the end of the file)
- Declare the variables with the right type (or use a local variable)
- Optionally remove Variable() and GlobalVariable()
- Optionally replace variable toggle actions
sed -i 's/"VarScene"\|"VarGlobal"/"NumberVariable"/g ; s/"VarSceneTxt"\|"VarGlobalTxt"/"StringVariable"/g ; s/"SceneVariableAsBoolean"\|"GlobalVariableAsBoolean"/"BooleanVariable"/g ; s/"ModVarScene"\|"ModVarGlobal"/"SetNumberVariable"/g ; s/"ModVarSceneTxt"\|"ModVarGlobalTxt"/"SetStringVariable"/g ; s/"SetSceneVariableAsBoolean"\|"SetGlobalVariableAsBoolean"/"SetBooleanVariable"/g ; s/"SceneVariableChildCount"\|"GlobalVariableChildCount"/"VariableChildCount"/g ; s/"VariableChildExists"\|"GlobalVariableChildExists"/"VariableChildExists2"/g ; s/"VariableRemoveChild"\|"GlobalVariableRemoveChild"/"RemoveVariableChild"/g ; s/"VariableClearChildren"\|"GlobalVariableClearChildren"/"ClearVariableChildren"/g ; s/"SceneVariablePush"\|"GlobalVariablePush"/"PushVariable"/g ; s/"SceneVariablePushNumber"\|"GlobalVariablePushNumber"/"PushNumber"/g ; s/"SceneVariablePushString"\|"GlobalVariablePushString"/"PushString"/g ; s/"SceneVariablePushBool"\|"GlobalVariablePushBool"/"PushBoolean"/g ; s/"SceneVariableRemoveAt"\|"GlobalVariableRemoveAt"/"RemoveVariableAt"/g ; s/"VarObjet"/"NumberObjectVariable"/g ; s/"VarObjetTxt"/"StringObjectVariable"/g ; s/"ObjectVariableAsBoolean"/"BooleanObjectVariable"/g ; s/"ModVarObjet"/"SetNumberObjectVariable"/g ; s/"ModVarObjetTxt"/"SetStringObjectVariable"/g ; s/"SetObjectVariableAsBoolean"/"SetBooleanObjectVariable"/g ; s/"ObjectVariablePushNumber"/"PushNumberToObjectVariable"/g ; s/"ObjectVariablePushString"/"PushStringToObjectVariable"/g ; s/"ObjectVariablePushBool"/"PushBooleanToObjectVariable"/g' project.json