can't create a variable with that name
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
can't create a variable with that name
can't create a variable with that name
Hi All,
I created a local variable for one script and i use it
If i use after an other script with local variable no declared
I have sometimes one error message :
"compilation error at line 4 (Chunk: can't create a variable with that name (explicitVariables?)) near "old", char 18"
I think it is linked
If i use declared local variable one time the others scripts must also declare every varaible ?
Regards
Jean-Marc
Hi All,
I created a local variable for one script and i use it
If i use after an other script with local variable no declared
I have sometimes one error message :
"compilation error at line 4 (Chunk: can't create a variable with that name (explicitVariables?)) near "old", char 18"
I think it is linked
If i use declared local variable one time the others scripts must also declare every varaible ?
Regards
Jean-Marc
Ji Jean-Marc,
Why do you have explicitVariables set to true?
If you define a variable inside a handler, then you have to declrare it inside all other handlers that use the same variable as well. You can also declare it outside the handler. If you declare it outside a handler, it is sufficient to declare once in all other scripts that contain handlers using your variable. For example:
This is one script, with two handlers, which both use the same variable lSomeVar. Ths variable needs to be declared only once, outside all handlers.
If you want to use the same variable with a similar name in a different script, you have to declare it again and it will still be a different variable.
The two variables lSomeVar in the button script and the card script are two different variables, which are declared for all handlers in those scripts. They don't affect each other and here I'm using a (otherwise useless) function to transfer the value of one variable lSomeVar to another variable lSomeVar.
If you use global variables, you need to declare them in all scripts again, if declared outside all handlers, just like the local variables. However, the variable will be the same in both scripts and a value stored in one script will still be available in any other script.
If this doesn't solve your problem, you might want to post your script.
Best,
Mark
Why do you have explicitVariables set to true?
If you define a variable inside a handler, then you have to declrare it inside all other handlers that use the same variable as well. You can also declare it outside the handler. If you declare it outside a handler, it is sufficient to declare once in all other scripts that contain handlers using your variable. For example:
Code: Select all
-- script of button 1
local lSomeVar
on mouseUp
put x into lSomeVar
foo
end mouseUp
on foo
put someFunction(lSomeVar) into fld 1
end foo
If you want to use the same variable with a similar name in a different script, you have to declare it again and it will still be a different variable.
Code: Select all
-- card script
local lSomeVar
function someFunction theVar
put theVar into lSomeVar
return "Whatever Valiue"
end someFunction
If you use global variables, you need to declare them in all scripts again, if declared outside all handlers, just like the local variables. However, the variable will be the same in both scripts and a value stored in one script will still be available in any other script.
If this doesn't solve your problem, you might want to post your script.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
can't create a variable with that name
Hi Mark,
Thank for your disponibility
The explicitVariables = false
Regards
Jean-Marc
Thank for your disponibility
The explicitVariables = false
Regards
Jean-Marc
can't create a variable with that name
Hi Mark,
I has not my problem been solved
The editor return the same error sometimes.
It work fine, but if i change something in some script of the card, the compilation return :
sometimes :
"compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "bufNomCurIM"
and sometimes:
(Handler: can't find handler) near "DeImage"
for a simple line "put the short name of the target into bufNomCurIM"
Thank one more
Jean-Marc
I has not my problem been solved
The editor return the same error sometimes.
It work fine, but if i change something in some script of the card, the compilation return :
sometimes :
"compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "bufNomCurIM"
and sometimes:
(Handler: can't find handler) near "DeImage"
for a simple line "put the short name of the target into bufNomCurIM"
Code: Select all
-- The script of 15 images of the card
on mouseup
DeImage
end mouseup
-- The DeImage handler is in the card script
on DeImage
set the rect of grc "Entoure" to the rect of the target
put the short name of the target into bufNomCurIM
put char 9 to 10 of bufNomCurIM into LeNumIm
put the MonSon of the target into MonFile
put "UnCadre"&LeNumIm into LeCadre
JoueSon MonFile,LeCadre
end DeImage
on JoueSon f,c
put f into MonFile
put c into LeCadre
set the bottomleft of player "Parleur" to the topleft of grc LeCadre
set the currenttime of player "Parleur" to 0
set the filename of player "Parleur" to MonFile
start player "Parleur"
end JoueSon
Jean-Marc
Last edited by jmburnod on Wed May 27, 2009 8:42 pm, edited 1 time in total.
Bernd,
It seems you're right. Jean-Marc, you might put your code in a try end-try control structure and post the resulting error here, even though it might not help.
You might also put true into gRevDevelopment. This might bring up some additional error messages, which might be worth investigating.
Best,
Mark
It seems you're right. Jean-Marc, you might put your code in a try end-try control structure and post the resulting error here, even though it might not help.
Code: Select all
on foo
try
-- your code here
catch myErr
put myErr
end try
end foo
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
can't create a variable with that name
Hi Mark and Bernd,
gRevDevelopment = true return the same result
The sequence is like that
• I open the revfile
• I clic on the image and the script work fine
• I open the card script
• I delete an empty line (the btn "compile" is enabled)
• I clic on the btn "compile"
• "compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "bufNomCurIM"
• I save (the save process work)
• I close the script editor
• I clic on the image
• I have an error "UneImage4": execution error at line 2 (Handler: can't find handler) near "DeImage"
I can't test by the try control, but rev don't understand "DeImage" the second time
Regards
Jean-Marc
gRevDevelopment = true return the same result
The sequence is like that
• I open the revfile
• I clic on the image and the script work fine
• I open the card script
• I delete an empty line (the btn "compile" is enabled)
• I clic on the btn "compile"
• "compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "bufNomCurIM"
• I save (the save process work)
• I close the script editor
• I clic on the image
• I have an error "UneImage4": execution error at line 2 (Handler: can't find handler) near "DeImage"
I can't test by the try control, but rev don't understand "DeImage" the second time
Regards
Jean-Marc
Jean-Marc,
I have no clear idea.
But I would try to put the text of the card script (without the empty lines) into the script of the stack. Clear the card script completely.
See if that compiles. Maybe there is an invisible ASCII character that bugs Rev. (just a guess)
Or take the card script and put it into the script of just one image and clear the card script, see if that compiles.
Take the card scrpt and put it into an text editor and turn it to plain text and paste it over all of the card script and see if that works.
You might want to try this on a copy of your original stack.
You could also clear the card script and retype the card script.
These are all guesses, but you could try.
Sometimes if Rev behaves funny it helped when I just deleted the Rev preferences.
regards
Bernd
I have no clear idea.
But I would try to put the text of the card script (without the empty lines) into the script of the stack. Clear the card script completely.
See if that compiles. Maybe there is an invisible ASCII character that bugs Rev. (just a guess)
Or take the card script and put it into the script of just one image and clear the card script, see if that compiles.
Take the card scrpt and put it into an text editor and turn it to plain text and paste it over all of the card script and see if that works.
You might want to try this on a copy of your original stack.
You could also clear the card script and retype the card script.
These are all guesses, but you could try.
Sometimes if Rev behaves funny it helped when I just deleted the Rev preferences.
regards
Bernd
can't create a variable with that name
Hi Bernd and Mark,
Good new
Bernd have a good solution way
I check the rev preferences and i watch the "compilation strict" is true
I set it to false and the rev editor work
I hope it is the solution
My prev post before the good new :
I don't believe this mistake is not linked with an invisible char in the script
I tested it :
• I do a new stack (one card)
I have the same results after the compilation :
card id 1002: compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "buf", char 10
I watch : put char 10 of " put 1 into buf" return "i" (the "i" of "into")
Regards
Jean-Marc
Good new

Bernd have a good solution way
I check the rev preferences and i watch the "compilation strict" is true
I set it to false and the rev editor work
I hope it is the solution
My prev post before the good new :
I don't believe this mistake is not linked with an invisible char in the script
I tested it :
• I do a new stack (one card)
Code: Select all
The script of the card
on tsimple
put 1 into buf
end tsimple
card id 1002: compilation error at line 2 (Chunk: can't create a variable with that name (explicitVariables?)) near "buf", char 10
I watch : put char 10 of " put 1 into buf" return "i" (the "i" of "into")
Regards
Jean-Marc
Re: can't create a variable with that name
Same problem here. I checked if some invisible chars are present but not found any. The problem happens with the scripts of the menubar, it seems to me that the project lost it's stability after I used Menu Builder. To solve temporary the problem, I have to quit and re-open LiveCode every time I make changes on the scripts.
LC 5.5.4 and OS X 10.8.2
LC 5.5.4 and OS X 10.8.2
Re: can't create a variable with that name
Hi,
Are you seeing exactly the same error message as OP in 2009? If not, could you post the exact error message here?
Kind regards,
Mark
Are you seeing exactly the same error message as OP in 2009? If not, could you post the exact error message here?
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: can't create a variable with that name
Hi Mark,
sure:
sure:
button "File": compilation error at line 73 (Chunk: can't create a variable with that name (explicitVariables?)) near "myT", char 41
button "Help": compilation error at line 4 (Chunk: can't create a variable with that name (explicitVariables?)) near "theLink", char 57
They appairs as errors everytime I try to save the script.button "Edit": compilation error at line 42 (Chunk: can't create a variable with that name (explicitVariables?)) near "textToProcess", char 29
Re: can't create a variable with that name
Hi,
Could you post the first 10 lines of the script of your Help menu?
What do you get if you execute
Is the Strict Compilation Mode option in the Script Editor pane of the preferences window turned off?
Do you use any plug-ins that don't come with the original LiveCode installation?
Kind regards,
Mark
Could you post the first 10 lines of the script of your Help menu?
What do you get if you execute
in the message box?put the explicitVariables
Is the Strict Compilation Mode option in the Script Editor pane of the preferences window turned off?
Do you use any plug-ins that don't come with the original LiveCode installation?
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode