2015-01-18 18:31:48

I am trying to build a game. Here is the source, but the sounds doesn't sound when I press the keys.
can you help me?
here is your source.

#include "audio.au3"
#include "keyinput.au3"
#include "menusapi.au3"
#include  "randomizer.au3"
#include "sapi.au3"
#include "file.au3"
#include "GUIConstants.au3"

$loop = $device.OpenSound("sounds\loop.wav", 1)
$loop.repeating = 1

GUICreate("rithm immitations version 3.0 by SB Soft")
GUISetState(@SW_Show)

;lets make this buggy thing
menu()

func menu()
   $loop.play
   $m1 = Create_audio_menu("rithm Immitations main menu", "start, credits, contact media, what basically happened to the game, exit")
   Select
   Case $m1 =1
      $loop.stop
   start()
Case $m1 =2
   $loop.stop
   credits()
Case $m1 =3
   $loop.stop
   contact()
Case $m1 =4
   $loop.stop
   gamething()
Case $m1 =5
   $loop.stop
   beep(400, 500)
   speak("Thanks for playing, exiting program")
   beep(400, 500)
   exit
EndSelect
EndFunc

func start()
   speak("this is the storyline. You were playing music at A bar, but the persons suddenly left you alone. Now you need to play for the owner to win money, at least you think so. Start?")
   sleep(1000)
   speak("now!")

While 1
   ;a loop
WEnd

HotKeySet("A", "a")
HotKeySet("B", "b")
HotKeySet("C", "c")
HotKeySet("D", "d")
HotKeySet("E", "e")
HotKeySet("F", "f")
HotKeySet("G", "G")
HotKeySet("H", "h")
HotKeySet("I", "i")
HotKeySet("J", "j")
HotKeySet("K", "k")
HotKeySet("L", "l")
HotKeySet("M", "m")
HotKeySet("N", "n")
HotKeySet("O", "o")
HotKeySet("P", "p")
HotKeySet("Q", "q")
HotKeySet("R", "r")
HotKeySet("S", "s")
HotKeySet("T", "t")
HotKeySet("U", "u")
HotKeySet("V", "v")
HotKeySet("W", "w")
HotKeySet("X", "x")
HotKeySet("Y", "y")
HotKeySet("Z", "z")
HotKeySet("ESCAPE", "backtomenu")
EndFunc

func credits()
   beep(450, 550)
   speak("rithm immitations credits. Thanks to brad, for suplying me with some of the sounds I used in this game. Thanks to bailee alger, amir, Yashua Valdez, Hassan, and bee for helping me in this game, giving me ideas, sounds, and motivation!")
   menu()
EndFunc

func contact()
   beep(500, 500)
   speak("contact media. I still don't have a")
   beep(400, 250)
   speak("domain. Sorry for the bad word he he. well, so you can't hit me up in a webpage, unfortunately, because I have no money actually, and the few I have I am planning to use in other things. Anyways, you can hit me at")
   beep(800, 600)
   speak("Gmail. galapagos.miguel.angel at gmail.com")
   beep(800, 600)
   speak("Skype, raton.miguelito.glps")
   beep(800, 600)
   speak("Audiogames.net forum, the terminator. and well that's all guys. Bye bye.")
   menu()
EndFunc

func gamething()
   speak("bwhat basically happened to rithm immitations, is a complete reconstruction or rewrite. Maybe the old version is better because this one is still progressing, while not in progress or beta or something like that. And well, it's all that happened to the game. thanks for entering in this menu choice.")
   menu()
EndFunc

func backtomenu()
   speak("quitting...")
   menu()
EndFunc

func a()
   SoundPlay("sounds\a.wav")
EndFunc

func b()
   SoundPlay("sounds\b.wav")
EndFunc

func c()
   SoundPlay("sounds\c.wav")
EndFunc

func d()
   SoundPlay("sounds\d.wav")
EndFunc

func e()
   SoundPlay("sounds\e.wav")
EndFunc

func f()
   SoundPlay("sounds\f.wav")
EndFunc

func g()
   SoundPlay("sounds\g.wav")
EndFunc

func h()
   SoundPlay("sounds\h.wav")
EndFunc

func i()
   SoundPlay("sounds\i.wav")
EndFunc

func j()
   SoundPlay("sounds\j.wav")
EndFunc

func k()
   SoundPlay("sounds\k.wav")
EndFunc

func l()
   SoundPlay("sounds\l.wav")
EndFunc

func m()
   SoundPlay("sounds\m.wav")
EndFunc

func n()
   SoundPlay("sounds\n.wav")
EndFunc

func o()
   SoundPlay("sounds\o.wav")
EndFunc

func p()
   SoundPlay("sounds\p.wav")
EndFunc

