Skip to content
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

New extension: Javascript Events #1081

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

github-actions[bot]
Copy link
Contributor

Description

Adds conditions, actions and expressions to compare the return value of or run a javascript code.

How to use the extension

Adds conditions, actions and expressions to compare the return value of or run a javascript code.

How to use:

  • Use the condition "Javascript code number" to compare the evaluated number out of a javascript code.
  • Use the condition "Javascript code string" to compare the evaluated string out of a javascript code.
  • Use the condition "Javascript code boolean" to compare the evaluated boolean value out of a javascript code.
  • Use the action "Run javascript code" to run a javascript code.
  • Use the expression Number to return a number out of a javascript code.
  • Use the expression String to return a string out of a javascript code.

How to evaluate the return value (of conditions and expressions):

"eventsFunctionContext.returnValue = Your return value here;"

By default, the return value is 0 or false.

Tip: use single quotes if you need to type a string:

"eventsFunctionContext.returnValue = 'myStringReturnValue'"

Checklist

  • I've followed all of the best practices.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

What tier of review do you aim for your extension?

Community (Unreviewed)

Example file

JavascriptEventsExample.zip

Extension file

JavascriptEvents.json.zip

@github-actions github-actions bot requested a review from a team as a code owner November 12, 2023 22:45
@github-actions github-actions bot added the ✨ New extension A new extension label Nov 12, 2023
@github-actions github-actions bot mentioned this pull request Nov 12, 2023
3 tasks
@RebornOfc
Copy link

!update JavascriptEvents.json.zip

Copy link
Contributor Author

Can't update the extension, as it doesn't pass automatic tests:


❌ 1 Error found in extension 'JavascriptEvents':

  ⟶ ❌ [JavaScript disallowed properties]: Found disallowed properties in extension 'JavascriptEvents':
{
  allowedProperties: [
    'getVariables',
    'getLayer',
    'getGame',
    'getBackgroundColor',
    'getName',
    'createObject',
    'createObjectsFrom',
    'setBackgroundColor',
    'sceneJustResumed',
    'requestChange',
    'hasLayer',
    'enableDebugDraw'
  ],
  disallowedProperty: 'getTimeManager',
  objectName: 'runtimeScene'
}


❌ 1 Error found in extensions - please fix it before generating the registry.

@RebornOfc
Copy link

RebornOfc commented Nov 13, 2023

Can't update the extension, as it doesn't pass automatic tests:


❌ 1 Error found in extension 'JavascriptEvents':

  ⟶ ❌ [JavaScript disallowed properties]: Found disallowed properties in extension 'JavascriptEvents':
{
  allowedProperties: [
    'getVariables',
    'getLayer',
    'getGame',
    'getBackgroundColor',
    'getName',
    'createObject',
    'createObjectsFrom',
    'setBackgroundColor',
    'sceneJustResumed',
    'requestChange',
    'hasLayer',
    'enableDebugDraw'
  ],
  disallowedProperty: 'getTimeManager',
  objectName: 'runtimeScene'
}


❌ 1 Error found in extensions - please fix it before generating the registry.

Actually, the disallowedProperty is at the extension description, no event is using it. (Other than the example file)

@RebornOfc
Copy link

In some hours I will apply a final update improving the description of the extension :)

@RebornOfc
Copy link

!update
JavascriptEvents.json.zip

New example:
JavascriptEventsExample.zip

Copy link
Contributor Author

✅ Successfully updated the extension.

@D8H
Copy link
Contributor

D8H commented Nov 22, 2023

Thank you for submitting an extension.

What is the purpose of this extension?

@RebornOfc
Copy link

RebornOfc commented Nov 27, 2023

Thank you for submitting an extension.

What is the purpose of this extension?

Allow the user to quickly write javascript code between 2 specific conditions, or actions, something that normally take many unnecessary sub-events to accomplish.

It also allows you to write javascript "expressions" to return a number or a string. (This is meant to be used as a replacement to writting a entire expression for a code that you will use only one or two times in the entire project.)

@VegeTato VegeTato added 👨‍👩‍👧‍👦 Community extension An extension submission to be merged ASAP with a lightweight review. ⌨ JavaScript Uses JavaScript code, and thereby needs a reviewer who knows JavaScript. labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👨‍👩‍👧‍👦 Community extension An extension submission to be merged ASAP with a lightweight review. ⌨ JavaScript Uses JavaScript code, and thereby needs a reviewer who knows JavaScript. ✨ New extension A new extension
Projects
Status: Needs review
Development

Successfully merging this pull request may close these issues.

3 participants