Thanks. I just need to reset the camera back to 0 because otherwise the stage will look weird for a certain custom state.
This is what I did and kinda worked but its hard to get the exact value:
[State 4420.2, center camera]
type = posadd
triggerall = time > 0
trigger1 = pos x != ifelse(root,var(32) < 0,(1.01509*abs(root,var(32)))+233,-(1.01509*abs(root,var(32)))-233)
x = ifelse(root,var(32) < 0 && facing > 0,1,ifelse(root,var(32) < 0 && facing < 0,-1,ifelse(root,var(32) > 0 && facing > 0,-1,1)))
where var(32) equals camerapos x (I only need to adjust the X axis).