NIPO ODIN Version 5.17

Previous Topic

Next Topic

Self-Modifying Script No Longer Supported

Self-modifying script is script that is able to change itself at runtime. In NIPO ODIN this was done by placing script commands and categories in text variables, and then displaying the content of that script variable on a particular line in the script. Such constructions were possible due to the nature of the 4.08 interpreter. With version 5 a parser is introduced that compiles the script, requiring a strict syntax and making self-modifying script impossible. Below are a few popular examples of self-modifying script, and alternatives that can be used to obtain the same result in NIPO ODIN Script language version 5 and above.

Example 1: Inserting pictures

*TEXTVARS FIGURE
*VAR NR

*PUT NR [1]
*PUT FIGURE "*PICT *?NR"

*QUESTION 1 *CODES L1 "*?FIGURE"
Do you recognize this picture?

1: Yes
2: No

Since the *PICT command allows variable parameters, this construction can be omitted:

Example 1: Inserting pictures in NIPO ODIN 5

*VAR NR

*PUT NR [1]

*QUESTION 1 *CODES L1 *PICT [NR]
Do you recognize this picture?

1: Yes
2: No

Example 2: Toggling the filter

*TEXTVARS Condition

*PUT Condition "*IF [Q1,1]"
*QUESTION 1 *CODES L1 "*?Condition"

This kind of construction can be avoided all together by creating a better filter condition.

Example 3: Showing and hiding codes

*TEXTVARS DONTKNOW

*IF [ Q2,1 ] *PUT DONTKNOW "9: Don’t know"

*QUESTION 3 *CODES L1
Do you own a VCR?

1: Yes
2: No

*?DONTKNOW

This kind of construction makes it impossible to determine code lists on exports, and can be avoided with *CONTROL on *DUMMY questions:

Example 3: Showing and hiding codes in NIPO ODIN 5

*QUESTION 4 *CODES L1 *DUMMY

*IF [ Q2,1 ] *EXCLUDE Q4 Q4 *ELSE *INCLUDE Q4 [ 9 ]

*QUESTION 3 *CODES L1 *CONTROL Q4 N
Do you own a VCR?

1: Yes
2: No

9: Don't know

If more than one code needs to be toggled, a *MULTI question should be used for Q4. If using high code numbers in combination with *MULTI causes large gaps in the data, a dummy can be reused as required by clearing its content using *EXCLUDE Q4 Q4.

Example 4: Variable scale length

*VARS ScaleLen
*QUESTION 2 *NUMBER L1 *SAVE ScaleLen
How long do you want the scale to be?

*QUESTION 1 *FORM
1: *SCALE 61 [ScaleLen] 28

Variable scale length are no longer permitted, but strongly recommended against from a methodological point of view. If different scale lengths are required, use separate questions.

See Also