Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Issue with incrementing an integer




I'm having the weirdest of issues on Archicad 24 7006 FULL trying to increment a integer value.


So I have this very simple code


if check then
	test = test + 1
	parameters test = test


- check is a checkbox

- test is an integer

- I want to increment test every time I check the box


However, when I go to the Parameters list, every time I check the box, the increment is done twice... No matter the value, it will double the increment (if I do test = test + 10, it will increment by 20). So if I want to increment test by 1, I need to do use a dummy Real number, do the increment on dummy and then round_int() it to test.


There is no other code anywhere else. I tested that code alone in Main script and also alone in Parameter script for the same results.


What exactly am I doing wrong ? I've been at it for an hour now and I don't see it 😭 Seems super obvious 😬


Joachim Suehlo

Try this:

	if check then
		test = test + 1
		parameters test = test
		PARAMETERS check = 0

This works for me.
Also there is a checkbox "run parameter script always once" in the compatibilty options.

Joachim Suehlo . AC12-26 . MAC OSX 10.15 . WIN10

Barry Kelly

All the time that your check box is turned on, it will increment the 'test' parameter every time the script is run.

And as you have discovered the parameter/mater script is run more than once.


So, as Joachim suggests, reset your checkbox to zero (off) once you have incremented the 'test' parameter.

This should solve the issue as he also mentions.


As well as the option in the compatibility options (I think this forces the entire parameter script to only run once - which I have never worked out if it is a good or bad thing, and I don't think it is very well documented anywhere what actually happens - maybe I just haven't looked hard enough), there is also a GDL command ... n = APPLICATION_QUERY ("parameter_script", "firstoccasion_in_progress", isFirstRun)

So you can use the value returned in 'isFirstRun' to determine if it is the first time the script has run.


You can look it up in the GDL reference.



One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10



Running parameter script only once might be a matter of taste. It forces writing code that makes the distinction between parameters and variables, so it is more work from start, but will help understanding the code when new features are added to parameters dependent on eachother.


If run only once is not used, checking "firstoccasion_in_progress" can be necessary with GLOB_MODPAR_NAME, because it is always the name of the parameter modified by the user, not the ones modified with the PARAMETERS command.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest


So I ended up doing the solution from Joachim.

I did not have the parameter script ran once though because my inputs were lagging (by a run) and because I'm putting pictures on checkboxes, so them not being checked visually was not an issue.


Just realized that all what you guys said was written in the Reference Guide on page 559 😓


Therefore it makes no sense to increase a parameter value by one in the parameter script since you may not be able to predict the cardinality of executions.

The run of the parameter script is linear, and not necessarily multiple. You can force the parameter script to start only once by checking the Run the parameter script only once option in the object's Compatibility Options panel, if you are sure you don't need it to run many times. This can make objects react faster, saving time and computing resources.

Classic case of RTFM 😅

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!