func q()
   SoundPlay("sounds\q.wav")
EndFunc

func r()
   SoundPlay("sounds\r.wav")
EndFunc

func t()
   SoundPlay("sounds\t.wav")
EndFunc

func u()
   SoundPlay("sounds\u.wav")
EndFunc

func v()
   SoundPlay("sounds\v.wav")
EndFunc

func w()
   SoundPlay("sounds\w.wav")
EndFunc

func x()
   SoundPlay("sounds\x.wav")
EndFunc

func y()
   SoundPlay("sounds\y.wav")
EndFunc

func z()
   SoundPlay("sounds\z.wav")
   EndFunc

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-18 20:19:14

@The terminator:
I would not suggest you build a game in AutoIt. While AutoIt is a good programming language, it was not intended for this kind of thing. Also, to help you out, we'd need your other files that you included up there. The only file we don't need is gUIConstants.au3, as we can always get that for ourselves. I'm assuming that the other include files that you included are custom (your own)? If not, please give us the concise location of where I can find these files so that I can provide a more helpful answer than this.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2015-01-18 20:45:57

OK, thanks for all, I will pacage the game for you, you will receive it as an email because I indeed give the source code, but I don't want my sounds being stealed.

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-22 23:11:23

hello?
can someone please help me?

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-23 10:47:46

Hi there,

I haven't autoit3 installed anymore, so I cannot test it, but I think this is the answer, from the documentation page:
It is recommended to use lower-case keys/characters (e.g. "b" and not "B") when setting hotkeys to avoid errors as with some keyboard layouts upper and lower case keys may be mapped differently.

Plus it could be a little confusing... I suggest you to try with something like:
HotKeySet("a", "a_function")

func a_function()
SoundPlay("sounds\a.wav")
EndFunc

Hope this helps.

2015-01-24 23:44:05

ow'w'w'w'w'w'w'w'w'w'w'w'w thanks! I will try it!

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-24 23:53:43

oww this doesn't work. I did indeed modify the scripty but still got that nasty error that the sounds doesn't play back to me.
well I will let you all take a look at it.
#include "audio.au3"
#include "keyinput.au3"
#include "menusapi.au3"
#include  "randomizer.au3"
#include "sapi.au3"
#include "file.au3"
#include "GUIConstants.au3"

$loop = $device.OpenSound("sounds\loop.wav", 1)
$loop.repeating = 1

GUICreate("rithm immitations version 3.0 by SB Soft")
GUISetState(@SW_Show)

;lets make this buggy thing
menu()

func menu()
   $loop.play
   $m1 = Create_audio_menu("rithm Immitations main menu", "start, credits, contact media, what basically happened to the game, exit")
   Select
   Case $m1 =1
      $loop.stop
   start()
Case $m1 =2
   $loop.stop
   credits()
Case $m1 =3
   $loop.stop
   contact()
Case $m1 =4
   $loop.stop
   gamething()
Case $m1 =5
   $loop.stop
   beep(400, 500)
   speak("Thanks for playing, exiting program")
   beep(400, 500)
   exit
EndSelect
EndFunc

func start()
   speak("this is the storyline. You were playing music at A bar, but the persons suddenly left you alone. Now you need to play for the owner to win money, at least you think so. Start?")
   sleep(1000)
   speak("now!")

While 1
   ;a loop
WEnd

HotKeySet("a", "a")
HotKeySet("b", "b")
HotKeySet("c", "c")
HotKeySet("d", "d")
HotKeySet("e", "e")
HotKeySet("f", "f")
HotKeySet("g", "G")
HotKeySet("h", "h")
HotKeySet("i", "i")
HotKeySet("j", "j")
HotKeySet("k", "k")
HotKeySet("l", "l")
HotKeySet("m", "m")
HotKeySet("n", "n")
HotKeySet("o", "o")
HotKeySet("p", "p")
HotKeySet("q", "q")
HotKeySet("r", "r")
HotKeySet("s", "s")
HotKeySet("t", "t")
HotKeySet("u", "u")
HotKeySet("v", "v")
HotKeySet("w", "w")
HotKeySet("x", "x")
HotKeySet("y", "y")
HotKeySet("z", "z")
HotKeySet("escape", "backtomenu")
EndFunc

func credits()
   beep(450, 550)
   speak("rithm immitations credits. Thanks to brad, for suplying me with some of the sounds I used in this game. Thanks to bailee alger, amir, Yashua Valdez, Hassan, and bee for helping me in this game, giving me ideas, sounds, and motivation!")
   menu()
EndFunc

