char getName[1000];
engine->GetPathToFileInCompiledFolder("",getName);//Strangeland.exe
Mix_LoadMUS(getname+"ffv6.mp3");
So, this is throwing a compile error, I'm looking to use a code, that grabs the folder in which the game is being executed from (which can vary of course depending on where the user/player is installing the thing)
And from that directory (let's say it's C:/Strangeland) set a path name for an mp3.
Right now, I've been able to run my code perfectly setting specific paths of course, but I wanna set a relative path!
I have no absolute clue how 'GetPathToFileInCompiledFolder' works and what it returns. Mix_LoadMUS takes a char as an argument.
EDIT:
char* path;
_get_pgmptr(&path);
const char * getv = (const char *)path;
engine->AbortGame(getv);
This will print the absolute path + the exe
First of all
Mix_LoadMUS(getname+"ffv6.mp3");
This is wrong in C/C++ because you are trying to sum char* pointers rather than concatenate the string (the result of + is a memory address).
To combine arrays of chars you may use something like snprintf.
Formal example:
char getDir[1000];
char fullPath[1000];
engine->GetPathToFileInCompiledFolder("",getDir);
snprintf(fullPath, sizeof(fullPath), "%s/%s", getDir, "ffv6.mp3");
Mix_LoadMUS(fullPath);
On the other hand, GetPathToFileInCompiledFolder is supposed to do this for you:
char fullPath[1000];
engine->GetPathToFileInCompiledFolder("ffv6.mp3", fullPath);
Mix_LoadMUS(fullPath);
EDIT: But what bothers me, is that GetPathToFileInCompiledFolder may return relative path (relative to current working directory). Is it necessary for you to have absolute path instead?
The GetPathToFile is perfect <3 Forgot to reply here!
Irrelevant question, does
Character_GetX = (SCAPI_CHARACTER_GETX)engine->GetScriptFunctionAddress("Character::get_X");
return screen coordinates or room coordinates?
Quote from: Dualnames on Sat 23/02/2019 01:01:07
Irrelevant question, does
Character_GetX = (SCAPI_CHARACTER_GETX)engine->GetScriptFunctionAddress("Character::get_X");
return screen coordinates or room coordinates?
Room coordinates, you are getting Character.X script property.