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: Audio by Filename #1021

Closed
3 tasks done
Silver-Streak opened this issue Sep 24, 2023 · 8 comments
Closed
3 tasks done

New extension: Audio by Filename #1021

Silver-Streak opened this issue Sep 24, 2023 · 8 comments

Comments

@Silver-Streak
Copy link
Contributor

Silver-Streak commented Sep 24, 2023

Description

Allows for playing a sound resource by filename as a string.

This allows for dynamically selecting a file name via string expressions, which can be useful for larger games.
Example use cases:

  • Playing voiced dialogue in larger games without having to make an event for every possible voice line. Visual Novels, Adventure Games, and even RPGs tend to play voice files based off the ID of the dialogue line. This allows that style of behavior in GDevelop.
  • Sound or Music selection in a game. Rather than having to have an event for every possible song file, you can have a single event that selects based off the item clicked or chosne.
  • Playing sound effects based off a character's equipment. If wielding a sword and the player attacks, it'd look up the sword sound file just by passing a variable from the sword object to build out the string. Same if it was a bow, gun, or anything else.

I made this by adapting an extension posted on the forums made by Krunkster. It only accounted for music actions and did not include the preload actions, so I've added those along with cleaned up some of the naming conventions and built out an example.

How to use the extension

  1. Add the audio files to the resources of the project.
  2. Name the resources in a way that makes logical sense for your use case. e.g. if going to play sound files by the dialogue node currently being displayed, match the file names to the dialogue node name.
  3. Use the play sound by file name or play music by file name actions in your events, ensuring that you build out the full file name of the resource as your string.

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

AudioByNameExample.zip

Extension file

AudioByName.zip

@Silver-Streak Silver-Streak added the ✨ New extension A new extension label Sep 24, 2023
@github-actions
Copy link
Contributor

👋 Thanks for your submission! Unfortunately, all submitted extensions have to meet some minimal quality standard - the extension best practices - and our system has found that your extension does not fully comply 😔. You can find all of those rules on the GDevelop wiki.

The following issues have been found by the system concerning the respect of those best practices by your extension:

  ⟶ ❌ [Dots in sentences]: Field 'shortDescription' of the extension description misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PlayMusicOnChannelByName' misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PlaySoundOnChannelByName' misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PreloadSoundByName' misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PreloadMusicByName' misses a dot at the end of the sentence!
  ⟶ ❌ [JavaScript disallowed properties]: Found disallowed properties in extension 'AudioByName':
{
  allowedProperties: [
    'getVariables',
    'getLayer',
    'getGame',
    'getBackgroundColor',
    'getName',
    'createObject',
    'createObjectsFrom',
    'setBackgroundColor',
    'sceneJustResumed',
    'requestChange',
    'hasLayer',
    'enableDebugDraw'
  ],
  disallowedProperty: '_runtimeGame',
  objectName: 'runtimeScene'
}

Please update your original submission post with a new zip file containing your extensions updated to follow those guidelines 🙏

1 similar comment
@github-actions
Copy link
Contributor

👋 Thanks for your submission! Unfortunately, all submitted extensions have to meet some minimal quality standard - the extension best practices - and our system has found that your extension does not fully comply 😔. You can find all of those rules on the GDevelop wiki.

The following issues have been found by the system concerning the respect of those best practices by your extension:

  ⟶ ❌ [Dots in sentences]: Field 'shortDescription' of the extension description misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PlayMusicOnChannelByName' misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PlaySoundOnChannelByName' misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PreloadSoundByName' misses a dot at the end of the sentence!
  ⟶ ❌ [Dots in sentences]: Field 'description' of the function 'PreloadMusicByName' misses a dot at the end of the sentence!
  ⟶ ❌ [JavaScript disallowed properties]: Found disallowed properties in extension 'AudioByName':
{
  allowedProperties: [
    'getVariables',
    'getLayer',
    'getGame',
    'getBackgroundColor',
    'getName',
    'createObject',
    'createObjectsFrom',
    'setBackgroundColor',
    'sceneJustResumed',
    'requestChange',
    'hasLayer',
    'enableDebugDraw'
  ],
  disallowedProperty: '_runtimeGame',
  objectName: 'runtimeScene'
}

Please update your original submission post with a new zip file containing your extensions updated to follow those guidelines 🙏

@github-actions
Copy link
Contributor

👋 Thanks for your submission! Unfortunately, all submitted extensions have to meet some minimal quality standard - the extension best practices - and our system has found that your extension does not fully comply 😔. You can find all of those rules on the GDevelop wiki.

The following issues have been found by the system concerning the respect of those best practices by your extension:

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

Please update your original submission post with a new zip file containing your extensions updated to follow those guidelines 🙏

@Silver-Streak Silver-Streak changed the title New extension: <Audio by Filename> New extension: Audio by Filename Sep 24, 2023
@github-actions
Copy link
Contributor

👋 Thanks for your submission! Unfortunately, all submitted extensions have to meet some minimal quality standard - the extension best practices - and our system has found that your extension does not fully comply 😔. You can find all of those rules on the GDevelop wiki.

The following issues have been found by the system concerning the respect of those best practices by your extension:

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

Please update your original submission post with a new zip file containing your extensions updated to follow those guidelines 🙏

@github-actions
Copy link
Contributor

👋 Thanks for your submission! We are sorry, but it seems your extension file miraculously disappeared just after being extracted 🤔. This should never happen, please ask @GDevelopApp/extensions-team for assistance.

@github-actions
Copy link
Contributor

Hi @arthuro555! 👋 This submission has passed all required tests, and has been moved to a PR as part of our submission pipeline. You can see the progress of your submission on this page. Community submissions are not reviewed by default, so your extension should be added once we've checked that your submission doesn't contain malicious code without further intervention on your part. If you wish for your extension to be reviewed (and thereby moved to the list of reviewed extensions), please follow the instructions written on the README. Thanks again for your contribution to GDevelop!

@EyadMahm0ud
Copy link

Can we get a more comprehensive extension? Such as JSON files and variables? I believe this extension would be very useful if it was for resources and not just audio.

@Silver-Streak
Copy link
Contributor Author

This is a community extension submission PR that is already closed. You are welcome to build out any extension you want, but from a request standpoint it isn't something that would be requested via commenting on this PR.

I only personally adapted processes I found out there already to build this, and would not be expanding the functionality on this out further to include other files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants