Page 1 of 1

filename set as variable?

PostPosted: Wed Sep 27, 2006 11:31 pm
by pixelpoop
Hello all,
Can I have a filename set as a variable? Here is what I am trying to do:
on create actor
Code: Select all
variable="data\filename.wav";

on collision
Code: Select all
PlaySound2((variable), 1, 1, 0);

but it doesn't seem to work

PostPosted: Thu Sep 28, 2006 12:23 am
by makslane
You need to create a string variable and use the strcpy function:

Code: Select all
strcpy(variable, "data\filename.wav");

GP2X sound channels

PostPosted: Thu Sep 28, 2006 3:29 am
by pixelpoop
thanks it works nice (i'm new to programing)

do you know if the GP2X has a maximum number of simultaneous sounds that it can play? I couldn't find anthing about it in the GP2X manuals or on their forums.

PostPosted: Thu Sep 28, 2006 3:45 am
by makslane
The Game Editor manage the sound mixer for you.
All will depends of CPU speed.
The better will be make a test.

BUG?! strcat and strcpy

PostPosted: Sat Sep 30, 2006 4:06 pm
by pixelpoop
using strcat and strcpy to copy a file location/name works when I use GE's "game mode" button, BUT when I export it to windows or GP2x they won't work.

PostPosted: Sun Oct 01, 2006 12:05 am
by makslane
Are you using the variable to open a sound?
Note, you need to put the file name in a PlaySound, if is a sound, even if is a comented line:

Code: Select all
//PlaySound2("data\filename.wav", 1, 1, 0);


When you export the game, only the used resources will be exported/
So, if you use a variable you need to tell the Game Editor this resource will be used in the exported game (I home make a better system in the future)

PostPosted: Sun Oct 01, 2006 1:45 pm
by pixelpoop
thanks,
It works when I include your code.