Set Transaction Sequence Override

$set_state states Snewstate|S:statename|newbox|@newvar
$set_state

This command allows for the arbitrary override of the sequence of processing of a transaction. This is a very low-level command and should be used with care. See also trapping processing states

The parameters on this command are used as follows:

states the state names or numbers (see Appendix C: State Table) which are to be trapped and switched to a different state or infobox. Up to four states may be specified in a comma-separated list with no blank spaces.
newstate the state number which is to be used instead of the specified states.
statename the state which is to be used instead of the specified states.
newbox the infobox number which is to be given control when any of the specified states is reached.
newvar the variable which will contain the infobox number which is to be given control when any of the specified states is reached. The value of the variable will be that which exists at the time the state is reached, not that at the time of processing the infobox containing this $set_state command.

A $set_state command is canceled (a) after reaching any one of the specified states and switching from it as specified, (b) by processing any other $set_state infobox command for the same or another state, or (c) at the end of the current call. The version of the command with no parameters clears the preceding set_state, whether or not any of the specified states have been trapped.

In your infobox processing, you can determine the number of the last state that was trapped in the SWITCHFROM system variable.

Not all states may be trapped by the use of this command: you should only attempt to trap states which are part of the normal processing of a transaction. Trapping other states will either be ineffective or may not have the desired results.

Example:

This command could be used, for example, to cause a switch to a user menu or question box (infobox) at the end of document selection. If your menu or question infobox was number 1234 you could use the either of the commands:

$set_state 72 1234

$set_state no_more_images 1234

which would switch to your own infobox 1234 when state 72 (no more images) was next reached.