Page 1 of 1

sample path code getting error

Posted: Thu Aug 18, 2016 6:45 pm
by melristau
Can't see why this is error-ing
pathFunctionError.png

Re: sample path code getting error

Posted: Thu Aug 18, 2016 7:03 pm
by FourthWorld
If that's being call from a substack, it will have no filename itself. You can get the filename of its mainstack by using the "effective" keyword, e.g.:

Code: Select all

put the effective filename of this stack into nameToSave
Tip: When posting code here please post the text itself (ideally between code tags) rather than a screen shot to make it easier for others revise it for you.

Re: sample path code getting error

Posted: Thu Aug 18, 2016 7:11 pm
by melristau
Got it - Thanks FourthWorld

Still getting error:

stack "Planner11": compilation error at line 14 (Chunk: can't create a variable with that name (explicitVariables?)) near "nameToSave", char 45

Code: Select all

function path
   put the effective filename of this stack into nameToSave
   set the itemDelimiter to slash
   put item 1 to -2 of nameToSave & slash into tPath
   return tPath
end path

Re: sample path code getting error

Posted: Thu Aug 18, 2016 7:43 pm
by melristau
OK - I see that I recently activated "strict compilation"... getting errors on several of my scripts that previously worked OK. Deactivated that and I'm fine for now.

Re: sample path code getting error

Posted: Thu Aug 18, 2016 7:46 pm
by Klaus
Hi Mel,

"strict compilation" requires to declare every single local variable you are using in your scripts or it will "rain" errors! :D


Best

Klaus

Re: sample path code getting error

Posted: Fri Aug 19, 2016 3:41 pm
by Mikey
Wow, that code block looks familiar to me. Weird.