[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  looping music for soundpacks

looping music for soundpacks

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Musicmyxtress   (3 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] 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
[Go to top] top

Posted by Musicmyxtress   (3 posts)  [Biography] 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.
[Go to top] top

Posted by Fiendish   USA  (2,519 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (23,001 posts)  [Biography] 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>



Template:pasting 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
[Go to top] top

Posted by Musicmyxtress   (3 posts)  [Biography] 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.
[Go to top] 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.


12,351 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]