Cannot upload EX_Rail Sketch

I keep getting the error message below when I attempt to upload this Sketch.

This is the code. The red lines do not show in the code it is WORD trying to correct the Grammer
AUTOMATION(1,"MainStation_Loop")
SETLOCO(3801)
FON(3)
FWD(50)
CLOSE(14)
AT(4)
FWD(10)
AT(5)
STOP
DELAYRANDOM(5000, 10000)
FWD(50)
CLOSE(22)
THROW(10)
CLOSE(8)
DELAY(20000)
STOP
DONE

This is the error message from the Arduino.
C:\Users\Victor\Comand Station\CommandStation-EX\myAutomation_MainStation_Loop.ino:2:11: error: expected constructor, destructor, or type conversion before '(' token
AUTOMATION(1,"MainStation_Loop")
^

exit status 1

Compilation error: expected constructor, destructor, or type conversion before '(' token

Thanks in advance.

That's not any kind of sketch I recognize from the Arduino world. And it doesn't appear to be any kind of sketch that whatever IDE you're using recognizes either. It appears to be some sort of script to be interpreted by something, not a sketch to be compiled and uploaded to an Arduino.

Hi
It is code from Dcc-EX model railway and should upload into my arduino mega. I have loaded similar code previously but it know refuses to do it. I have not knowingly changed anything. Google “dcc exrail” for info on the process
Regards
Goody

No, I really don't think I will google it.

That isn't an Arduino sketch. Not for an Uno, not for a Mega, not for a Pro Micro. It might be something that the DCC-EX sketch understands... but it's not an Arduino sketch. And it won't upload through the IDE.

Hi @goody
Welcome to the forum.

What code are you loading into the IDE?
What verson IDE are you using?

Please read the above link and post your complete code into the instructions.

Tom.... :smiley: :+1: :coffee: :australia:

Based on Editing myAutomation.h — DCC-EX Model Railroading documentation I suspect that you're missing files.

All the instructions that you posted as code are more than likely defined elsewhere.