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
➜ General
➜ Problem with direct call to Sound function
Problem with direct call to Sound function
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Seriley
(42 posts) Bio
|
Date
| Sat 29 Jan 2011 08:10 PM (UTC) Amended on Sat 29 Jan 2011 08:12 PM (UTC) by Seriley
|
Message
| I have a trigger that I would like to selectively produce a sound:
if StealthMode and not Fighting then
Sound("C:\Program Files (x86)\MUSHclient\sounds\claves.wav")
end
I've used the full path here, but I also tried just "claves.wav" and verified that path as the default to the sounds directory using GetInfo (74).
I get the default activity sound, not the 'claves' sound.
I get this also when I enter '/Sound ("claves.wave")' on the command line (/ is the default lua escape)
If I use the built-in sound mechanism provided in the trigger dialog, it works fine. I get the correct sound.
I've tried lowering the sequence number of the trigger as a workaround suggested on the forum in 2006 and it did not help. If the poster meant I should make the trigger fire after all triggers, then I'm not able to do that as I have many triggers already at seq = 10000.
Any suggestions? | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Sat 29 Jan 2011 08:43 PM (UTC) |
Message
| \ is a special character, so you need to either escape it as \\, or use the [[ ]] quotes where \ is just a normal character.
Sound([[C:\Program Files (x86)\MUSHclient\sounds\claves.wav]])
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Seriley
(42 posts) Bio
|
Date
| Reply #2 on Sat 29 Jan 2011 09:02 PM (UTC) |
Message
| Thanks, Twisol
When I do that, I now get the correct sound when I enter /Sound([[ .... ]]) from the command line.
I still don't get the correct sound when I make the script call in my trigger | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #3 on Sat 29 Jan 2011 09:23 PM (UTC) |
Message
| Can you please paste your trigger here?
|
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Seriley
(42 posts) Bio
|
Date
| Reply #4 on Sat 29 Jan 2011 09:33 PM (UTC) |
Message
| <triggers>
<trigger
enabled="y"
group="Imperian_Tracking"
match="^You have recovered balance\.$"
name="balance_recovery__"
regexp="y"
send_to="12"
sequence="10000"
>
<send>if StealthMode and not Fighting then
Sound([[C:\Program Files (x86)\MUSHclient\sounds\claves.wav]])
end</send>
</trigger>
</triggers>
| Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #5 on Sat 29 Jan 2011 09:41 PM (UTC) |
Message
| It looks correct. Can you double-check that you don't have any other Sound() calls in other triggers that might be matching the line instead of this trigger? |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Seriley
(42 posts) Bio
|
Date
| Reply #6 on Sat 29 Jan 2011 09:54 PM (UTC) |
Message
| I have no other trigger on the pattern - You have recovered balance. I checked my plugin files also for that pattern.
If I just use the sound functionality provided in the dialogue, which would always play the sound on the match, the correct sound is played whenever the trigger matches. | Top |
|
Posted by
| Nick Gammon
Australia (23,052 posts) Bio
Forum Administrator |
Date
| Reply #7 on Sun 30 Jan 2011 02:26 AM (UTC) |
Message
| I am a bit nervous of backslashes in file names in send to script. It is easy to get the number wrong. How about:
if StealthMode and not Fighting then
Sound( GetInfo (74) .. "claves.wav" )
end
That gets rid of them. GetInfo (74) is the default sound files directory, which is "sounds" under the MUSHclient.exe folder. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Seriley
(42 posts) Bio
|
Date
| Reply #8 on Sun 30 Jan 2011 03:00 AM (UTC) |
Message
| That did the trick! It now works the way I want it too. Thanks, Nick and Twisol! | 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.
25,709 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top