sample path code getting error

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
melristau
Posts: 56
Joined: Tue Jul 14, 2015 5:15 pm
Contact:

sample path code getting error

Post by melristau »

Can't see why this is error-ing
pathFunctionError.png
rebuilding visual programming app originally created in 1993 as Hypercard stack
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: sample path code getting error

Post 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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
melristau
Posts: 56
Joined: Tue Jul 14, 2015 5:15 pm
Contact:

Re: sample path code getting error

Post 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
rebuilding visual programming app originally created in 1993 as Hypercard stack
melristau
Posts: 56
Joined: Tue Jul 14, 2015 5:15 pm
Contact:

Re: sample path code getting error

Post 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.
rebuilding visual programming app originally created in 1993 as Hypercard stack
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: sample path code getting error

Post 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
Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: sample path code getting error

Post by Mikey »

Wow, that code block looks familiar to me. Weird.
Post Reply