# Variables aren't being called correctly in syntax analysis

The variable "currentItem" does exist, though:

I made the script it's trying to run using syntax analysis. But why would these scripts be unable to call a global variable...?

you're right

note: the variable is indeed global.

edit: actually, doesn't seem to work for any kind of variable

what do you mean with "built-in reverse codification"? There is a codification feature which you're not at all using for this and which means something entirely different. Please don't mix up terms for features. Can you break down the steps to reproduce what you think might be a bug in a simple way that doesn't rely on a gargantuan project? Thanks!

(edit) Oops! Saw @ego-lay_atman-bay's post, which explains it. Thanks! Investigating...

Then what do you call these?

Script builder functions.

Syntax analysis

What you get when you construct a function with JOIN is and unbound function, i.e. one that isn't connected to any sprite and therefore also cannot resolve any variable references, attributes or custom block definitions. If you just use global primitives that's not going to matter, but if your joined script references stuff you need to bind it to an environment first. You can either use the tell or ask blocks for this, or create a reified ("stand-alone") bound function using the (attribute) of (object) reporter on it.

BUT as I've been checking up on this right now I've discovered a bug in the binding mechanism which I've just now fixed. It'll be online at the next patch later this week.

Thanks for the report!

See this script:

Here's what it looks like in syntax analysis...

Everything should work fine, right? "Var" exists as a global variable and the message broadcasts correctly, but...

What happened?
Even more strangely is that it says the error says it was "inside a custom block" when there were none involved.

I think (don't take my word for it) that the script builder functions are basically creating a custom block, so the error says it's in a custom block.

Is there any way to bind it to the environment of an existing anonymous procedure?

what I wrote. The patch hasn't been released yet, just wait a couple of days.