Collision touch collision to effect text number

How would I make a script so that when the hammerhead entity enters the rock collision it changes two texts(text a “rock text” and text b “age text” ) the age text should be affected less than the rock text, the rock text needs to add 3 to the rock text every time the collisions enter, the age text needs to be effected about 0.5 every time the collisions touch. How would I complete this in javascript?