Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Test Parameter Values In Parameter Script?

Anonymous
Not applicable
In the Parameter Script of an object, I tried something similar to the following:

VALUES `Door_Type_Code` `DHG`, `S&R`, `F`, `NL`, `HG`, `FNL`
IF Door_Type_Code = `DHG` THEN
VALUES `Door_Hardware_Code` `1`, `2`, `3`
ELSE
VALUES `Door_Hardware_Code` `10`, `20`, `30`
ENDIF


This apparently fails because `Door_Hardware_Code` isn't initialized at this point. Is there any way to accomplish the task of setting possible values based on another parameter's current value?
11 REPLIES 11
I don't know if it will solve this one, but when something doesn't work in the Parameter Script, I try it in the Master Script. Values lists definitely work there, and I've observed trouble with conditionals in the param script.

I'm still somewhat hazy on the absolute functions of the two scripts, so I end up with a lot of trial and error.

I try to use the param script for everything I can, but some things just don't work. Also the lack of a functional PRINT statement is annoying.
James Murray

Archicad 27 • Rill Architects • macOS • OnLand.info
Anonymous
Not applicable
I am a moron!

I moved the IF and VALUES statements to the Master Script and it still didn't work. After about 10 minutes it finally dawned on me that the variable has quotes around it, Like this:

IF `DCA_Material` = `AL` THEN

I took off the quotes and it worked fine. I put the whole thing back in the Parameter Script and it works there too.

But at least I learned that you can put VALUES statements in the Master Script, so this thread isn't a total loss. I also learned that I should always post the exact code -- not make up something simplified.

Thanks James!
Anonymous
Not applicable
Jay wrote:
In the Parameter Script of an object, I tried something similar to the following:

VALUES `Door_Type_Code` `DHG`, `S&R`, `F`, `NL`, `HG`, `FNL`
IF Door_Type_Code = `DHG` THEN
VALUES `Door_Hardware_Code` `1`, `2`, `3`
ELSE
VALUES `Door_Hardware_Code` `10`, `20`, `30`
ENDIF


This apparently fails because `Door_Hardware_Code` isn't initialized at this point. Is there any way to accomplish the task of setting possible values based on another parameter's current value?
I took those exact lines of code and pasted them into an object and created the two variables and they seem to work just fine. what exactly are you trying to do with this that isnt working?

- Matthew Peychich
Anonymous
Not applicable
Just as a matter of information. David Nicholson Cole recommends use the Master script whenever possible/appropriate - he advised me that the the Parameter script is 'too slow'!
MikeS wrote:
David Nicholson Cole recommends use the Master script whenever possible/appropriate - he advised me that the the Parameter script is 'too slow'!
I'd like to know more about this. What's slow about it? I use the Param script on the theory that the Master script gets read when any script is read, and so extra lines in there will be extra over and over, slowing the 2D and 3D scripts down. Crazy? Maybe DNC will chime in.
James Murray

Archicad 27 • Rill Architects • macOS • OnLand.info
Anonymous
Not applicable
James wrote:
MikeS wrote:
David Nicholson Cole recommends use the Master script whenever possible/appropriate - he advised me that the the Parameter script is 'too slow'!
I'd like to know more about this. What's slow about it? I use the Param script on the theory that the Master script gets read when any script is read, and so extra lines in there will be extra over and over, slowing the 2D and 3D scripts down. Crazy? Maybe DNC will chime in.
Also, what are the differences between the Master Script and the Parameter Script? Is there anything you can do in one that you cannot do in the other?
Anonymous
Not applicable
the param script i believe is read only when a change has been detected or when the dialog box opened and closed. however the master script is read constantly. for all 2D and 3D.

-- Matthew Peychich
Matthew wrote:
the param script i believe is read only when a change has been detected or when the dialog box opened and closed. however the master script is read constantly. for all 2D and 3D.
PRECISELY!

the other main reason is this. You put some menus into the parameter script - you then want to have some IF statements as a result - so you have to move to the master script to do this, because any results of the IF statements wont be passed on correctly to the 2D and 3D if only done in the Parameter Script - there is a disconnnection in the thinking.

My personal reason also has to do with the way I built a Menu.:

mv1="Stationary"
mv2="Moving slowly"
mv3="Moving quickly!"
VALUES "motionmode" mv1,mv2,mv3

Later in the other scripts you can say things like :
IF motionmode=mv3 THEN .........

This method of building menus ONLY works correctly if you do it in the Master Script, because the other scripts will not know what mv1 and mv2 are. As a result of this, I never use the Parameter script except for the very simplest things, eg,
VALUES "number" 0,1,2,3,4,5

or:

FOR k=1 TO numb
PUT k
NEXT k
VALUES "number" GET(NSP)

which do not have any variables.
Anonymous
Not applicable
you can achieve the same thing using the parameters script however it is a little more troublesome. it requires this kind of stategic placement of code. if you can do that, the objects parameters become much more efficient than anything youll get by coding directly to the master script.

-- Matthew Peychich