Your method is correct, there must be something wrong in your program. You should run it on an AGA screen first or at least on a 8bit P96 screen. If it runs there, it will run on a truecolor screen either.
Here is a small example how to use many colors on a truecolor screen without wasting pens:
http://home.t-online.de/home/thomas-rapp/download/truecolors.lhaYou could also use WriteRGBPixel() but this will only work on RTG screens.
Note that if you need RTG functions, you should always use CGX because CGX programs run on P96, too, while there is no P96 emulation for CGX, at least not an official one.
Bye,
Thomas