Incorporating sound buffers into an existing .mct file

Posted by Imloti on Thu 26 Apr 2018 08:42 AM — 6 posts, 19,881 views.

USA #0
I have a fairly complex set of triggers for a MUD that I play. When I created them (all through the dialog box), I did not know about sound buffers that would allow more than one sound to play at a time. I have fiddled with the .mct file and cannot figure out how to incorporate the buffers into what I already have. An example of one of my existing triggers is:

</trigger>
<trigger
enabled="y"
match="* A marking on the ground indicates that this area has already been explored."
sequence="100"
sound="D:\\MUSHclient\sounds\beep1.wav"
>
</trigger>

I know that what I want to add looks something like this:

PlaySound (0, "D:\\MUSHclient\sounds\beep1.wav", false, 0, 0)

The problem I'm having is how to incorporate the two. Any assistance would be appreciated. Thank you!
USA Global Moderator #1
Try

<trigger
enabled="y"
match="* A marking on the ground indicates that this area has already been explored."
sequence="100"
send_to="12"
>
<send>
 PlaySound (0, "D:\\MUSHclient\sounds\beep1.wav", false, 0, 0)
</send>
</trigger>


Notice the bits that say send_to="12" and <send>...</send>

The interface entry equivalent is that in the trigger edit window you would put the PlaySound invocation in the send box, and then you tell the trigger to send to script.
Amended on Thu 26 Apr 2018 10:59 AM by Fiendish
USA #2
Thank you so much. This is perfect.
USA #3
The only problem I'm having now is I'm getting a ton of compile errors. Things like:

Compile error
World: StarC
Immediate execution
[string "Trigger: "]:1: '<name>' expected near '/'

and

Compile error
World: StarC
Immediate execution
[string "Trigger: "]:1: function arguments expected near '.'

It looks like it's something with line 1? Which is:

<?xml version="1.0" encoding="iso-8859-1"?>

But I haven't touched that.
Australia Forum Administrator #4

Do not replace the </trigger> in your initial post. That was the end of the previous trigger. Each trigger should look like this:

<trigger 
  ... various parameters ...
>
<send>
  ... stuff to send ...
</send>
</trigger>

What might be easier would be to make a new (empty) world file, import the triggers from the .mct file1, amend them in the GUI interface, and write them all back to the .mct file2. Make a backup first.

As Fiendish said, in the trigger GUI interface:

  • Change “Send to” to be “Script”
  • Change Sound to “(no sound)” by clicking the “No sound” button
  • Add into the Send box the small script he showed. The default place to look for sounds is the sound directory, and some arguments are optional, so it could simplified to:
 PlaySound (0, "beep1.wav")

The default sounds directory can be checked by executing this in the Immediate scripting window:

print (GetInfo (74))
Amended on Thu 26 Apr 2018 08:10 PM by Nick Gammon
USA #5
Thank you, Nick. I ended up having someone look at just one of the triggers from the file and turns out I was making a mistake that my high school computer programming teacher warned me about. I was leaving off a quote prior to the file name. And as much as I stared at it, I didn't see it was missing. All works perfectly now and this amazing person also helped me set it so they play in the background so that I don't have to be in the MC window in order for them to play. Thanks to all of you and this other person...I've got it straight.