How to get a "number" as a "number of certain type of objects"
There are two figures on my little applet: 'point' and 'line'. When you click on 'point' (or 'line'), you are allowed to construct one point (or line). Then the tool is automatically switch to "move". You have to (can) click on the figure again (i.e. select the tool) to continue. See https://www.geogebra.org/m/ewgmzsu3 and its script.
The problem is this: I'd like to allow the user to construct only, for example 3 points and 2 lines. So I want the figure 'point' disappear if 3 point are constructed (similarly for the figure 'line'). I have this idea: I'd like to create the number named (for ex.) 'p', which is equal to the number of already constructed points. Then the figure 'point' will be visible according to the Condition to Show Object in Advanced setting, I put 'p<4' there.
I don't know how to create the number equal to the number of created points (or lines). I know about 'getObjectNumber()' but I don't know hot to use it in this case. What do I have to write to the script?
I look forward to your help.