Macro programming on CC3 - where to start?

I have to admit that I'm quite a lazy guy. I also am a programmer. I thought of e.g. learning how to offload things like city quartier grebling to some piece of software.

So, where would I start looking for documentation on doing this? I've searched the forum, but only found two articles on macros for FT.

Comments

  • MonsenMonsen Administrator 🖼️ 46 images Cartographer
    edited November 2019
    Best resource is probably the Tome. It contains a few tutorials to get you started with the basics, as well as a complete list of all CC3+ commands with their syntax.

    There are also several blog articles that discusses macros, although most of them more with macros as part of something larger rather than trying to learn macros themselves, but they are useful for the sake of example, such as this one

    and Joachim has this very nice thread with some good tutorials.
  • Posted By: Monsenand Joachim hasthis very nice threadwith some good tutorials.
    That looks good. I hope, though, that Joachim de Ravenbel is still with us and reading stuff. I'm a programmer, and I'm good at finding bugs. And so I found one on the second page of the first tutorial...
  • MonsenMonsen Administrator 🖼️ 46 images Cartographer
    edited November 2019
    He is around, but not on a daily basis. Can easily go some weeks between visits.
  • Well, I spent time last night over a tome and tutorial. And I'm shocked. This is not a macro language. This is a train wreck, complete with blood, gore, and hundreds of dead people. That horrible.

    I have written better macro interpreters as a kid, way over thirty years ago. And no, I'm not going to rewrite the engine, compilers and interpreters is something I have long left behind...

    It seriously makes no sense to implement what I was planning in that. I might be considered crazy, but I'm not mad.

    When I recover from that, I might write my ideas in something else, and just let it produce a list of autogenerated macros that do the "paint job" in CC3+.
  • jslaytonjslayton Moderator, ProFantasy Mapmaker
    Posted By: treczoks... I might write my ideas in something else, and just let it produce a list of autogenerated macros that do the "paint job" in CC3+.
    It's often much quicker to write generators in familiar tools that create a CC3+ script than it is to try to master the subtleties of a new programming language and environment. Note that any script that you generate will be in that "macro language" that you very much don't like.

    I like to think that the FastCAD macro language has more in common with various OS shell languages from the dim past than it does with what most of us are familiar with as a "modern scripting language". It always felt more fair to me to call it "what you can do at the program's command line" rather than a deliberate "language" because that's literally what it is. The biggest insight for me was that every command is executed in near isolation from the others and communicates with them only via global variables. Jumps are commands that scan through the source file for the destination. The language is focused around user I/O and so things like walking the existing geometry list is more complicated than you might expect.
  • Posted By: jslaytonI like to think that the FastCAD macro language has more in common with various OS shell languages from the dim past than it does with what most of us are familiar with as a "modern scripting language". It always felt more fair to me to call it "what you can do at the program's command line" rather than a deliberate "language" because that's literally what it is. The biggest insight for me was that every command is executed in near isolation from the others and communicates with them only via global variables. Jumps are commands that scan through the source file for the destination. The language is focused around user I/O and so things like walking the existing geometry list is more complicated than you might expect.
    That was basically my impression too, and I actually suspected some of the things you listed based on my experience with similar systems. This is basically a command.com style batch script "language".

    I was seriously disappointed when I saw this. I didn't expect any seriously modern programming environment, but this...

    Tip of the hat to those people who get their hands bloody on dealing with that, but what I wanted to do is simply impossible this way (at least without implementing some Turing machine in script...).

    What I would suggest to the FastCAD/CC3+ people is to add an API to the system, so scripting can be done with a choice of external languages and methods instead of having to maintain an internal scripting engine.
  • MonsenMonsen Administrator 🖼️ 46 images Cartographer
    edited November 2019
    I am guessing that any new API's won't be added in the near feature, while nice, it does cost expensive developer time for a feature very few people are interested in. But remember that you do have other options along with macro writing. There are four basic ways to automate things with CC3+:


    1) Write a macro. You can do most things that you can do inside CC3+, and it do have basic conditionals and loops, although not very sofisticated, and it has very few options for working with and manipulating actual data.

    2) Use an external program that writes a CC3+ script for you (a script is basically the same thing as a macro but stored in a separate file, and can be called by the SCRIPT command in CC3+). This allows for the use of a richer programming language to process things, and it is simple to use in CC3+. The main vulnerability here is that the resulting script needs to be 100% correct, otherwise CC3+ will probably be throwing tons of error messages

    3) Use Intercom. Intercom allows you to talk to CC3+ directly from an external program. This basically work by having the external program sending macro commands to CC3+ one command at a time.

    4) Write your own XP. This gives you much greater access to CC3+'s internals, and since you program in C++, you have a proper programming language at your fingertips. The basis for this is still old, no denying that, but you are not limited to just what CC3+ gives you.
  • Posted By: Monsen4) Write your ownXP.
    Thank you for that pointer. This looks quite like what I was looking for.

    I have no idea, though, if and how I get this to work on Linux. Time and experimentation will tell.
  • MonsenMonsen Administrator 🖼️ 46 images Cartographer
    Posted By: treczoksI have no idea, though, if and how I get this to work on Linux.
    It is dependent upon the Windows SDK, so It might work under Wine, but no promises. Under straight up Linux, I don't think there is a chance (but tell me if you figure out something though)
  • jslaytonjslayton Moderator, ProFantasy Mapmaker
    If you have a way to build Windows DLLs (it's a pure C API using the Windows and FastCAD SDKs) and a way to run CC3+ (Wine is likely to work because it's straight Windows GDI code), then having Linux involved is irrelevant to the whole process.

    The laziest and most likely to be successful way to do CC3+ XP development regardless of OS is to install a virtual machine image with the base version of Windows 10, install the Visual Studio 2017 community edition on the VM, install CC3+ on the VM, and install the CC3+ SDK on the VM. Everything is fully contained and your base machine doesn't have issues with any of the installs. Having CC3+ in the VM (install it to something other than Program Files to allow changing the DLLs without too much pain) lets you do quick turnarounds and performance isn't usually too bad for most maps because CC3+ is a pure software renderer.
Sign In or Register to comment.