Execute scrip online working if algebra view is shown

ccambre shared this problem 2 weeks ago
Solved

hi

some time ago I made a book on Penrose tesselation https://www.geogebra.org/m/vMyyzP6v

In it I worked on a file by John Golden who created new kites and darts with a script in a button. Using a command Execute[{"SetColor[poly"+nr+",blue]"}] I could color new kites that weren't created yet. But I had to consider language settings so in dutch I had to define it as Uitvoeren[{"SetColor[veelhoek"+nr+",blue]"}] (and of course green for the dart). In the book I put dutch and english versions next to each other to experiment with matching rules. These scripts did work offline as well as online.

Recently I noticed that online I get an error for the command. Curiously the script still works if I show the Algebra View. Here you can compare with and without:

English version without Algebra View is at : https://www.geogebra.org/m/ufhhvdx5

English version with Algebra Viewis at : https://www.geogebra.org/m/ukgjwrrp

I added the ggb file with the english scripting command. When uploading it, it seems to work. But after saving it, it produces an error.

chris

Comments (5)

photo
1

This is wrong as there is no "poly5" object created:

SetValue[nr,nr+1]
New=RigidPolygon[poly4]
Execute[{"SetColor[poly"+nr+",blue]"}]


Maybe this will work better:

SetValue[nr,nr+1]
RigidPolygon[poly4]
Execute[{"SetColor[poly"+nr+",blue]"}]


Something like this will cope with the language difference I think:

SetValue[nr,nr+1]
Execute[{"poly"+nr+"=RigidPolygon[poly"+(nr-1)+"]"]
Execute[{"SetColor[poly"+nr+",blue]"}]

photo
1

Hi, thanks for looking at it Michael.

What I definitly missed was the nameshift in English from poly to q for quadrilaterals, where in dutch they still are named 'vierhoek' so this explains a failure of the script in English. But the ambitious proposal to cope with the language doesn't work. Despite the last scriptproposal a new quadrilateral still is called 'vierhoek' in dutch, which causes that poly isn't recognised.

I noticed that ommitting 'New=' makes no difference (ommitting it in one button and not in the other) but indeed it isn't necessary.

Remains the curious fact that the script sometimes works and sometimes not. I thought curiously experiencing showing a slight strip of the algebra view made it all work in dutch. And the English ones also did work after changing the 'poly' in the script to 'q' and changing the counter to 0 as in dutch. So I made a tiny strip Algebra View visible in the screen and now I could use it in English and dutch. But starting my laptop after closing a few hours later, I noticed even that workaround doesn't do the job all the time. I'll try further on your proposals.

chris

photo
1

> a new quadrilateral still is called 'vierhoek' in dutch


> ommitting 'New=' makes no difference


Ah, I see now. That we can fix :)

(v513)

photo
1

in dutch I think I have a solution with the scripts:

SetValue[nr,nr+1]

Uitvoeren[{"vierhoek"+nr+"=RigidPolygon[poly4]" } ] since poly4 is the model for the blue figure

Uitvoeren[{"SetColor[vierhoek"+nr+",blue]"}]


SetValue[nr,nr+1]

Uitvoeren[{"vierhoek"+nr+"=RigidPolygon[poly3]" } ] referring to the existing poly3

Uitvoeren[{"SetColor[vierhoek"+nr+",green]"}]

Strange for me is the mixing of English and dutch in the Execute command, where I have to combine the dutch Uitvoeren, and (of course) the absolute naming of 'vierhoek' with the English command RigidPolygon since the dutch command 'Starre Veelhoek' isn't recognised. I rarely use the Execute command for reasons like this, but it's strong and takes experimenting surely with language questions. I have to combine the old English name poly with the dutch, and probably q for the English command and I musn't forget to change the value of nr since the counter for q starts back from zero instead of adding to the axisting poly's. And of course the English scripts are:

SetValue[nr,nr+1]

Execute[{"q"+nr+"=RigidPolygon[poly4]" } ]

Execute[{"SetColor[q"+nr+",blue]"}]


SetValue[nr,nr+1]

Execute[{"q"+nr+"=RigidPolygon[poly3]" } ]

Execute[{"SetColor[q"+nr+",green]"}]

chris

photo
1

v513 is released now so I think this will work correctly:

SetValue[nr,nr+1]
Execute[{"poly"+nr+"=RigidPolygon[poly"+(nr-1)+"]"]
Execute[{"SetColor[poly"+nr+",blue]"}]

© 2018 International GeoGebra Institute