Matrix Games Forums

Deal of the Week: Pandora SeriesPandora: Eclipse of Nashira is now availableDistant Worlds Gets another updateHell is Approaching Deal of the Week Battle Academy Battle Academy 2 Out now!Legions of Steel ready for betaBattle Academy 2 gets trailers and Steam page!Deal of the Week Germany at WarSlitherine Group acquires Shenandoah Studio
Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Zen and the Art of Coding

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Zen and the Art of Coding Page: [1]
Login
Message << Older Topic   Newer Topic >>
Zen and the Art of Coding - 6/24/2011 1:16:56 PM   
lancer

 

Posts: 631
Joined: 10/18/2005
Status: offline

Zen and the Art of Coding


“Be at one with the code, grasshopper. Let your thoughts flow like the river through your keyboard. Float gently down the path to ATG enlightenment.”

Nice if you can manage it. All I can do is stumble blindly through the potholes.

After an initial learning curve I’ve figured out how to stumble in the right direction. More or less. Here are a few things that have helped that might be off interest to others.

Scripting Events

Once you get your head around the particular way the editor works you can do a fair bit. It’s surprisingly powerful. This is good.

What’s not so good is that when you start becoming more adventurous and begin churning out longer scripts (more than what fits on a single screen) to do ever more complicated things, you – or more precisely, me – bang hard up against the editor’s limitations.

All that black and green retro text starts to blur and you soon loose your way. This is the point where you feel the need for a tool.

Enter stage right – the TOOL.

(I’m not sure if I’m allowed to mention other programs here so henceforth, after a brief introduction, it will be referred to as the TOOL).

the TOOL

Notepad++ is an open-source code editor. It’s one of those do everything, hugely complicated, fancy text editors. Actually it does do everything, is pretty easy to figure out and is free.

Here’s how it works with ATG.







On the Event scripting page of the Editor is a blue button, top right. There are other, lesser, blue buttons but they are best not mentioned in polite company. Any trouble, call the police.

Press the blue button. It exports a copy of all your events into the /logs directory (ATG game folder). Like thus.







Double click on all the events that you are working on or wish to view. Naturally, when you installed the TOOL you associated all “.txt” with it so double clicking automatically opens the TOOL with each of your events in it’s own neat and tidy, separate tab.

Looks like this.







Apart from the monochromatic colour change this isn’t much better. Note in the screenshot above I’ve renamed the files within the TOOL to give them the same name as in the editor. This – as you’ll see shortly – isn’t a good idea.







Here’s the fun part. Press Language.







You are given a drop down list of every programming language that ever there was. Even the whacky ones. Not terribly useful but right at the bottom – helpfully highlighted above – is ATG.

H*ly Bat Cr*p! Does THE TOOL have inbuilt support for Advanced Tactics Gold?

Yep. Pretty slick. I press ‘ATG’ and the script fairy waves her magic wand and this is what I suddenly have. Cinderella ready for the ball.







Wow. Now this is useful. For a start it’s highly readable. You can easily match CHECKS with their missing cousin END CHECK’s. What’s even better is that all the power of the TOOL is at your fingertips.

Click on a variable. Viola, all the other instances where that variable is used are highlighted.







If you have opened up all your scripts then you can get a list of where a particular variable – say a game or regime variable - occurs, right across your entire script library. And so on. Terribly helpful.

If you have to rename a variable to something else then the automatic highlighting of each instance enables you to dive into the ATG editor and quickly and accurately ripple through the change ‘cause the line number references are the same as in the TOOL.

I’ve got a dual monitor setup so I have the TOOL open on one monitor and the ATG editor on the other. ALT-TAB’ing would work with a single monitor, not with the same ease of use but still handy.

When running the scripts (eg. playing the game) I can quickly debug any problems that occur as I have access to both the scripts (in the TOOL) and what’s happening onscreen, in-game, simultaneously.

Now unfortunately it’s all one way travel, script wise, from ATG to the TOOL. A journey with no return. Hasta la vista, baby.

However you can make the journey multiple times. All you have to do is press the blue button (mentioned above) from within the editor and any changes you have made to the scripts are updated – real time – in the TOOL. Extremely useful.

(If you rename your files from event58.txt to “Node Initialisation”, for example as I did above, it won’t update. Stick with the default)

The TOOL enables you to develop and debug an awful lot faster than if you were working exclusively within ATG.

Oh, the bit above where I mentioned that support for the ATG scripting language is built into the TOOL - I lied.

There is a button. Known only to a select few. Plus you. Don’t tell your neighbours.







This allows you to create support for a custom language – like ATG. Very involved. Took me all of three minutes and I’m a person who can’t even remember to put the garbage out.







This is how it works. You can see that I’ve told it to colour every instance of CHECK and END CHECK blue. Tempvar’s purple, Loops with a yellow background etc. Choose your own scheme. Change font sizes. Change fonts. Buy a dog. Easy.

That’s the TOOL. Recommended.

I was intending to mention a number of scripting tips that I’ve found useful but won’t. Given that I’ve only been playing around with the editor for a month or so, anyone who has bothered to read this far probably knows a lot more about it than me.

When I get stuck I’ll ask you.

