If you get an error, it’s always very helpful to post it. Just looking at what you’ve got here, one problem is that the method is actually set_value, not set.value.
Generally speaking, using set_value is preferable because it triggers event hooks for the field change. If you just set the locals variable, you won’t.
Thx, I was looking for a way to change field-values without triggering events. This did the trick:
frm.doc.my_fieldname = 0;
refresh_field(“my_fieldname”);