import audioclip array [solved]

Started by HandsFree, Wed 12/08/2015 17:54:43

Previous topic - Next topic

HandsFree

In GlobalScript.asc I have this:
AudioClip *minstrel_tune[5];

I want to use that elsewhere, so I think I should put an import statement in GlobalScript.ash, is that correct?
If so, how do I write that statement? Cause I keep getting errors.
import AudioClip *minstrel_tune[5]; ??
(Also tried without the *)

thanks

Crimson Wizard

#1
Regarding import/export, this was explained many times in the past few months; I'd better link to existing thread:
For example: http://www.adventuregamestudio.co.uk/forums/index.php?topic=52018

Regarding erros, can you please copy paste the error text here?
Your declaration looks fine to me. But there could be numerous errors related to variable declaration, that are and aren't relevant to import keyword. This also matters if that's compilation error you get in the Editor, or runtime error you get when running the game.

HandsFree

Yes, I saw that, but since this one is with an *-sign, I'm not sure how that works.
In GlobalScript.asc:
AudioClip *minstrel_tune[5];

Code: ags

function game_start() { 
...
minstrel_tune[0] = aLute_song1;
minstrel_tune[1] = aLute_song2;
...
}

In GlobalScript.ash:
import AudioClip *minstrel_tune[5];

In room14.asc:
MinstrelMusic = minstrel_tune[iMinstrelTune].Play(eAudioPriorityHigh, eRepeat);

Error: Unable to create local script: Runtime error: unresolved import 'minstrel_tune'.

thanks

Crimson Wizard

You forgot to do "export minstrel_tune;" in GlobalScript.asc.


SMF spam blocked by CleanTalk