Log In  

Why if i put a:
PSET(...)
command alone the program will run.
but if i put a :
SFX(0)
command alone i wont hear a thing ? (i have made the '0' sfx in sfx editor)

P#85236 2020-12-10 15:05

well, i would assume that SFX only play while the program is running, so if your program immediately terminates (goes to the command prompt) then its probably that you need to keep the program running to hear it. (please note, you can listen to SFX by pressing space in the editor, if that's what this is about)

P#85237 2020-12-10 15:47

What is different in executing pset and sfx ?

P#85239 2020-12-10 16:29

pset is drawing something on the screen, its just changing the memory adress of that certain pixel into another colour (I think I explained that correctly)
Sfx actually goes to that memory adress, and then reads whats in it.
Did I explain that right?

P#85245 2020-12-10 17:08 ( Edited 2020-12-10 17:09)

So SFX(..) makes a request , but then a process or threads exits and there is no one to process that returned data?

P#85249 2020-12-10 17:44

Yes
I got all this out of @Krystman 's video on PICO-8 memory
He explains it all, and you can pretty much figure the rest out

P#85251 2020-12-10 18:29

something like

sfx(0) repeat flip() until btnp(4) or btnp(5)

can work if you want something to type at the command line

P#85254 2020-12-10 18:55

@packbat 's idea might work yeah

P#85255 2020-12-10 19:36

Just checked - worked on my machine.

If you want to be slightly fancier:

sfx(0) repeat flip() until stat(16)==-1

should play the sfx and stop the moment the sfx ends (stat(16) returns the SFX number playing on channel 0, and that's -1 when nothing's playing)

P#85258 2020-12-10 22:08

Thanks. I am learning my kid programming, so having to add update and draw for sfx to work was kind of counterintuitive (regarding what a command is as we teach it).
And i mean in contrast with most other commands.

P#85276 2020-12-11 08:51 ( Edited 2020-12-11 09:11)

It's pretty counterintuitive, yeah - I'm not sure why the sound card only runs when the game loop is running (either flip() commands or the _update()/_draw() pair of functions) but it does mean you have to do shenanigans to hear sfx() and music() commands output sound.

P#85311 2020-12-11 22:12

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 10:31:22 | 0.024s | Q:26