func contact()
   beep(500, 500)
   speak("contact media. I still don't have a")
   beep(400, 250)
   speak("domain. Sorry for the bad word he he. well, so you can't hit me up in a webpage, unfortunately, because I have no money actually, and the few I have I am planning to use in other things. Anyways, you can hit me at")
   beep(800, 600)
   speak("Gmail. galapagos.miguel.angel at gmail.com")
   beep(800, 600)
   speak("Skype, raton.miguelito.glps")
   beep(800, 600)
   speak("Audiogames.net forum, the terminator. and well that's all guys. Bye bye.")
   menu()
EndFunc

func gamething()
   speak("what basically happened to rithm immitations, is a complete reconstruction or rewrite. Maybe the old version is better because this one is still progressing, while not in progress or beta or something like that. And well, it's all that happened to the game. thanks for entering in this menu choice.")
   menu()
EndFunc

func backtomenu()
   speak("quitting...")
   menu()
EndFunc

func a()
   SoundPlay("sounds\a.wav")
EndFunc

func b()
   SoundPlay("sounds\b.wav")
EndFunc

func c()
   SoundPlay("sounds\c.wav")
EndFunc

func d()
   SoundPlay("sounds\d.wav")
EndFunc

func e()
   SoundPlay("sounds\e.wav")
EndFunc

func f()
   SoundPlay("sounds\f.wav")
EndFunc

func g()
   SoundPlay("sounds\g.wav")
EndFunc

func h()
   SoundPlay("sounds\h.wav")
EndFunc

func i()
   SoundPlay("sounds\i.wav")
EndFunc

func j()
   SoundPlay("sounds\j.wav")
EndFunc

func k()
   SoundPlay("sounds\k.wav")
EndFunc

func l()
   SoundPlay("sounds\l.wav")
EndFunc

func m()
   SoundPlay("sounds\m.wav")
EndFunc

func n()
   SoundPlay("sounds\n.wav")
EndFunc

func o()
   SoundPlay("sounds\o.wav")
EndFunc

func p()
   SoundPlay("sounds\p.wav")
EndFunc

func q()
   SoundPlay("sounds\q.wav")
EndFunc

func r()
   SoundPlay("sounds\r.wav")
EndFunc

func t()
   SoundPlay("sounds\t.wav")
EndFunc

func u()
   SoundPlay("sounds\u.wav")
EndFunc

func v()
   SoundPlay("sounds\v.wav")
EndFunc

func w()
   SoundPlay("sounds\w.wav")
EndFunc

func x()
   SoundPlay("sounds\x.wav")
EndFunc

func y()
   SoundPlay("sounds\y.wav")
EndFunc

func z()
   SoundPlay("sounds\z.wav")
   EndFunc

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-25 15:23:04 (edited by Alan 2015-01-25 15:25:09)

Hi,

Sorry, I can not test your code, but I could suggest some points:
1. What about this loop, just before hotkeysets?
While 1
   ;a loop
WEnd
How do you exit this loop? It will be runing forever without an exiting point, so your program never executes the code for seting hotkeys. Or maybe I am loosing something...
2. If it's a bug, just move
the corresponding callings to hotkeyset before the loop, or place it in the loop, inside a conditional statement to ensure that it will be executet only the first time.
3. If not, place here and there some messageboxes to debug your code and detect exactly if hotkeyset() is never executed, plus others inside a target function (a(), for example). this way you can determine if the function does its work when you press the corresponding key.

No more ideas here, hope this helps.

2015-01-25 18:02:07

OK, thanks a lot, will try it.

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-25 23:20:25

hi.
sorry it doesn't work. At least for me

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-25 23:27:39

You may seriously want to consider a different language.  I think the reason you're not getting help is because few if any of us know what this is.
If your goal is a game, then autoit is the last thing you want to be using.  The last.  Behind even C/C++.

My Blog
Twitter: @ajhicks1992

2015-01-25 23:34:22

I did fix this hotkeyset func.
but escape doesn't work now. What should I do?
#include "audio.au3"
#include "keyinput.au3"
#include "menusapi.au3"
#include  "randomizer.au3"
#include "sapi.au3"
#include "file.au3"
#include "GUIConstants.au3"

HotKeySet("a", "a")
HotKeySet("b", "b")
HotKeySet("c", "c")
HotKeySet("d", "d")
HotKeySet("e", "e")
HotKeySet("f", "f")
HotKeySet("g", "G")
HotKeySet("h", "h")
HotKeySet("i", "i")
HotKeySet("j", "j")
HotKeySet("k", "k")
HotKeySet("l", "l")
HotKeySet("m", "m")
HotKeySet("n", "n")
HotKeySet("o", "o")
HotKeySet("p", "p")
HotKeySet("q", "q")
HotKeySet("r", "r")
HotKeySet("s", "s")
HotKeySet("t", "t")
HotKeySet("u", "u")
HotKeySet("v", "v")
HotKeySet("w", "w")
HotKeySet("x", "x")
HotKeySet("y", "y")
HotKeySet("z", "z")
HotKeySet("ESC", "backtomenu")

