Skip to content

Commit 6589556

Browse files
authored
[Reviewed] [Variable copier] Copy structures between global, scene and local variables (#2064)
1 parent 4d5b26b commit 6589556

File tree

1 file changed

+72
-27
lines changed

1 file changed

+72
-27
lines changed

extensions/reviewed/ExtendedVariables.json

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,29 @@
11
{
22
"author": "@Bouh, D8H",
33
"category": "General",
4+
"dimension": "",
45
"extensionNamespace": "",
6+
"fullName": "Variables copier",
57
"gdevelopVersion": ">=5.5.222",
6-
"fullName": "Extended variables support",
78
"helpPath": "",
89
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZhcmlhYmxlLWJveCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xOSAzSDVDMy45IDMgMyAzLjkgMyA1VjE5QzMgMjAuMSAzLjkgMjEgNSAyMUgxOUMyMC4xIDIxIDIxIDIwLjEgMjEgMTlWNUMyMSAzLjkgMjAuMSAzIDE5IDNNNy40IDE4QzUuOSAxNi41IDUgMTQuMyA1IDEyUzUuOSA3LjUgNy40IDZMOSA2LjdDNy43IDcuOSA3IDkuOSA3IDEyUzcuNyAxNi4xIDkgMTcuM0w3LjQgMThNMTIuNyAxNUwxMS45IDEzTDEwLjUgMTVIOUwxMS4zIDExLjlMMTAgOUgxMS4zTDEyLjEgMTFMMTMuNSA5SDE1TDEyLjggMTJMMTQuMSAxNUgxMi43TTE2LjYgMThMMTUgMTcuM0MxNi4zIDE2IDE3IDE0LjEgMTcgMTJTMTYuMyA3LjkgMTUgNi43TDE2LjYgNkMxOC4xIDcuNSAxOSA5LjcgMTkgMTJTMTguMSAxNi41IDE2LjYgMThaIiAvPjwvc3ZnPg==",
910
"name": "ExtendedVariables",
1011
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/variable-box.svg",
11-
"shortDescription": "Check variable existence, copy, delete, and create dynamic variables at runtime.",
12-
"version": "1.0.4",
13-
"description": [
14-
"This extension provides: ",
15-
"- Conditions to check if a global/scene/object variable exists.",
16-
"- Actions to copy object variables, global and scene variables.",
17-
"- Actions to delete an existing global/scene variable from memory.",
18-
"- Actions to create a global/scene variable using a text expression, rather than a variable name input.",
19-
"- Expressions to get the value or text from a global/scene variable using a text expression, rather than a variable name.",
20-
"",
21-
"Text expressions allows to enter the name of the variable with an expression like `\"MyVar\"+ ToString(Variable(Health))`"
22-
],
12+
"shortDescription": "Copy structure and array variables.",
13+
"version": "1.1.0",
14+
"description": "Copy all the children of a structure or an array into another variable.",
2315
"origin": {
2416
"identifier": "ExtendedVariables",
2517
"name": "gdevelop-extension-store"
2618
},
27-
"tags": [
28-
"variable",
29-
"scene",
30-
"global",
31-
"object",
32-
"remove",
33-
"expression",
34-
"copy",
35-
"structure",
36-
"array",
37-
"boolean",
38-
"duplication"
39-
],
19+
"tags": [],
4020
"authorIds": [
4121
"2OwwM8ToR9dx9RJ2sAKTcrLmCB92",
4222
"IWykYNRvhCZBN3vEgKEbBPOR3Oc2"
4323
],
4424
"dependencies": [],
25+
"globalVariables": [],
26+
"sceneVariables": [],
4527
"eventsFunctions": [
4628
{
4729
"description": "Check if a global variable exists.",
@@ -107,6 +89,7 @@
10789
"functionType": "Condition",
10890
"group": "Global variables",
10991
"name": "GlobalVariableExist",
92+
"private": true,
11093
"sentence": "If the global variable _PARAM1_ exist",
11194
"events": [
11295
{
@@ -193,6 +176,7 @@
193176
"functionType": "Condition",
194177
"group": "Scene variables",
195178
"name": "SceneVariableExist",
179+
"private": true,
196180
"sentence": "If the scene variable _PARAM1_ exist",
197181
"events": [
198182
{
@@ -285,6 +269,7 @@
285269
"functionType": "Condition",
286270
"group": "Variables",
287271
"name": "ObjectVariableExist",
272+
"private": true,
288273
"sentence": "Object _PARAM1_ has object variable _PARAM2_",
289274
"events": [
290275
{
@@ -366,6 +351,7 @@
366351
"functionType": "Action",
367352
"group": "Global variables",
368353
"name": "DeleteGlobalVariable",
354+
"private": true,
369355
"sentence": "Delete the global variable _PARAM1_ from memory",
370356
"events": [
371357
{
@@ -432,6 +418,7 @@
432418
"functionType": "Action",
433419
"group": "Scene variables",
434420
"name": "ModifySceneVariableString",
421+
"private": true,
435422
"sentence": "Change the text of scene variable _PARAM1_ to _PARAM2_",
436423
"events": [
437424
{
@@ -465,6 +452,7 @@
465452
"functionType": "Action",
466453
"group": "Global variables",
467454
"name": "ModifyGlobalVariableString",
455+
"private": true,
468456
"sentence": "Change the text of global variable _PARAM1_ to _PARAM2_",
469457
"events": [
470458
{
@@ -580,6 +568,7 @@
580568
"functionType": "Action",
581569
"group": "Global variables",
582570
"name": "ModifyGlobalVariable",
571+
"private": true,
583572
"sentence": "Change the global variable _PARAM1_ with value: _PARAM2_",
584573
"events": [
585574
{
@@ -654,6 +643,7 @@
654643
"functionType": "Action",
655644
"group": "Scene variables",
656645
"name": "ModifySceneVariable",
646+
"private": true,
657647
"sentence": "Change the scene variable _PARAM1_ with value: _PARAM2_",
658648
"events": [
659649
{
@@ -722,6 +712,7 @@
722712
"functionType": "Action",
723713
"group": "Scene variables",
724714
"name": "DeleteSceneVariable",
715+
"private": true,
725716
"sentence": "Delete the scene variable _PARAM1_ from memory",
726717
"events": [
727718
{
@@ -964,6 +955,7 @@
964955
"functionType": "Action",
965956
"group": "Variables",
966957
"name": "DeleteObjectVariable",
958+
"private": true,
967959
"sentence": "Delete for the object _PARAM1_ the object variable _PARAM2_ from the memory",
968960
"events": [
969961
{
@@ -999,6 +991,7 @@
999991
"functionType": "StringExpression",
1000992
"group": "Global variables",
1001993
"name": "GlobalVariableString",
994+
"private": true,
1002995
"sentence": "",
1003996
"events": [
1004997
{
@@ -1034,6 +1027,7 @@
10341027
"functionType": "StringExpression",
10351028
"group": "Scene variables",
10361029
"name": "VariableString",
1030+
"private": true,
10371031
"sentence": "",
10381032
"events": [
10391033
{
@@ -1069,6 +1063,7 @@
10691063
"functionType": "Expression",
10701064
"group": "Global variables",
10711065
"name": "GlobalVariable",
1066+
"private": true,
10721067
"sentence": "",
10731068
"events": [
10741069
{
@@ -1104,6 +1099,7 @@
11041099
"functionType": "Expression",
11051100
"group": "Scene variables",
11061101
"name": "Variable",
1102+
"private": true,
11071103
"sentence": "",
11081104
"events": [
11091105
{
@@ -1137,8 +1133,9 @@
11371133
"description": "Copy the global variable to scene. This copy everything from the types to the values.",
11381134
"fullName": "Copy a global variable to scene",
11391135
"functionType": "Action",
1140-
"group": "Convert",
1136+
"group": "Copy variables",
11411137
"name": "CopyGlobalVariableToScene",
1138+
"private": true,
11421139
"sentence": "Copy the global variable:_PARAM1_ to a scene variable:_PARAM2_ (clear destination first: _PARAM3_)",
11431140
"events": [
11441141
{
@@ -1183,6 +1180,7 @@
11831180
"functionType": "Action",
11841181
"group": "Copy variables",
11851182
"name": "CopySceneVariableToGlobal",
1183+
"private": true,
11861184
"sentence": "Copy the scene variable:_PARAM1_ to a global variable:_PARAM2_ (clear destination first: _PARAM3_)",
11871185
"events": [
11881186
{
@@ -1219,6 +1217,53 @@
12191217
}
12201218
],
12211219
"objectGroups": []
1220+
},
1221+
{
1222+
"description": "Copy all the chidren of a variable into another variable.",
1223+
"fullName": "Copy a variable",
1224+
"functionType": "Action",
1225+
"name": "CopyVariable",
1226+
"sentence": "Copy _PARAM1_ to _PARAM2_ (clear destination first: _PARAM3_)",
1227+
"events": [
1228+
{
1229+
"type": "BuiltinCommonInstructions::JsCode",
1230+
"inlineCode": [
1231+
"/** @type {gdjs.Variable} */",
1232+
"const sourceVariable = eventsFunctionContext.getArgument(\"SourceVariable\");",
1233+
"/** @type {gdjs.Variable} */",
1234+
"const destinationVariable = eventsFunctionContext.getArgument(\"DestinationVariable\");",
1235+
"const isExactCopy = eventsFunctionContext.getArgument(\"isExactCopy\");",
1236+
"",
1237+
"if (sourceVariable.isPrimitive() === destinationVariable.isPrimitive()) {",
1238+
" gdjs.Variable.copy(sourceVariable, destinationVariable, isExactCopy);",
1239+
"}",
1240+
""
1241+
],
1242+
"parameterObjects": "",
1243+
"useStrict": true,
1244+
"eventsSheetExpanded": true
1245+
}
1246+
],
1247+
"parameters": [
1248+
{
1249+
"description": "Variable to copy",
1250+
"name": "SourceVariable",
1251+
"type": "variable"
1252+
},
1253+
{
1254+
"description": "Destination variable",
1255+
"name": "DestinationVariable",
1256+
"type": "variable"
1257+
},
1258+
{
1259+
"defaultValue": "yes",
1260+
"description": "Clear the destination variable before copying",
1261+
"name": "isExactCopy",
1262+
"optional": true,
1263+
"type": "yesorno"
1264+
}
1265+
],
1266+
"objectGroups": []
12221267
}
12231268
],
12241269
"eventsBasedBehaviors": [],

0 commit comments

Comments
 (0)