# Preserve Scripting Commands on Output Objects When creating new tool?

tbrzezinski shared this question 4 years ago

Hey gang,

You can plot a point on the y-axis and a point anywhere else. If you click the custom tool "DisplayEquation", select the two points. The slope, line, and equation will appear.

However, I tried using GeoGebra script on the slope (the green "m") BEFORE CREATING CUSTOM TOOL. I put:

If[m>=0, SetColor[m, "Dark Green"], SetColor[m, "Crimson"]]

(Don't worry-- I used the greater than or equal to sign--didn't type it in this way).

In essence, I want positive slopes (that will appear as output objects after student uses custom tool) to appear green and negative slopes to appear red. I had this script command applied to the m (slope) object BEFORE CREATING THE CUSTOM TOOL.

Is there a way GeoGebra scripting commands (for any output object) can be preserved (i.e. "remembered") when creating a new tool?

Thank you!!!

Tim

2

Hi,

I propose this one (just with GGBScript) :

testAffinetFct.ggb

But, I thing it's possible to do this with JavaScript....

It's difficult , because we do what your want, with an points undefined on the first !

GGB don't like undefinition !

It's possible, but on later, it doesn't work !

Because, GGB team works with on other algoritm....

So, be carefull with that!

You are on "limit" of Geogebra...!

...

Sorry, I don't speak english, but I speak GeoGebra ...

2

I have no answer to your question (script for output of user-tool)

Use in the user-tool for the object poly1 the properties/advanced/dynamic-colors

.

1

Rami,

THANK YOU!!!!!

Did not realize I could do it here instead. Thank you!!!!

1

Patrick,

Much appreciated!!!!

Tim

1

On my GeoGebra, it works fine with slope object. But it doesn't work with a slider: When the custom tool is created, the dynamic colors work fine. Later, when the custom tool is inserted, the dynamic performance doesn't work, but the color is constant.

Do you know how to get the dynamic performance with a slider?

System info:

GeoGebra Classic 5.0.478.0-d (09 July 2018)

Java: 1.8.0_121

1

Describe the name of input-objects and output-objects.

1

Dear rami,

Just now I have to found the reason of my trouble: I had not added the slider to the tool as an input object. So, I think I have solved this issue.

Thank you very much by your help.