I attach an extract from a very long script. The problem one can Apply or compile the script, but when ru, errors show up.
The error relates to the + operator initially but if the line is commented out, the error moves down. Sometimes it shows an error in a commented line.
If the offending script has the error lines commented out, eventually, the script runs.
There is nothing remarkable about the segment so I welcom comment.
--Main Formula section
-- ConstantSum
put L1 + L2 + L3 + L4 + L6 + L7 + L8 + L11 + L12 into ConstantSum
--answer ConstantSum
--Col A1
put ConstantSum + M3aUpperMat + M4aUpperMat + M5aUpperMat into UpperA1
put M3aUpperFract * M4aUpperFract * M5aUpperFract / UpperA1 into UpperA1
--answer UpperA1
--Col A3
put ConstantSum + M3aUpperBridge + M4aUpperMat + M5aUpperMat into UpperA3
put M3aUpperBrFract* M4aUpperFract * M5aUpperFract / UpperA3 into UpperA3
--answer UpperA3
--Col A5
--put ConstantSum+M3aUpperMat + M4aUpperBridge + M5aUpperMat into UpperA5
--put M3aUpperFract* M4aUpperBrFract * M5aUpperFract / UpperA5 into UpperA5
--answer UpperA5
--Col A7
--put ConstantSum + M3aUpperBridge + M4aUpperBridge + M5aUpperMat into UpperA7
---put M3aUpperBrFract* M4aUpperBrFract * M5aUpperFract / UpperA7 into UpperA7
--answer UpperA7
--Col A9
put ConstantSum + M3aUpperMat + M4aUpperMat + M5aUpperBridge into UpperA9
put M3aUpperFract* M4aUpperFract * M5aUpperBrFract / UpperA9 into UpperA9
--answer UpperA9
--Col A11
put ConstantSum + M3aUpperBridge + M4aUpperMat + M5aUpperBridge into UpperA11
put M3aUpperBrFract* M4aUpperFract * M5aUpperBrFract / UpperA11 into UpperA11
--answer UpperA11
--Col A13
--put ConstantSum + M3aUpperMat + M4aUpperBridge + M5aUpperBridge into UpperA13
--put M3aUpperFract* M4aUpperBrFract* M5aUpperBrFract / UpperA13 into UpperA13
--answer UpperA13
--Col A15
--put ConstantSum + M3aUpperBridge + M4aUpperBridge + M5aUpperBridge into UpperA15
---put M3aUpperBrFract* M4aUpperBrFract* M5aUpperBrFract / UpperA15 into UpperA15
--answer UpperA15
--Sum and 1/x of upper
---put 1/(UpperA1 + UpperA3 + UpperA5 + UpperA7 + UpperA9 + UpperA11 + UpperA13 + UpperA15) into SumUpper
--answer SumUpper
-- lower
put ConstantSum +M3aResult + M4aResult + M5aResult into A17
--answer A17
--Total Resistance of wall
---put 1/((SumUpper+ A17)/2) into TotalResistance
--answer TotalResistance
--Correction for air gaps and wall ties
put 0.0032 into WallTies
--Assume Level 1 of 0.01 and 0.0032 for wall ties
--put 0.01*((L7 / ((SumUpper+ A17)/2) * ((SumUpper+ A17)/2))) into AirGap
--answer AirGap
--put TotalResistance + AirGap + WallTies into Ucalculated
--answer Ucalculated
--put round (Ucalculated,2) into Uvalue
--answer Uvalue
----Now test to see if it meets filter
--put the label of button "SelectUvalue" into RequiredUvalue
put empty into Total
--if RequiredUvalue = Uvalue then put 1 + total into total--If the test with this combination is true then put it into the main list for later selection
-- End of calculation section
I have isolated the card from the stack if anyone wants to see the whole process.
Script compiles but moving errors on run
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
I was able to recreate your error, as you stated.
It all works fine if the variables have values in them. Are these variables initialized in another script? If so, they need to be defined as locals.
Put the following into your script prior to the first add, and everything works fine:
It all works fine if the variables have values in them. Are these variables initialized in another script? If so, they need to be defined as locals.
Put the following into your script prior to the first add, and everything works fine:
Code: Select all
put 0 into L1
put 0 into L2
put 0 into L3
put 0 into L4
put 0 into L6
put 0 into L7
put 0 into L8
put 0 into L11
put 0 into L12
put 1 into M3aUpperMat
put 1 into M4aUpperMat
put 1 into M5aUpperMat
put 2 into M3aUpperFract
put 2 into M4aUpperFract
put 2 into M5aUpperFract
put 3 into M3aUpperBridge
put 3 into M4aUpperBridge
put 3 into M5aUpperBridge
put 4 into M3aUpperBrFract
put 4 into M4aUpperBrFract
put 4 into M5aUpperBrFract
put 5 into M3aResult
put 5 into M4aResult
put 5 into M5aResult
Thank you for your comment. However, I have now tried this, but it has not made any difference. I would have been surprised if it did because as all the variables are in the same script, RR should create them when encountered. Also, if the offending section, the part you have seen is removed and placed on its own, both this and the remains of the script work without a problem.
Just for any one else with a similar problem.
I have now tried the following and using the run error message as a clue, I have put the offending variables as Local
local A17,AirGap,Array,Array1
local Array2,Array3,Array4,Array5
local ArrayCount1,ArrayCount2,ArrayCount3,ArrayCount4
local ArrayCount5,ConstantSum,Corrections,Cycle1
local Cycle2,Cycle3,Cycle4,Cycle5
There are a lot more of them, but oddly, 50% are undeclared by local and are not affected.
All very odd!
I have now tried the following and using the run error message as a clue, I have put the offending variables as Local
local A17,AirGap,Array,Array1
local Array2,Array3,Array4,Array5
local ArrayCount1,ArrayCount2,ArrayCount3,ArrayCount4
local ArrayCount5,ConstantSum,Corrections,Cycle1
local Cycle2,Cycle3,Cycle4,Cycle5
There are a lot more of them, but oddly, 50% are undeclared by local and are not affected.
All very odd!
That's what I meant by: "Are these variables initialized in another script? If so, they need to be defined as locals."
I was incorrect with my terminology, sorry. I should have said "Are these variables initialized in another handler (command or function) within your script".
command = "on commandName" through "end commandName"
function = "function functionName" through "end functionName"
The "local"s need to be defined within your script, but outside any handlers (commands or functions), usually at the top so you can find them easily. That makes them available to be referenced by your commands and functions. So, if you put something into "AirGap" in one handler, then all other handlers in that script can reference it and its value will be the same as it was when it was created.
This is described, complete with an example, in the Rev 2.9 User Guide on page 124.
Also, in mathematic operations (put L1 + L2 into L3), the input variables (L1 + L2) must be numeric, otherwise Rev throws an error. That's why if you don't declare them as "local" and initialize them in another handler, your "script" (command or function) is having a problem. L1, L2, and L3 would all be uninitialized variables that are undefined to that handler. However, L3 would be automatically created because you are putting something into it.
I was incorrect with my terminology, sorry. I should have said "Are these variables initialized in another handler (command or function) within your script".
command = "on commandName" through "end commandName"
function = "function functionName" through "end functionName"
The "local"s need to be defined within your script, but outside any handlers (commands or functions), usually at the top so you can find them easily. That makes them available to be referenced by your commands and functions. So, if you put something into "AirGap" in one handler, then all other handlers in that script can reference it and its value will be the same as it was when it was created.
This is described, complete with an example, in the Rev 2.9 User Guide on page 124.
Also, in mathematic operations (put L1 + L2 into L3), the input variables (L1 + L2) must be numeric, otherwise Rev throws an error. That's why if you don't declare them as "local" and initialize them in another handler, your "script" (command or function) is having a problem. L1, L2, and L3 would all be uninitialized variables that are undefined to that handler. However, L3 would be automatically created because you are putting something into it.