$loop = $device.OpenSound("sounds\loop.wav", 1)
$loop.repeating = 1

GUICreate("rithm immitations version 3.0 by SB Soft")
GUISetState(@SW_Show)

;lets make this buggy thing
menu()

func menu()
   $loop.play
   $m1 = Create_audio_menu("rithm Immitations main menu", "start, credits, contact media, what basically happened to the game, exit")
   Select
   Case $m1 =1
      $loop.stop
   start()
Case $m1 =2
   $loop.stop
   credits()
Case $m1 =3
   $loop.stop
   contact()
Case $m1 =4
   $loop.stop
   gamething()
Case $m1 =5
   $loop.stop
   beep(400, 500)
   speak("Thanks for playing, exiting program")
   beep(400, 500)
   exit
EndSelect
EndFunc

func start()
   speak("this is the storyline. You were playing music at A bar, but the persons suddenly left you alone. Now you need to play for the owner to win money, at least you think so. Start?")
   sleep(1000)
   speak("now!")

While 1
   ;a loop
WEnd

EndFunc

func credits()
   beep(450, 550)
   speak("rithm immitations credits. Thanks to brad, for suplying me with some of the sounds I used in this game. Thanks to bailee alger, amir, Yashua Valdez, Hassan, and bee for helping me in this game, giving me ideas, sounds, and motivation!")
   menu()
EndFunc

func contact()
   beep(500, 500)
   speak("contact media. I still don't have a")
   beep(400, 250)
   speak("domain. Sorry for the bad word he he. well, so you can't hit me up in a webpage, unfortunately, because I have no money actually, and the few I have I am planning to use in other things. Anyways, you can hit me at")
   beep(800, 600)
   speak("Gmail. galapagos.miguel.angel at gmail.com")
   beep(800, 600)
   speak("Skype, raton.miguelito.glps")
   beep(800, 600)
   speak("Audiogames.net forum, the terminator. and well that's all guys. Bye bye.")
   menu()
EndFunc

func gamething()
   speak("what basically happened to rithm immitations, is a complete reconstruction or rewrite. Maybe the old version is better because this one is still progressing, while not in progress or beta or something like that. And well, it's all that happened to the game. thanks for entering in this menu choice.")
   menu()
EndFunc

func backtomenu()
   speak("quitting...")
   menu()
EndFunc

func a()
   SoundPlay("sounds\a.wav")
EndFunc

func b()
   SoundPlay("sounds\b.wav")
EndFunc

func c()
   SoundPlay("sounds\c.wav")
EndFunc

func d()
   SoundPlay("sounds\d.wav")
EndFunc

func e()
   SoundPlay("sounds\e.wav")
EndFunc

func f()
   SoundPlay("sounds\f.wav")
EndFunc

func g()
   SoundPlay("sounds\g.wav")
EndFunc

func h()
   SoundPlay("sounds\h.wav")
EndFunc

func i()
   SoundPlay("sounds\i.wav")
EndFunc

func j()
   SoundPlay("sounds\j.wav")
EndFunc

func k()
   SoundPlay("sounds\k.wav")
EndFunc

func l()
   SoundPlay("sounds\l.wav")
EndFunc

func m()
   SoundPlay("sounds\m.wav")
EndFunc

func n()
   SoundPlay("sounds\n.wav")
EndFunc

func o()
   SoundPlay("sounds\o.wav")
EndFunc

func p()
   SoundPlay("sounds\p.wav")
EndFunc

func q()
   SoundPlay("sounds\q.wav")
EndFunc

func r()
   SoundPlay("sounds\r.wav")
EndFunc

func s()
   SoundPlay("sounds/s.wav")
EndFunc

func t()
   SoundPlay("sounds\t.wav")
EndFunc

func u()
   SoundPlay("sounds\u.wav")
EndFunc

func v()
   SoundPlay("sounds\v.wav")
EndFunc

func w()
   SoundPlay("sounds\w.wav")
EndFunc

func x()
   SoundPlay("sounds\x.wav")
EndFunc

func y()
   SoundPlay("sounds\y.wav")
EndFunc

func z()
   SoundPlay("sounds\z.wav")
   EndFunc

no matter what you do, alwais, ghosts will be there. Demonic spirits waiting for you. Charlie Charlie are you here? suddenly, charlie appears with a knife. He killed me! charlie charlie are you here? tell me if it's yes. Are you gonna persew me or you're leaving me in peaze? oh my gosh charlie is indeed here! he's about to kill me!
:D

2015-01-26 11:14:49

Hi,

You are missing {} surrounding the key code. Try it as:
HotKeySet("{ESC}", "backtomenu")