[ian-reeds-games] Re: Version 2 of my scripts, capture that flag!

  • From: Craig Brett <craigbrett17@xxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Tue, 17 Dec 2013 22:12:20 +0000

Ian, I gave items a go. No joy. When I try to add the item to the new unit's inventory, I get the following error:

TypeError: Object Game.Inventory has no method 'AddItem'.

I tried camelCase addItem() as well, but to no avail. Any ideas?

Victorious, it depends how technical you want to go. Ian and myself both have different ways of doing it. Ian uses something called Pandoc, I believe it's a command line tool, so not for everyone. It seems quite powerful though and even makes tables of contents for your documents, which is neat. I normally use something called Visual Studio, an ironically accessible development environment, which is really for making programs/websites, but it does offer markdown capabilities too. I manage my scripts and my documentation from the same place now which is really productive. I doubt you'd need this, though.

The way I'd recommend of doing this is using the Markdown Dingus <http://daringfireball.net/projects/markdown/dingus>, which is an online tool. I used to use it up until very recently for all my documentation needs. You put your markdown in the textbox, hit the convert button and you'll get both the result of the markdown rendered in your browser and the HTML in a readonly textbox, ready for a copy + paste. It really is easy. As for the syntax, it is something new to learn, but it's quite easy. It's also helpfully placed above (in terms of a screen reader's reading order) the markdown textbox on the Markdown Dingus.

Let me know how you get on with that. As you can probably tell, Ian and I think its really useful!

Craig

On 16/12/2013 04:16, Victorious wrote:
Hi Craig and Ian

Thanks for the explanation. I'm thinking of exploring markdown - how easy is
it to get started and what programmes would I need? I have been using
Microsoft word to do htm files but that is hardly ideal. I'm assuming I have
to learn the syntax.

Victorious
-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Ian Reed
Sent: Monday, December 16, 2013 7:38 AM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] Re: Version 2 of my scripts, capture that flag!

Hi Craig,

You can give working with items a shot and let me know if you hit issues.

The items list is stored here:
someUnit.Inventory.Items;

Here's some helpful properties that exist on an item object:
Quantity: number;
Useable: boolean;
Stackable: boolean;

Tiles also have an Inventory property, but it is not exposed to script in
the current version.
I've just changed that so it will be available in the next version.

When adding an item to an inventory you should call:
someUnit.Inventory.AddItem(myItem);
This handles stacking the same item types together with a summed quantity.
It also removes the item from the old inventory if it was attached to one.
An Item keeps a reference to it's parent inventory which also gets updated
through this method.

All undocumented, sorry, smile.

+1 for the mark down is awesome comments.  That and TypeScript are my 2
favorite development related finds in the past 2 years.

Good luck!
Ian Reed



On 12/15/2013 4:11 PM, Craig Brett wrote:
Hi Victorious,

Thanks :-)  and I'll see if I can answer your questions.

Q1: Does units transforming into another still still make them lose
their eq?
A: I'm afraid so. I don't believe I have access to the unit's items in
the scripts, so I can't move them across from the old unit to the new
one. If that changes, I can fix that. Ian, if you're reading, can this
be done?

Q2: I know that Alan has used the move other units scripts
successfully on tile effects - will they still work on those now? The
helpfile specified skills only.
A: I set it to skills only, since I wasn't aware of this. SO how was
that working? Was the effect on a tile and every time a unit walked
onto that tile they were being push away or something? The script
shouldn't have worked that way, but sounds like Allan at least had a
use for it.

Q3: I saw a .md file in the documentation .zip, what does .md stand for?
A: .md files are markdown files. It's essentially a very light syntax
that you put in an otherwise plain text file. When this is then
processed by something that handles markdown, it makes a web page,
such as the readme.html file that's in there. If you open up the .md
file in notepad, you'll see it's almost plaintext with a few
exceptions, particularly around anywhere where there's lots of
underscores, since they're a special character in markdown. But most
of it is just plain text. I can write HTML, but Markdown's quicker.
It's really good for writing documentation. Ian uses them too for the
game documentation, that's probably where you've seen them. It's
pretty neat.

Craig

On 15/12/2013 16:17, Victorious wrote:
Hi Craig

Thanks for the updates and documentation - this looks awesome! Just a
few
questions:

1. Does units transforming into another still still make them lose
their eq?
2. I know that Alan has used the move other units scripts
successfully on
tile effects - will they still work on those now? The helpfile specified
skills only.
3. I saw a .md file in the documentation .zip, what does .md stand for?
Always wondered as I see those files from time to time in TB.

Victorious

-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Craig Brett
Sent: Sunday, December 15, 2013 10:45 PM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] Version 2 of my scripts, capture that flag!

Hi all,

Version 2 of my scripts are ready to go. It's largely a rewrite.

Warning: This contains breaking changes! The old syntax has been removed
and probably won't work anymore. I apologise for the inconvenience and
hope that the much better readability and ease of use makes up for it.

This new version of the scripts works on the script flags basis. As a
result, you will need to have converted your map packs to version 10 to
use them. You should anyway, it's a lot better!

Get the new version of the scripts here:
https://dl.dropboxusercontent.com/u/5405418/Craig%20Brett.zip
And the new documentation from here:

https://dl.dropboxusercontent.com/u/5405418/Craig%20Brett%20Documentation.zi

p

I still haven't figured out the keys or function type flags yet, so
there'll be a few more to come in version 2.1, hopefully soon.

If there is any weirdness or bugs, please let me know.

I hope you like the new stuff!

Craig







Other related posts: