It's mostly just a matter of figuring out the stuct used for each command packet type, and then filling in all the struct info in the right place in memory. When the time comes, the game will try to execute the next one in the queue. It sounds like you have the easy case of a new custom level too.
Check out the pack of text files on Internal Info that was posted with the OllyDbg .udd file. The main one of interest is DataStructure CommandPacket.txt. That should tell you what all the types of command packets are, and the struct/layout information is fairly extensive, although not quite complete. Mostly the missing information seems to be for fields that can be ignored, or are only used by triggers and groups, which it sounds like you're trying to avoid anyway.
You can also check out the Player information from that pack, although, the ForcedExport project will likely have more up to date information. The main pieces of information are the memory locations and offsets you'll need.
class Player {
// ...
CommandPacket cp[16]; // 0x4C8
// ...
};
// ...
// extern Player player[7]; // 0x56EF1C [TethysGame.Player[7]]
You'll notice there are 16 slots for command packets. They form a circular buffer. Every 16 processing cycles, it loops back to the beginning. There is a delay between the one being filled, and the one being executed. This is mostly noticable in multiplayer. That delay gives the packet a chance to be sent to the other computers, so the game doesn't need to constantly pause and wait, but adds that latency, where you're units don't respond right away when you click.
I don't seem to have a description of the processing intervals handy, but I think it was something like every 4 ticks it would process a new packet. Hence, you'd index the packets as:
cpIndex = (tick + cpTickOffset) / 4;
The cpTickOffset depends on what you're doing exactly. If you're writing the packet, versus reading one to be excuted. I guess try a value of 0, and if that doesn't work, try the other numbers below 15 until it does. Watch the latency though, as more than one value might work, but will have higher latency.
You should be able to just fill in the command packets in AIProc, or a trigger callback or something. Just make sure you do the same on all computers so the game doesn't go out of sync. If you're filling in these structs in AIProc or equivalent, they won't be replicated over the network like player commands are. That function runs after the packet replication happens for the current cycle. (I think, it's been a while).
Basically, that method will work well for a custom level that executes symmetrically on all machines. Don't try that technique from a custom mod that not all players have loaded though. But, it sounds like you're going for the easier custom level approach.