In events can to change variable with default operands. One of them script. Please write an example where will use this variable SELF name/number. 


//If the gamevariable 7 are inferior to 1
if ($gameVariables.value(7)<1){
//your code here [ setValue ( ID, Expresion )]
$gameVariables.setValue(7, k*sqrt($gameVariables.value(7)));
}// If not than do this
else if ($gameVariables.value(7)>=1){
$gameVariables.setValue(7, 1);
}
Original thread: https://forums.rpgmakerweb.com/threads/haw-change-variable-in-event-by-call-script-with-it-name.68305/