Welcome to the OptoForums.
On this FOSCAM code, I have to warn you it's old and worked with a specific FOSCAM camera (NOT HD) and possibly even a particular version of FOSCAM firmware (and changing firmware on those cameras is a real drag). So, those are my big disclaimers.
FYI, the way I reverse-engineered that particular camera/version was by sniffing, via wireshark, the packets sent from the browser to control the camera, then building those same packets in OptoScript.
Anyway, I'll attach the same here, but be aware of those limitations.
A few more details on this code:
We've had it work w/Device Firmware Version 220.127.116.11, on several FOSCAM Fi8910w (SD) cameras around here.
Unfortunately, the other FOSCAM (HD) camera I have on my desk uses a slightly different protocol.
Basic overview (also see comments within the strategy):
The CAMERA_control_chart looks for a change in the CAMERA_command value and sends a new value when a change is made.
Typical/recommended use: Configure your FOSCAM "Presets" using the browser interface (there are up to 8). For example: "Left side" or "Right side" may correspond to preset 1 & preset 2. Then use camera commands 31, 33, 35, etc. (corresponding to preset 1s, 2, 3, etc) to move to those previously configured presets.
These go into the variable CAMERA_command, for example from PAC Display or a groov command button. Good luck!