Cheers,
Lancer


< Message edited by lancer -- 7/5/2011 10:51:02 PM >
Post #: 1
RE: Zen and the Art of Coding - 6/24/2011 1:35:53 PM   
Barthheart


Posts: 3102
Joined: 7/20/2004
From: Nepean, Ontario
Status: offline
Great post Lancer! Thanks for taking the time to write it up and post it.


_____________________________

Life is not a journey to the grave with the intention of arriving safely in a pretty & well preserved body,
but rather to skid in broadside, totally worn out & proclaiming "WOW, what a ride!"

(in reply to lancer)
Post #: 2
RE: Zen and the Art of Coding - 6/24/2011 2:24:13 PM   
Keke


Posts: 3515
Joined: 3/12/2002
From: Finland
Status: offline
Very useful! Cheers!

_____________________________

Jyri

The eternal privilege of those who never act themselves: to interrogate, be dissatisfied, find fault.

- A. Solzhenitsyn


(in reply to Barthheart)
Post #: 3
RE: Zen and the Art of Coding - 6/25/2011 2:52:46 AM   
Jeffrey H.


Posts: 2881
Joined: 4/13/2007
From: San Diego, Ca.
Status: offline
You forgot to open your post with 'G'day' this time.


_____________________________

History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson

(in reply to Keke)
Post #: 4
RE: Zen and the Art of Coding - 6/25/2011 6:59:53 AM   
lancer

 

Posts: 631
Joined: 10/18/2005
Status: offline
G'day,

quote:

You forgot to open your post with 'G'day' this time.


Buddha wouldn't approve.

Cheers,
Lancer

(in reply to Jeffrey H.)
Post #: 5
RE: Zen and the Art of Coding - 6/25/2011 4:44:58 PM   
Ande

 

Posts: 196
Joined: 7/5/2007
From: Göteborg/Sweden
Status: offline
If it ever was made possible to import written scripts into the game, I would seriously consider making a c/c++ compiler for the atgscript. An abstract sort of object orientation shouldn't be a problem, dynamically allocating memory will probably be impossible though.

(in reply to lancer)
Post #: 6
RE: Zen and the Art of Coding - 7/5/2011 8:15:56 PM   
Jeffrey H.


Posts: 2881
Joined: 4/13/2007
From: San Diego, Ca.
Status: offline

quote:

ORIGINAL: lancer

G'day,

quote:

You forgot to open your post with 'G'day' this time.


Buddha wouldn't approve.

Cheers,
Lancer


Yeah well I suppose it was in poor taste. Excellent work on your mods, I wish I had time to explore them, maybe in the coming months.


_____________________________

History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson

(in reply to lancer)
Post #: 7
RE: Zen and the Art of Coding - 7/5/2011 8:17:41 PM   
Jeffrey H.


Posts: 2881
Joined: 4/13/2007
From: San Diego, Ca.
Status: offline
Oh regarding your link to "the tool" there is a redundant "http//" callout.

_____________________________

History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson

(in reply to Jeffrey H.)
Post #: 8
RE: Zen and the Art of Coding - 9/20/2012 4:06:46 PM   
bwheatley

 

Posts: 3345
Joined: 12/13/2004
Status: offline
I will add this for future searchers. lancer debug atg :)

_____________________________

-Alpha Tester Carrier Force
-Beta Tester ATG
-Beta Tester WITE
-Alpha Tester WITW
-Alpha Tester Wif
-Beta Tester Command

(in reply to Jeffrey H.)
Post #: 9
RE: Zen and the Art of Coding - 2/20/2013 9:23:30 PM   
CSO_Talorgan


Posts: 654
Joined: 3/10/2007
Status: offline
This post would be entertaining and informative even if I wasn't interested in ATG. Lancer would be a good author. Maybe he is already.

(in reply to bwheatley)
Post #: 10
RE: Zen and the Art of Coding - 2/22/2013 5:54:50 PM   
mgaffn1

 

Posts: 165
Joined: 11/20/2009
Status: offline
thanks for sharing this!

(in reply to CSO_Talorgan)
Post #: 11
RE: Zen and the Art of Coding - 5/18/2013 10:07:45 PM   
Jenska


Posts: 27
Joined: 5/11/2013
From: Boston, Mass
Status: offline
What version of Notepad++ were you using then. ATG doesn't seem tobe in the list anymore.

(in reply to lancer)
Post #: 12
RE: Zen and the Art of Coding - 5/18/2013 11:52:33 PM   
lancer

 

Posts: 631
Joined: 10/18/2005
Status: offline
G'day Jenska,

ATG isn't in any Notepad++ list, you have to add it. Easy to do. Details in the original post.

Cheers,
Lancer

(in reply to Jenska)
Post #: 13
RE: Zen and the Art of Coding - 5/19/2013 12:38:10 AM   
Jenska


Posts: 27
Joined: 5/11/2013
From: Boston, Mass
Status: offline
Oh DUH
I Was so excited to see the good stuff, I missed the add-in part.....

(in reply to lancer)
Post #: 14
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Advanced Tactics Series >> Mods and Scenarios >> Zen and the Art of Coding Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.076