• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Comparing sounds

Status
Not open for further replies.
I doubt one exists for comparing sounds.

Perhaps you should just use a custom script:
  • Set Sound1 = Some Sound <gen>
  • Set Sound2 = Other Sound <gen>
  • Custom script: if udg_Sound1 == udg_Sound2 then
  • Sound - Stop Sound1 immediately
  • Custom script: else
  • Game - Display text to player <..>
  • Custom script: endif
It will just check if two sound variables are pointing to the same handle. If you are comparing it with a generated sound variable, then you would have to use gg_snd_, but that is a little more complicated, so it is better to just assign another global and compare the two globals as I did above.

The "else" part is optional. If you don't need it, you can delete the "else" custom script. If/then/elses in JASS behave as: if <some condition> then. Anything after that, and before "else" or "endif" will be evaluated if the condition is true. If it is false, it'll look for an "else" part. If there isn't one, it'll skip to the end of "endif". You don't really need to know this, but that is just some general info for you to work off of.
 
I assume by 'buffer' you mean that Sound2 is just a temporary holding place. If so, then yes.

All it is doing is checking if the two sounds are equivalent. Let's say you have some sound variable "Sound_var" and you want to see if it equals the "AltarOfStormsWhat1.wav" variable that you made in the sound editor. Here is one way to check:
  • Custom script: if udg_Sound_var == gg_snd_AltarOfStormsWhat1 then
However, it is rather complicated/annoying to type out the sound variable. That is why I made a second variable. It just simplifies the process so you don't have to look up what the JASS equivalent of "AltarOfStormsWhat1" is:
  • Set Comparison_Sound = AltarOfStormsWhat1 <gen>
  • Custom script: if udg_Sound_var == udg_Comparison_Sound then
But you can really use either one. I just chose the second option since it requires less knowledge of JASS.
 
Status
Not open for further replies.
Top