If you haven't already, a good place to begin would be getting to know the File functions and properties. If you're going to be reading/writing to text files, you're going to need them.
You can't import code from a text file directly into AGS and have it run like AGS code. However you can read a line back from the file, check if it contains a specific word (lke 'shoot', 'scan', etc) and run the approriate code from, that. I've done something similar in the AGSConsole module, you'd just need to change the functions (GetAtIndex, StrAtIndex, GetCommand) to get their input from a file instead of a TextBox. This'd mean you could develop your own syntax for programming the robots in the file, instead of sticking to an AGS-like format as in your example. RickJ's IniFile module (if it's currently working ... depends on what AGS version you're using, I think) might help here, by giving you an existing structure to work in.
What's the point of using the text files, anyway? I guess external files would allow players to customise their robots, but I think you'd be able to do that within the game as well. E.g. by having a GUI to select what order to run commands, tweak parameters, etc. You should be able to 'export' the 'bots to a text file to play on other PCs, but that file wouldn't need to be human-readable or writable, making the whole thing a little easier, IMO.
You can't import code from a text file directly into AGS and have it run like AGS code. However you can read a line back from the file, check if it contains a specific word (lke 'shoot', 'scan', etc) and run the approriate code from, that. I've done something similar in the AGSConsole module, you'd just need to change the functions (GetAtIndex, StrAtIndex, GetCommand) to get their input from a file instead of a TextBox. This'd mean you could develop your own syntax for programming the robots in the file, instead of sticking to an AGS-like format as in your example. RickJ's IniFile module (if it's currently working ... depends on what AGS version you're using, I think) might help here, by giving you an existing structure to work in.
What's the point of using the text files, anyway? I guess external files would allow players to customise their robots, but I think you'd be able to do that within the game as well. E.g. by having a GUI to select what order to run commands, tweak parameters, etc. You should be able to 'export' the 'bots to a text file to play on other PCs, but that file wouldn't need to be human-readable or writable, making the whole thing a little easier, IMO.