The variables are just incremental. Please understand routing is not simple. Joomla makes it especially complicated by allowing routing aliases via Menu Items. It's possible what you're wanting is just not doable.
onBuildRoute
Code:
$_PLUGINS->trigger( 'onBuildRoute', array( $this, $plugin, &$segments, &$query, &$menuItem ) );
var1 = $this = ComprofilerRouter (base routing class for CB)
var2 = $plugin = plugin object that's being accessed
var3 = $segments = array of url segments that need to be populated (each segment is separated by a / by Joomla)
var4 = $query = array of the url query data
var5 = $menuItem = the menu Joomla item currently loaded (this is based off Itemid)
var3, var4, and var5 are all references. To modify them you need to mark them as references under Parameters tab of your auto action.
onParseRoute
Code:
$_PLUGINS->trigger( 'onParseRoute', array( $this, $plugin, $segments, &$vars, $menuItem ) );
var1 = $this = ComprofilerRouter (base routing class for CB)
var2 = $plugin = plugin object that's being accessed
var3 = $segments = the array of url segments that has already been populated (this is what you need to reverse)
var4 = $vars = the array of parsed segment data that needs to be populated (e.g. if you parsed an activity id out of $segments then you'd set id with that value into $vars)
var5 = $menuItem = the menu Joomla item currently loaded (this is based off Itemid)
var4 is a references. To modify it you need to mark it as references under Parameters tab of your auto action.