To create a custom action to run some installscript, your installscript function can only take a single parameter, which is a handle for the current install. You will need to prototype it with something similar to the following:
export prototype MyFunc(HWND);
Then write the script, as follows:
function MyFunc(hMSI)
STRING svVar1;
begin
<Script commands>
end;
To create the custom action that will run the script, the easiest method is to use the Custom Action Wizard. Right click on Custom Actions, select Custom Action Wizard, give the CA a name. The type specified is Run InstallScript code. Scrolling through the list in source, you should be able to find the name of your custom action. Leaving everything else default should be acceptable.
This custom action can then be inserted wherever you want to run it.
Hope this helps,