Advertisement
arthuro555

GDevelop parser example

Jul 26th, 2021
1,210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 22.20 KB | None | 0 0
  1. {
  2.   "firstLayout": "",
  3.   "gdVersion": {
  4.     "build": 99,
  5.     "major": 4,
  6.     "minor": 0,
  7.     "revision": 0
  8.   },
  9.   "properties": {
  10.     "adaptGameResolutionAtRuntime": true,
  11.     "folderProject": false,
  12.     "orientation": "landscape",
  13.     "packageName": "com.example.gamename",
  14.     "projectUuid": "08a28cc2-8b09-4c03-a90f-1a3c6055bebc",
  15.     "scaleMode": "linear",
  16.     "sizeOnStartupMode": "adaptWidth",
  17.     "useExternalSourceFiles": false,
  18.     "version": "1.0.0",
  19.     "name": "Simple parser",
  20.     "author": "Arthur Pacaud (arthuro555)",
  21.     "windowWidth": 800,
  22.     "windowHeight": 600,
  23.     "latestCompilationDirectory": "",
  24.     "maxFPS": 60,
  25.     "minFPS": 20,
  26.     "verticalSync": false,
  27.     "platformSpecificAssets": {},
  28.     "loadingScreen": {
  29.       "backgroundColor": 0,
  30.       "backgroundFadeInDuration": 0.2,
  31.       "backgroundImageResourceName": "",
  32.       "gdevelopLogoStyle": "light",
  33.       "logoAndProgressFadeInDuration": 0.2,
  34.       "logoAndProgressLogoFadeInDelay": 0.2,
  35.       "minDuration": 1.5,
  36.       "progressBarColor": 16777215,
  37.       "progressBarHeight": 20,
  38.       "progressBarMaxWidth": 200,
  39.       "progressBarMinWidth": 40,
  40.       "progressBarWidthPercent": 30,
  41.       "showGDevelopSplash": true,
  42.       "showProgressBar": true
  43.     },
  44.     "extensionProperties": [],
  45.     "platforms": [
  46.       {
  47.         "name": "GDevelop JS platform"
  48.       }
  49.     ],
  50.     "currentPlatform": "GDevelop JS platform"
  51.   },
  52.   "resources": {
  53.     "resources": [],
  54.     "resourceFolders": []
  55.   },
  56.   "objects": [],
  57.   "objectsGroups": [],
  58.   "variables": [],
  59.   "layouts": [
  60.     {
  61.       "b": 209,
  62.       "disableInputWhenNotFocused": true,
  63.       "mangledName": "New_32scene",
  64.       "name": "New scene",
  65.       "oglFOV": 90,
  66.       "oglZFar": 500,
  67.       "oglZNear": 1,
  68.       "r": 209,
  69.       "standardSortMethod": true,
  70.       "stopSoundsOnStartup": true,
  71.       "title": "",
  72.       "v": 209,
  73.       "uiSettings": {
  74.         "grid": false,
  75.         "gridB": 255,
  76.         "gridG": 180,
  77.         "gridHeight": 32,
  78.         "gridOffsetX": 0,
  79.         "gridOffsetY": 0,
  80.         "gridR": 158,
  81.         "gridType": "rectangular",
  82.         "gridWidth": 32,
  83.         "snap": true,
  84.         "windowMask": false,
  85.         "zoomFactor": 0.8665000000000008
  86.       },
  87.       "objectsGroups": [],
  88.       "variables": [
  89.         {
  90.           "name": "i",
  91.           "type": "number",
  92.           "value": -1
  93.         },
  94.         {
  95.           "name": "text",
  96.           "type": "string",
  97.           "value": ""
  98.         },
  99.         {
  100.           "name": "state",
  101.           "type": "string",
  102.           "value": "identifier"
  103.         },
  104.         {
  105.           "name": "definition",
  106.           "type": "structure",
  107.           "children": [
  108.             {
  109.               "name": "identifier",
  110.               "type": "string",
  111.               "value": ""
  112.             },
  113.             {
  114.               "name": "value",
  115.               "type": "string",
  116.               "value": ""
  117.             }
  118.           ]
  119.         }
  120.       ],
  121.       "instances": [
  122.         {
  123.           "angle": 0,
  124.           "customSize": true,
  125.           "height": 582,
  126.           "layer": "",
  127.           "locked": false,
  128.           "name": "NewObject",
  129.           "persistentUuid": "97c38bbd-7fc8-4e1d-9246-5c7c6a282f2f",
  130.           "width": 776,
  131.           "x": 14,
  132.           "y": 11,
  133.           "zOrder": 1,
  134.           "numberProperties": [],
  135.           "stringProperties": [],
  136.           "initialVariables": []
  137.         }
  138.       ],
  139.       "objects": [
  140.         {
  141.           "bold": false,
  142.           "italic": false,
  143.           "name": "NewObject",
  144.           "smoothed": true,
  145.           "tags": "",
  146.           "type": "TextObject::Text",
  147.           "underlined": false,
  148.           "variables": [],
  149.           "effects": [],
  150.           "behaviors": [],
  151.           "string": "Text",
  152.           "font": "",
  153.           "characterSize": 20,
  154.           "color": {
  155.             "b": 0,
  156.             "g": 0,
  157.             "r": 0
  158.           }
  159.         }
  160.       ],
  161.       "events": [
  162.         {
  163.           "disabled": false,
  164.           "folded": false,
  165.           "type": "BuiltinCommonInstructions::Standard",
  166.           "conditions": [
  167.             {
  168.               "type": {
  169.                 "inverted": false,
  170.                 "value": "DepartScene"
  171.               },
  172.               "parameters": [
  173.                 ""
  174.               ],
  175.               "subInstructions": []
  176.             }
  177.           ],
  178.           "actions": [
  179.             {
  180.               "type": {
  181.                 "inverted": false,
  182.                 "value": "ModVarSceneTxt"
  183.               },
  184.               "parameters": [
  185.                 "text",
  186.                 "=",
  187.                 "\"Name = Bulbasaur\" + NewLine() +\n\"InternalName = BULBASAUR\" + NewLine() +\n\"Type1 = GRASS\" + NewLine() +\n\"Type2 = POISON\" + NewLine()"
  188.               ],
  189.               "subInstructions": []
  190.             },
  191.             {
  192.               "type": {
  193.                 "inverted": false,
  194.                 "value": "ModVarScene"
  195.               },
  196.               "parameters": [
  197.                 "i",
  198.                 "=",
  199.                 "-1"
  200.               ],
  201.               "subInstructions": []
  202.             },
  203.             {
  204.               "type": {
  205.                 "inverted": false,
  206.                 "value": "ModVarSceneTxt"
  207.               },
  208.               "parameters": [
  209.                 "state",
  210.                 "=",
  211.                 "\"identifier\""
  212.               ],
  213.               "subInstructions": []
  214.             },
  215.             {
  216.               "type": {
  217.                 "inverted": false,
  218.                 "value": "ModVarSceneTxt"
  219.               },
  220.               "parameters": [
  221.                 "definition.identifier",
  222.                 "=",
  223.                 "\"\""
  224.               ],
  225.               "subInstructions": []
  226.             },
  227.             {
  228.               "type": {
  229.                 "inverted": false,
  230.                 "value": "ModVarSceneTxt"
  231.               },
  232.               "parameters": [
  233.                 "definition.value",
  234.                 "=",
  235.                 "\"\""
  236.               ],
  237.               "subInstructions": []
  238.             }
  239.           ],
  240.           "events": [
  241.             {
  242.               "disabled": false,
  243.               "folded": false,
  244.               "type": "BuiltinCommonInstructions::Comment",
  245.               "color": {
  246.                 "b": 109,
  247.                 "g": 230,
  248.                 "r": 255,
  249.                 "textB": 0,
  250.                 "textG": 0,
  251.                 "textR": 0
  252.               },
  253.               "comment": "For every character in the string, where `i` is the index of the character (the character can be obtained from the index using `StrAt(VariableString(text), Variable(i))`) ",
  254.               "comment2": ""
  255.             },
  256.             {
  257.               "disabled": false,
  258.               "folded": false,
  259.               "infiniteLoopWarning": true,
  260.               "type": "BuiltinCommonInstructions::While",
  261.               "whileConditions": [
  262.                 {
  263.                   "type": {
  264.                     "inverted": false,
  265.                     "value": "VarScene"
  266.                   },
  267.                   "parameters": [
  268.                     "i",
  269.                     "<",
  270.                     "StrLength(VariableString(text))"
  271.                   ],
  272.                   "subInstructions": []
  273.                 }
  274.               ],
  275.               "conditions": [],
  276.               "actions": [
  277.                 {
  278.                   "type": {
  279.                     "inverted": false,
  280.                     "value": "ModVarScene"
  281.                   },
  282.                   "parameters": [
  283.                     "i",
  284.                     "+",
  285.                     "1"
  286.                   ],
  287.                   "subInstructions": []
  288.                 }
  289.               ],
  290.               "events": [
  291.                 {
  292.                   "disabled": false,
  293.                   "folded": false,
  294.                   "type": "BuiltinCommonInstructions::Comment",
  295.                   "color": {
  296.                     "b": 109,
  297.                     "g": 230,
  298.                     "r": 255,
  299.                     "textB": 0,
  300.                     "textG": 0,
  301.                     "textR": 0
  302.                   },
  303.                   "comment": "Ignore any whitespace",
  304.                   "comment2": ""
  305.                 },
  306.                 {
  307.                   "disabled": false,
  308.                   "folded": false,
  309.                   "type": "BuiltinCommonInstructions::Standard",
  310.                   "conditions": [
  311.                     {
  312.                       "type": {
  313.                         "inverted": false,
  314.                         "value": "StrEqual"
  315.                       },
  316.                       "parameters": [
  317.                         "StrAt(VariableString(text), Variable(i))",
  318.                         "!=",
  319.                         "\" \""
  320.                       ],
  321.                       "subInstructions": []
  322.                     }
  323.                   ],
  324.                   "actions": [],
  325.                   "events": [
  326.                     {
  327.                       "disabled": false,
  328.                       "folded": false,
  329.                       "type": "BuiltinCommonInstructions::Comment",
  330.                       "color": {
  331.                         "b": 109,
  332.                         "g": 230,
  333.                         "r": 255,
  334.                         "textB": 0,
  335.                         "textG": 0,
  336.                         "textR": 0
  337.                       },
  338.                       "comment": "If not a special character, it is text.",
  339.                       "comment2": ""
  340.                     },
  341.                     {
  342.                       "disabled": false,
  343.                       "folded": false,
  344.                       "type": "BuiltinCommonInstructions::Standard",
  345.                       "conditions": [
  346.                         {
  347.                           "type": {
  348.                             "inverted": false,
  349.                             "value": "StrEqual"
  350.                           },
  351.                           "parameters": [
  352.                             "StrAt(VariableString(text), Variable(i))",
  353.                             "!=",
  354.                             "\"=\""
  355.                           ],
  356.                           "subInstructions": []
  357.                         },
  358.                         {
  359.                           "type": {
  360.                             "inverted": false,
  361.                             "value": "StrEqual"
  362.                           },
  363.                           "parameters": [
  364.                             "StrAt(VariableString(text), Variable(i))",
  365.                             "!=",
  366.                             "NewLine()"
  367.                           ],
  368.                           "subInstructions": []
  369.                         }
  370.                       ],
  371.                       "actions": [],
  372.                       "events": [
  373.                         {
  374.                           "disabled": false,
  375.                           "folded": false,
  376.                           "type": "BuiltinCommonInstructions::Comment",
  377.                           "color": {
  378.                             "b": 109,
  379.                             "g": 230,
  380.                             "r": 255,
  381.                             "textB": 0,
  382.                             "textG": 0,
  383.                             "textR": 0
  384.                           },
  385.                           "comment": "If we are before the equal, we are reading the identifier",
  386.                           "comment2": ""
  387.                         },
  388.                         {
  389.                           "disabled": false,
  390.                           "folded": false,
  391.                           "type": "BuiltinCommonInstructions::Standard",
  392.                           "conditions": [
  393.                             {
  394.                               "type": {
  395.                                 "inverted": false,
  396.                                 "value": "VarSceneTxt"
  397.                               },
  398.                               "parameters": [
  399.                                 "state",
  400.                                 "=",
  401.                                 "\"identifier\""
  402.                               ],
  403.                               "subInstructions": []
  404.                             }
  405.                           ],
  406.                           "actions": [
  407.                             {
  408.                               "type": {
  409.                                 "inverted": false,
  410.                                 "value": "ModVarSceneTxt"
  411.                               },
  412.                               "parameters": [
  413.                                 "definition.identifier",
  414.                                 "+",
  415.                                 "StrAt(VariableString(text), Variable(i))"
  416.                               ],
  417.                               "subInstructions": []
  418.                             }
  419.                           ],
  420.                           "events": []
  421.                         },
  422.                         {
  423.                           "disabled": false,
  424.                           "folded": false,
  425.                           "type": "BuiltinCommonInstructions::Comment",
  426.                           "color": {
  427.                             "b": 109,
  428.                             "g": 230,
  429.                             "r": 255,
  430.                             "textB": 0,
  431.                             "textG": 0,
  432.                             "textR": 0
  433.                           },
  434.                           "comment": "If we are after the equal, we are reading the value",
  435.                           "comment2": ""
  436.                         },
  437.                         {
  438.                           "disabled": false,
  439.                           "folded": false,
  440.                           "type": "BuiltinCommonInstructions::Standard",
  441.                           "conditions": [
  442.                             {
  443.                               "type": {
  444.                                 "inverted": false,
  445.                                 "value": "VarSceneTxt"
  446.                               },
  447.                               "parameters": [
  448.                                 "state",
  449.                                 "=",
  450.                                 "\"value\""
  451.                               ],
  452.                               "subInstructions": []
  453.                             }
  454.                           ],
  455.                           "actions": [
  456.                             {
  457.                               "type": {
  458.                                 "inverted": false,
  459.                                 "value": "ModVarSceneTxt"
  460.                               },
  461.                               "parameters": [
  462.                                 "definition.value",
  463.                                 "+",
  464.                                 "StrAt(VariableString(text), Variable(i))"
  465.                               ],
  466.                               "subInstructions": []
  467.                             }
  468.                           ],
  469.                           "events": []
  470.                         }
  471.                       ]
  472.                     },
  473.                     {
  474.                       "disabled": false,
  475.                       "folded": false,
  476.                       "type": "BuiltinCommonInstructions::Comment",
  477.                       "color": {
  478.                         "b": 109,
  479.                         "g": 230,
  480.                         "r": 255,
  481.                         "textB": 0,
  482.                         "textG": 0,
  483.                         "textR": 0
  484.                       },
  485.                       "comment": "If it is an equal. from now on we read the value not the identifier",
  486.                       "comment2": ""
  487.                     },
  488.                     {
  489.                       "disabled": false,
  490.                       "folded": false,
  491.                       "type": "BuiltinCommonInstructions::Standard",
  492.                       "conditions": [
  493.                         {
  494.                           "type": {
  495.                             "inverted": false,
  496.                             "value": "StrEqual"
  497.                           },
  498.                           "parameters": [
  499.                             "StrAt(VariableString(text), Variable(i))",
  500.                             "=",
  501.                             "\"=\""
  502.                           ],
  503.                           "subInstructions": []
  504.                         }
  505.                       ],
  506.                       "actions": [
  507.                         {
  508.                           "type": {
  509.                             "inverted": false,
  510.                             "value": "ModVarSceneTxt"
  511.                           },
  512.                           "parameters": [
  513.                             "state",
  514.                             "=",
  515.                             "\"value\""
  516.                           ],
  517.                           "subInstructions": []
  518.                         }
  519.                       ],
  520.                       "events": []
  521.                     },
  522.                     {
  523.                       "disabled": false,
  524.                       "folded": false,
  525.                       "type": "BuiltinCommonInstructions::Comment",
  526.                       "color": {
  527.                         "b": 109,
  528.                         "g": 230,
  529.                         "r": 255,
  530.                         "textB": 0,
  531.                         "textG": 0,
  532.                         "textR": 0
  533.                       },
  534.                       "comment": "A new line signifies the end of a definition, commit the one that was being written and clear the definition variable for the next definition",
  535.                       "comment2": ""
  536.                     },
  537.                     {
  538.                       "disabled": false,
  539.                       "folded": false,
  540.                       "type": "BuiltinCommonInstructions::Standard",
  541.                       "conditions": [
  542.                         {
  543.                           "type": {
  544.                             "inverted": false,
  545.                             "value": "StrEqual"
  546.                           },
  547.                           "parameters": [
  548.                             "StrAt(VariableString(text), Variable(i))",
  549.                             "=",
  550.                             "NewLine()"
  551.                           ],
  552.                           "subInstructions": []
  553.                         }
  554.                       ],
  555.                       "actions": [
  556.                         {
  557.                           "type": {
  558.                             "inverted": false,
  559.                             "value": "ModVarSceneTxt"
  560.                           },
  561.                           "parameters": [
  562.                             "state",
  563.                             "=",
  564.                             "\"identifier\""
  565.                           ],
  566.                           "subInstructions": []
  567.                         },
  568.                         {
  569.                           "type": {
  570.                             "inverted": false,
  571.                             "value": "ModVarSceneTxt"
  572.                           },
  573.                           "parameters": [
  574.                             "result[VariableString(definition.identifier)]",
  575.                             "=",
  576.                             "VariableString(definition.value)"
  577.                           ],
  578.                           "subInstructions": []
  579.                         },
  580.                         {
  581.                           "type": {
  582.                             "inverted": false,
  583.                             "value": "ModVarSceneTxt"
  584.                           },
  585.                           "parameters": [
  586.                             "definition.identifier",
  587.                             "=",
  588.                             "\"\""
  589.                           ],
  590.                           "subInstructions": []
  591.                         },
  592.                         {
  593.                           "type": {
  594.                             "inverted": false,
  595.                             "value": "ModVarSceneTxt"
  596.                           },
  597.                           "parameters": [
  598.                             "definition.value",
  599.                             "=",
  600.                             "\"\""
  601.                           ],
  602.                           "subInstructions": []
  603.                         }
  604.                       ],
  605.                       "events": []
  606.                     }
  607.                   ]
  608.                 }
  609.               ]
  610.             },
  611.             {
  612.               "disabled": false,
  613.               "folded": false,
  614.               "type": "BuiltinCommonInstructions::Comment",
  615.               "color": {
  616.                 "b": 109,
  617.                 "g": 230,
  618.                 "r": 255,
  619.                 "textB": 0,
  620.                 "textG": 0,
  621.                 "textR": 0
  622.               },
  623.               "comment": "Display results",
  624.               "comment2": ""
  625.             },
  626.             {
  627.               "disabled": false,
  628.               "folded": false,
  629.               "type": "BuiltinCommonInstructions::Standard",
  630.               "conditions": [],
  631.               "actions": [
  632.                 {
  633.                   "type": {
  634.                     "inverted": false,
  635.                     "value": "TextObject::String"
  636.                   },
  637.                   "parameters": [
  638.                     "NewObject",
  639.                     "=",
  640.                     "ToJSON(result)"
  641.                   ],
  642.                   "subInstructions": []
  643.                 }
  644.               ],
  645.               "events": []
  646.             }
  647.           ]
  648.         }
  649.       ],
  650.       "layers": [
  651.         {
  652.           "ambientLightColorB": 32,
  653.           "ambientLightColorG": 0,
  654.           "ambientLightColorR": 0,
  655.           "followBaseLayerCamera": false,
  656.           "isLightingLayer": false,
  657.           "name": "",
  658.           "visibility": true,
  659.           "cameras": [
  660.             {
  661.               "defaultSize": true,
  662.               "defaultViewport": true,
  663.               "height": 0,
  664.               "viewportBottom": 1,
  665.               "viewportLeft": 0,
  666.               "viewportRight": 1,
  667.               "viewportTop": 0,
  668.               "width": 0
  669.             }
  670.           ],
  671.           "effects": []
  672.         }
  673.       ],
  674.       "behaviorsSharedData": []
  675.     }
  676.   ],
  677.   "externalEvents": [],
  678.   "eventsFunctionsExtensions": [],
  679.   "externalLayouts": [],
  680.   "externalSourceFiles": []
  681. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement