diff --git a/extensions/community/ButtonActions.json b/extensions/community/ButtonActions.json new file mode 100644 index 000000000..1feaad790 --- /dev/null +++ b/extensions/community/ButtonActions.json @@ -0,0 +1,1155 @@ +{ + "author": "", + "category": "Input", + "dimension": "", + "extensionNamespace": "", + "fullName": "Button to action", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdlc3R1cmUtdGFwLWJ1dHRvbiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMyA1QzE1LjIxIDUgMTcgNi43OSAxNyA5QzE3IDEwLjUgMTYuMiAxMS43NyAxNSAxMi40NlYxMS4yNEMxNS42MSAxMC42OSAxNiA5Ljg5IDE2IDlDMTYgNy4zNCAxNC42NiA2IDEzIDZTMTAgNy4zNCAxMCA5QzEwIDkuODkgMTAuMzkgMTAuNjkgMTEgMTEuMjRWMTIuNDZDOS44IDExLjc3IDkgMTAuNSA5IDlDOSA2Ljc5IDEwLjc5IDUgMTMgNU0yMCAyMC41QzE5Ljk3IDIxLjMyIDE5LjMyIDIxLjk3IDE4LjUgMjJIMTNDMTIuNjIgMjIgMTIuMjYgMjEuODUgMTIgMjEuNTdMOCAxNy4zN0w4Ljc0IDE2LjZDOC45MyAxNi4zOSA5LjIgMTYuMjggOS41IDE2LjI4SDkuN0wxMiAxOFY5QzEyIDguNDUgMTIuNDUgOCAxMyA4UzE0IDguNDUgMTQgOVYxMy40N0wxNS4yMSAxMy42TDE5LjE1IDE1Ljc5QzE5LjY4IDE2LjAzIDIwIDE2LjU2IDIwIDE3LjE0VjIwLjVNMjAgMkg0QzIuOSAyIDIgMi45IDIgNFYxMkMyIDEzLjExIDIuOSAxNCA0IDE0SDhWMTJMNCAxMkw0IDRIMjBMMjAgMTJIMThWMTRIMjBWMTMuOTZMMjAuMDQgMTRDMjEuMTMgMTQgMjIgMTMuMDkgMjIgMTJWNEMyMiAyLjkgMjEuMTEgMiAyMCAyWiIgLz48L3N2Zz4=", + "name": "ButtonActions", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/753a9a794bd885058159b7509f06f5a8f67f72decfccb9a1b0efee26f41c3c4c_gesture-tap-button.svg", + "shortDescription": "Use a button to change variable, create objects , and link event action.", + "version": "1.0.0", + "description": "It allows a button to change a variable on itself or in the scene when pressed. As well as create object or link event action in different parts of the code with signals.", + "tags": [], + "authorIds": [ + "S1Dr159GgRVwFTmtngHmd8MIMUs2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [ + { + "name": "Singal", + "type": "string", + "value": "" + } + ], + "eventsFunctions": [], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT" + }, + "eventsBasedBehaviors": [ + { + "description": "Use a button input to change a variable or multiple variables.", + "fullName": "Button To Action", + "helpPath": "", + "iconUrl": "", + "name": "ButtontoAction", + "objectType": "PanelSpriteButton::PanelSpriteButton", + "previewIconUrl": "", + "eventsFunctions": [ + { + "description": "When this button is pressed change a number variable by a value with a math formula.", + "fullName": "When pressed change number", + "functionType": "Action", + "group": "Math function", + "name": "MathChange", + "sentence": "When _PARAM0_ is a press change variable that is _PARAM2_ with a value of _PARAM3_ with the formula of _PARAM4_ and a decimal limiter of _PARAM5_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable2" + }, + "parameters": [ + "\"Variable\"", + "Total" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Add\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "+", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Subtract\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "-", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Multiple\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "*", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Divide\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "/", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Set\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "=", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "=", + "roundTo(Total,Decimal_Limiter)" + ] + }, + { + "type": { + "value": "CopyVariableToArgument2" + }, + "parameters": [ + "\"Variable\"", + "Total" + ] + } + ] + } + ], + "variables": [ + { + "name": "Total", + "persistentUuid": "f83a0847-28b3-4898-b574-28ce60960f5e", + "type": "number", + "value": 0 + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonActions::ButtontoAction", + "type": "behavior" + }, + { + "description": "Must be a number variable", + "name": "Variable", + "type": "variable" + }, + { + "description": "The number used with the variable", + "name": "Value", + "type": "expression" + }, + { + "description": "Math formula can be used and the last one is to set it to a value", + "name": "Math", + "supplementaryInformation": "[\"Add\",\"Subtract\",\"Multiple\",\"Divide\",\"Set\"]", + "type": "stringWithSelector" + }, + { + "description": "Limits the number to that number of decimal places", + "name": "Decimal_Limiter", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "When this button is pressed change a number variable by a value with a math formula.", + "fullName": "When pressed change number with limits", + "functionType": "Action", + "group": "Math function", + "name": "MathChangeWithLimits", + "sentence": "When _PARAM0_ is a press change variable that is _PARAM2_ with a value of _PARAM3_ with the formula of _PARAM4_ with a range limit of _PARAM5_ to _PARAM6_ and a decimal limit of _PARAM7_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable2" + }, + "parameters": [ + "\"Variable\"", + "Total" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Add\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "+", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Subtract\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "-", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Multiple\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "*", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Divide\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "/", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Math", + "=", + "\"Set\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "=", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "=", + "roundTo(Total,Decimal_Limiter)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Total", + "=", + "clamp(Total,Min,Max)" + ] + }, + { + "type": { + "value": "CopyVariableToArgument2" + }, + "parameters": [ + "\"Variable\"", + "Total" + ] + } + ] + } + ], + "variables": [ + { + "name": "Total", + "persistentUuid": "f83a0847-28b3-4898-b574-28ce60960f5e", + "type": "number", + "value": 0 + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonActions::ButtontoAction", + "type": "behavior" + }, + { + "description": "Must be a number variable", + "name": "Variable", + "type": "variable" + }, + { + "description": "The number used with the variable", + "name": "Value", + "type": "expression" + }, + { + "description": "Math formula that can be used and the last one is to set it to a value", + "name": "Math", + "supplementaryInformation": "[\"Add\",\"Subtract\",\"Multiple\",\"Divide\",\"Set\"]", + "type": "stringWithSelector" + }, + { + "description": "Minimum of the variable", + "name": "Min", + "type": "expression" + }, + { + "description": "Max of the variable", + "name": "Max", + "type": "expression" + }, + { + "description": "Limits the number to that number of decimal places", + "name": "Decimal_Limiter", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "When this button is pressed create an object.", + "fullName": "When pressed to create Object", + "functionType": "Action", + "group": "Effect Function", + "name": "CreateObject", + "sentence": "When _PARAM0_ is pressed create _PARAM2_ at the point of (_PARAM3_,_PARAM4_) with a base layer of _PARAM5_ and z order of _PARAM6_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "Created_Object", + "X", + "Y", + "Layer" + ] + }, + { + "type": { + "value": "SetZOrder" + }, + "parameters": [ + "Created_Object", + "=", + "Zorder" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonActions::ButtontoAction", + "type": "behavior" + }, + { + "description": "The created object when pressed", + "name": "Created_Object", + "type": "objectList" + }, + { + "description": "X position of the created object", + "name": "X", + "type": "expression" + }, + { + "description": "Y position of the created object", + "name": "Y", + "type": "expression" + }, + { + "description": "The layer of the created object", + "name": "Layer", + "type": "layer" + }, + { + "description": "The order of the created object", + "name": "Zorder", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "When this button is pressed change a string variable by a value with a string formula.", + "fullName": "When pressed change string", + "functionType": "Action", + "group": "String function", + "name": "ChangeString", + "sentence": "When _PARAM0_ is a press change variable that is _PARAM2_ with a value of _PARAM3_ with the formula of _PARAM4_ ( If Subtract String, the start is _PARAM5_ and the end is _PARAM6_)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable2" + }, + "parameters": [ + "\"Variable\"", + "Total" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "String", + "=", + "\"Add\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Total", + "+", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "String", + "=", + "\"New Line\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Total", + "+", + "NewLine()+Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "String", + "=", + "\"Subtract String\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Total", + "=", + "SubStr(Total,Start,End)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "String", + "=", + "\"Set\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Total", + "=", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CopyVariableToArgument2" + }, + "parameters": [ + "\"Variable\"", + "Total" + ] + } + ] + } + ], + "variables": [ + { + "name": "Total", + "persistentUuid": "9c05419d-c5be-4c8d-a072-1a6d8d1be46d", + "type": "string", + "value": "" + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonActions::ButtontoAction", + "type": "behavior" + }, + { + "description": "Must be a string value", + "name": "Variable", + "type": "variable" + }, + { + "description": "The string value that is used", + "name": "Value", + "type": "string" + }, + { + "description": "String formula that can be used and the last one is to set it to a value", + "name": "String", + "supplementaryInformation": "[\"Add\",\"New Line\",\"Subtract String\",\"Set\"]", + "type": "stringWithSelector" + }, + { + "description": "Used with Subtract String", + "name": "Start", + "type": "expression" + }, + { + "description": "Used with Subtract String", + "name": "End", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the set button text to a string value.", + "fullName": "When pressed set button text", + "functionType": "Action", + "group": "String function", + "name": "ChangeButtonText", + "sentence": "When _PARAM0_ is pressed set _PARAM0_'s text to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelTextOp" + }, + "parameters": [ + "Object", + "=", + "String", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonActions::ButtontoAction", + "type": "behavior" + }, + { + "description": "The string value that the button change to", + "name": "String", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "When signal is called play the events that follows.", + "fullName": "When signal is called", + "functionType": "Condition", + "group": "Signal Function", + "name": "WhenSignalCalled", + "sentence": "When _PARAM0_ calls the signal that is _PARAM2_ is true (When inverse is not true)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Singal", + "=", + "Signal" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonActions::ButtontoAction", + "type": "behavior" + }, + { + "description": "The Signal's name", + "name": "Signal", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "When button is pressed, it calls a signal .", + "fullName": "Call Signal", + "functionType": "Action", + "group": "Signal Function", + "name": "CallSingal", + "sentence": "_PARAM0_ call the signal that is _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Singal", + "=", + "Signal", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonActions::ButtontoAction", + "type": "behavior" + }, + { + "description": "The Signal's name", + "name": "Signal", + "type": "string" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "folderName": "Signal Function", + "children": [ + { + "functionName": "WhenSignalCalled" + }, + { + "functionName": "CallSingal" + } + ] + }, + { + "folderName": "Effect Function", + "children": [ + { + "functionName": "CreateObject" + } + ] + }, + { + "folderName": "String function", + "children": [ + { + "functionName": "ChangeString" + }, + { + "functionName": "ChangeButtonText" + } + ] + }, + { + "folderName": "Math function", + "children": [ + { + "functionName": "MathChangeWithLimits" + }, + { + "functionName": "MathChange" + } + ] + } + ] + }, + "propertyDescriptors": [], + "propertiesFolderStructure": { + "folderName": "__ROOT" + } + } + ], + "eventsBasedObjects": [], + "requiredExtensions": [ + { + "extensionName": "PanelSpriteButton", + "extensionVersion": "2.2.1" + } + ] +}