Expansion - Access AdditionalSourcecode file
-
Getting a Can't find data file error with the below code:
maxrandom = newExpansion.loadDataFile("SMNUMBER.js");
SMNUMBER.js is in the AdditionalSourcecode folder in the expansion folder.
the code in that file is simply:
{ 34 }
Any ideas?
-
-
@lindon
thanks
-
@danh This function is for loading
json
data. Your file should contain a json object and the file extension should be.json
. -
Post a bigger code example so I can see what you're doing more fully, or post a minimal snippet
-
@d-healey this is the crux of what I'm trying to do: switch expansions via combobox (fine), and change the value of 'maxrandom' via a json in each expansion.
var maxrandom; inline function newcombobox(newExpansion) { if(isDefined(newExpansion)) { maxrandom = newExpansion.loadDataFile("SMNUMBER.json"); Console.print(maxrandom); } else { maxrandom = 313; } }
-
-
@d-healey said in Expansion - Access AdditionalSourcecode file:
var maxrandom;
Stop using
vars
:preg?
Show us where you are getting
newExpansion
from.erm.... I'm not?
Everything else is working though
Switching images, sample maps etc -
reg?
In this case, yes.
erm.... I'm not?
Where are you calling your newcombobox function from?
-
@d-healey interface script
-
@danh Show me
-
This post is deleted! -
@danh Can you show me where you are calling your function from
-
expHandler.setExpansionCallback(newcombobox); newcombobox(undefined);
-
@danh Well there's your problem. undefined is not an expansion.
-
@d-healey thanks! ok I've commented that out (!) but error persists... hmmmmm
-
@danh I'm seeing tiny little windows into your code so it's impossible for me to debug this. I suggest creating a minimal snippet that contains only what's necessary to demonstrate this problem.
-
@d-healey yep fair enough, will do
-
HiseSnippet 1288.3ocsW0sahaDEdbR71h6OZW0dSuyhapQJkEZR2VopUMABrA0.DAjs6pznUSrGfYy3YrrGu.pJOH80nOY8Mn8L1FaClMkfT8Efmyey24mYNGeouvlDDH7QZkFsvifz9b8gK3xoMmhobTmyPZeodWbfj3aFSpwBObP.wAoos+qTDzJc.J54u+kFXFlaSxHgPuVPsIWPcoxLpWdxuRYr1XGxHpaNoO9jN1BdSASDB3Ye8ZHOr8c3IjdXkX6oizdRKGpT3OThkj.PlFBmECmJlwik+0z.5sLhZQczPvPwjQMmRYNWtzWCPHsCtLyy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51uW+gus2nyM505pA8Ou+fdvXfEF2AFzR3DxvxUm9RMlYBC.LqLxipIO.Q4h7ig9HFIq1CNR11Bwmoeopyzlw3da.iPJ6+CLlLH6Wn2Z7XHgkAvCza+lccp0+isefHTBMt5hg9WpRgdgtCg42sIvty4v0Hpxi8TGAhWWSsVEAFR3NQK9G3IgYc0ZsDl0WxDJxr8EuyN9fiZT4OMhBfIdzWFTB9DEXsY8kmQz0qUsFxElZ+c11J2+6piPaVmueGz4ncPmi2Ac9gcPmWrC57i6fN+zCpi5ClNMTJbiON.DtrUzcUZZs3XnxJpJD8u.SjMMJ.
-
Place this at the top of the function and tell me what output it gives.
Console.print(newExpansion.getRootFolder().toString(0));