Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ Lua
➜ looping music for soundpacks
looping music for soundpacks
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Musicmyxtress
(3 posts) Bio
|
Date
| Wed 12 May 2021 01:53 AM (UTC) |
Message
| Hi everyone,
So I want to start making my own soundpacks for muds. I'm good with triggers and aliases and timers, but never really gotten into scripting much. Still I have learned how to play a sound that loops, but I have one last problem and I've never found script examples to look at. I play a mud where there are different room types. what I want to do is make ambiences for each one. In the room desc it says the type on its own line, for instance, jungle biome. I'd like to make it loop a jungle sound when it's a jungle biome, but keep looping if youo walk into another jungle, but change if you go into another type. I know this can be done because it has been done in other muds, but in those I can't for the life of me find their scripts.
If anyone can give any advice on this, I'd be forever greatful. | Top |
|
Posted by
| Nick Gammon
Australia (23,070 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 12 May 2021 07:17 AM (UTC) |
Message
| Well, you store (remember) the room type, and when you change rooms see if the new room type is the same as the old room type. If so, do nothing. If not, change the music, and store the new room type. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Musicmyxtress
(3 posts) Bio
|
Date
| Reply #2 on Wed 12 May 2021 01:36 PM (UTC) |
Message
| Ok, thanks. what I'm still struggling with is where you would do that. It's a specific line in every room. I'm not sure how I would tell it to get that line and store it. Would I, as I originally thought, make a different trigger for each biome type? or do I have to write a script file with some empty variable and then somehow recognize that line as the one to update it? Apologies for my newbieness. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #3 on Wed 12 May 2021 01:58 PM (UTC) Amended on Wed 12 May 2021 01:59 PM (UTC) by Fiendish
|
Message
|
Quote: Would I, as I originally thought, make a different trigger for each biome type?
If you want, sure. Or if the lines are all sufficiently similar maybe you could use one trigger with a wildcard capture. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,070 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 12 May 2021 09:29 PM (UTC) Amended on Thu 13 May 2021 05:25 AM (UTC) by Nick Gammon
|
Message
| You would use a trigger with a wildcard as Fiendish suggested, or one trigger per different room if necessary.
Something like this:
<triggers>
<trigger
enabled="y"
match="You enter the jungle."
send_to="12"
sequence="100"
>
<send>
changeBackgroundMusic ('jungle') -- see if music needs to change
</send>
</trigger>
</triggers>
|
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
That trigger calls a shared function changeBackgroundMusic passing it the type of the current biome.
The script file (set that up in the Scripting configuration tab) could consist of something like this:
function changeBackgroundMusic (newBiomeType)
-- change background music if the biome type changes
if newBiomeType ~= oldBiomeType then
PlaySound(1, newBiomeType .. ".wav", true) -- play sound, looping
oldBiomeType = newBiomeType
end -- if
end -- changeBackgroundMusic
So in this case the sound files would be "jungle.wav" for the jungle biome, and so on. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Musicmyxtress
(3 posts) Bio
|
Date
| Reply #5 on Wed 12 May 2021 11:21 PM (UTC) |
Message
| Thank you, I've bookmarked this so i can try to learn how to use it. This will definitly help. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,038 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top