filename set as variable?

Non-platform specific questions.

filename set as variable?

Postby pixelpoop » Wed Sep 27, 2006 11:31 pm

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
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby makslane » Thu Sep 28, 2006 12:23 am

You need to create a string variable and use the strcpy function:

Code: Select all
strcpy(variable, "data\filename.wav");
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

GP2X sound channels

Postby pixelpoop » Thu Sep 28, 2006 3:29 am

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.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby makslane » Thu Sep 28, 2006 3:45 am

The Game Editor manage the sound mixer for you.
All will depends of CPU speed.
The better will be make a test.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

BUG?! strcat and strcpy

Postby pixelpoop » Sat Sep 30, 2006 4:06 pm

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.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby makslane » Sun Oct 01, 2006 12:05 am

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)
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby pixelpoop » Sun Oct 01, 2006 1:45 pm

thanks,
It works when I include your code.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest