2019-08-01 01:23:29

Hey guys,
So I'm coding my first BGT project, and it's a simple dynamic menu with key mapping. Unfortunately, I'm struggling with some areas.
I'm going to paste a link here giving access to the file in my GDrive, but anyways here's where I'm having issues.
1. Playing sounds. I specified  for example, if(!key_pressed(KEY-A)); I was able to open a brace.
What I want it to do is to play piano0, the first note, assignedtothe A key. So I opened and typed like this.
{
piano0.play(?piancC.wav") // The wave file assigned to that sound.

Now, am I doing something insanely wrong here, or do I need to fix things?
To look at the full BGT file, use this link:
https://drive.google.com/file/d/17Texb_ … p=drivesdk
If you are having issues with that link, you can download it from my site here:
http://tunmi13.jc-hosting.me/IP.bgt
Thanks!

-----
YouTube
GitHub
Discord: @tunmi13#1880

2019-08-01 01:26:35

ok, first, i get this when trying to download
Not Found
The requested URL /IP.bgt was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.4.39 (Ubuntu) Server at tunmi13.jc-hosting.me Port 443
second, you'd probably want, an if statement saying that if the key is pressed, play the sound, piano1.opay("paino1.wav")

2019-08-01 01:35:26

One issue I saw is that when you tell it to play, your not supposed to give the filename too, piano1.play();, the play function takes no arguments, you allready told it what sound to play.

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)

2019-08-01 02:07:10

Wow. and All this time i've been stressing over that area. Thanks a lot, Ty and redfox.

-----
YouTube
GitHub
Discord: @tunmi13#1880

2019-08-01 02:08:11

piano0.load("piancC.wav");
piano0.play();

I also noticed you have a question mark instead of the first quotation mark for the sound

2019-08-01 03:56:16

Yeah, i noticed that too.

2019-08-01 03:56:42

Sorry about double post, but also, NP tunmi.

2019-08-01 20:56:48

Hi,
The question mark explanation: I'm typing using a braille display, and a quote is dots 2-3-6. It is also a question mark. When I typed dots 2-3-6, I forgot to specify it was a quote, so it read it as a question mark.

-----
YouTube
GitHub
Discord: @tunmi13#1880

2019-08-01 21:32:36

Yeah, braille does that. While coding, i recommend using a qwerty keyboard, unless typing text, like dialogs.

2019-08-01 21:47:21

I was coding the game with my QWERTY keyboard, but I thought I could edit it with my BrailleSense Polaris.
When I did, it messed with quotes and other stuff. That's what I mean by the question mark thing. I'm not doing that again anytime soon. LOL

-----
YouTube
GitHub
Discord: @tunmi13#1880

2019-08-01 21:50:07

Sorry about double posting, but I received another error, something about my sounds not being declared.
Do I have to load the sounds when the user performs the key press, or must I load the sounds upon calling up void piano?
Thanks!

-----
YouTube
GitHub
Discord: @tunmi13#1880

2019-08-01 21:59:36

You can either load them when the function is called (recommended), or stream them when the keys are pressed, may cause high CPU usage.

2019-08-01 22:12:03

You have two options there. You can either, 1: load the sounds at the start of the function, I recommend this, or stream them when the key is pressed to play the sound. The only problem with the streaming option is it might cause high cpu usage on some machines.

2019-08-01 23:14:11

I put the load line in my first post. You can put it directly above the play line. Make sure you have braces after key pressed since now you are loading and playing

2019-08-02 00:59:58

Yup, zarvox is correct.