tortuosit 486 Posted April 1, 2015 (edited) Hi, I cannot get ArmA to play music at all. I want to play via a mod. config.cpp inside the pbo has CfgMusic: class Extended_PostInit_EventHandlers { class TORT_playmusic { clientInit = "call compile preprocessFileLineNumbers '\TORT_playmusic\init.sqf'"; disableModuload = true; }; }; class CfgMusic { class test1 { name = "test1"; sound[] = {"\TORT_playmusic\Music\test1.ogg", db+3, 1.0}; }; }; init.sqf has: hint "TESTTEST"; playMusic "test1"; Hint appears, no music. Music is here, example: c:\Program Files (x86)\Steam\SteamApps\common\Arma 3\@tort_playMusic\Music\test1.ogg Ideas? Music format is alright. ---------- Post added at 13:36 ---------- Previous post was at 13:27 ---------- Solved. Argh. Referenced sound file inside pbo, but they are outside. This is correct: sound[] = {"\@TORT_playmusic\Music\test1.ogg", db+3, 1.0}; ---------- Post added at 14:27 ---------- Previous post was at 13:36 ---------- Whats wrong here? Hint appears, music plays, but "Generic error in expression in line 7" - it does not want the sleep here. hint "tort_PlayMusic running"; sleep 5; while {true} do { //playmusic format ["tmusic_%1", ceil(random 37)]; playmusic "tmusic_1"; sleep 5; }; ---------- Post added at 14:38 ---------- Previous post was at 14:27 ---------- OK, it has to be inside a "0 = [] spawn {" ---------- Post added at 14:45 ---------- Previous post was at 14:38 ---------- NEW QUESTION: How do I define the oggs length, I think in cfgmusic? If I know the tracks length, I know how long I have to wait at least. Before next track starts. This is my simple main loop. 0 = [] spawn { sleep 5 + random 30; while {true} do { playmusic format ["tmusic_%1", ceil(random 37)]; sleep 120 + random 120; }; }; ALSO, can I have ArmA count the number of files inside my sound folder? And I wish I could make cfgmusic part somewhat adaptive. Edited April 1, 2015 by tortuosit Share this post Link to post Share on other sites
inlesco 233 Posted April 1, 2015 .ogg length is irrelevant since we have this: https://community.bistudio.com/wiki/addMusicEventHandler Or did I misunderstood your intentions? Counting sound files in a folder? Impossible, unless there's a way to write a bash script and export its variable to Arma. Share this post Link to post Share on other sites
tortuosit 486 Posted April 2, 2015 (edited) Great, never worked with eventhandlers, looks like that one is what I need. That cfgmusic definition part is clunky, and unfortunately a very static thing and also has to be inside the pbo (config.cpp), not sure if it can be freed to description.ext when it's a mod. And that means, after all, a simple music playing mod can not be convenient. I have written a very simple one with "wait after init" min/max seconds and "waiting time until next" min/max seconds. Best solution for convenience I found is, in cfgmusic I define tracks 1.ogg .. 100.ogg and user can simply put ogg files with those file names into a music folder. But due to cfgmusic inside pbo and music outside pbo, the addon folder can not be renamed or duplicated. I personally would love to use a per-mission sound addon, which will not work. BASIC QUESTION! Is that really correct? To my knowledge, everything outside the pbo can only be referenced from inside the pbo via absolute or relative paths. But relative from Arma3Dir. So, the @addon folder can not be renamed. Edited April 2, 2015 by tortuosit Share this post Link to post Share on other sites