• 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.

[JASS] Playing a sound from a GUI-created string variable?

Status
Not open for further replies.
Level 11
Joined
May 31, 2019
Messages
150
I'm able to play a sound with the JASS PlaySound function just fine. but i want to be able to pass it a GUI string variable. I tried passing it udg_mySoundString instead of "the\\sound\\filename.wav" but it doesn't seem to work. I don't want to use the SoundEditor since i'll have multiple maps and don't want to add the same sounds for each one.

At Elapsed GameTime = 0.00 i run
Code:
call Preload(udg_mySoundString)
but it doesn't seem to help.
The variable is not surrounded by ""s.
 
Last edited:
Level 4
Joined
Jun 28, 2012
Messages
23
Can you link your map ? Or atleast the code.

vJASS:
private function onInit takes nothing returns nothing
    set udg_mySoundString ="the\\sound\\filename.wav"
    call PlaySound(udg_mySoundString)
endfunction
Should work 🤔
 
Level 11
Joined
May 31, 2019
Messages
150
Huh, that DOES work.
I wonder what the difference is then, between setting the variable in jass and with the Set mySoundString = the\\sound\\filename.wav GUI action?
I did both a GUI and JASS text message to check, and sure enough string set by the GUI action displays the proper file path.
 
Last edited:
Status
Not open for further replies.
Top