Good afternoon everyone. I have searched everywhere and I don't understand how to create a tag associated with playing music or sound when clicking on the text.
Example:
{play="ex.mp3"}example sound{/play} #as it is not defined it generates error.
Thanks in advance
[Solved]How to create customized tags?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- bonnie_641
- Regular
- Posts: 133
- Joined: Sat Jan 13, 2018 10:57 pm
- Projects: Código C.O.C.I.N.A.
- Deviantart: rubymoonlily
- Contact:
[Solved]How to create customized tags?
Last edited by bonnie_641 on Sat Nov 19, 2022 1:36 pm, edited 1 time in total.
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question.
I try my best to give an answer according to your question.
-
- Veteran
- Posts: 293
- Joined: Fri Sep 17, 2021 2:09 am
- Organization: enaielei
- Tumblr: enaielei
- Deviantart: enaielei
- Github: enaielei
- Skype: enaielei
- Soundcloud: enaielei
- itch: enaielei
- Discord: enaielei#7487
- Contact:
Re: How to create customized tags?
You can probably use hyperlink handlers.
The following is an example (untested).
The following is an example (untested).
Code: Select all
init python:
config.hyperlink_handlers["play"] = renpy.play
label start:
"{a=play:sound.mp3}click to play sound{/a}"
- bonnie_641
- Regular
- Posts: 133
- Joined: Sat Jan 13, 2018 10:57 pm
- Projects: Código C.O.C.I.N.A.
- Deviantart: rubymoonlily
- Contact:
Re: How to create customized tags?
Thank you for taking the time and patience to answer my question.
I reiterate my thanks to you. You are an angel.
Topic solved.
This code is very useful to me. I tested it in the dictionary project and it works and even gives a very curious sound effect in the pronunciation of the words (futuristic style).enaielei wrote:Code: Select all
init python: def play(tag, argument, contents): renpy.play(argument) return contents config.custom_text_tags["play"] = play
You gave me a good idea to use the two codes.enaielei wrote: ↑Fri Nov 18, 2022 11:49 pm You can probably use hyperlink handlers.
The following is an example (untested).Code: Select all
init python: config.hyperlink_handlers["play"] = renpy.play label start: "{a=play:sound.mp3}click to play sound{/a}"
I reiterate my thanks to you. You are an angel.
Topic solved.
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question.
I try my best to give an answer according to your question.
Who is online
Users browsing this forum: No registered users