# How to map graphic tileset to ascii symbols?

**URL:** <https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752>\
**Category:** Questions\
**Created:** [February 18, 2019, 8:26pm UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752 "2019-02-18T20:26:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tangar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/tangar/32/2217_2.png) [@tangar](https://discourse.mapeditor.org/u/tangar)\
**Post date:** [February 18, 2019, 8:26pm UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/1 "2019-02-18T20:26:08Z")

</div>

Hello!

I’m very happy to find ‘Tiled’ - this is really beautiful programm!

I’m rookie developer and working at online roguelike game Angband Online which is based at Angband.

In my game I got maps which consist of simple ascii maps, for example:

[https://pastecode.xyz/view/b70cae17](https://pastecode.xyz/view/b70cae17) - this is a town

[https://pastecode.xyz/view/d239c105](https://pastecode.xyz/view/d239c105) - this is a map ‘legend’, so # is a wall, O is a road etc

Each ascii tile at the map got graphical tile which is bound to it. So user got an option - to play in pure ascii or with tileset.

I’ve installed ‘Tiled’, created new .tmx with proper size and imported there graphical tileset as .tsx. Now I’m able to draw everything with tiles, not with ascii characters and it’s great! The problem is:  
how to export my map which I’ve made in ‘Tiled’ as a pure ascii map (examples of which I linked above)?

I’ve read the ‘Tiled’ documentation and noted the option to export as .csv while having ‘name’ property with acsii symbol for each tile. But it using commas between symbols and also fills empty spots with ‘-1’ (and I need to leave them empty). The only way to solve it (which I found) is to replace ‘-1’ and commans in text editor with spaces which isn’t really comfortable as I need a lot of testing during maps drawing. Also I’ve checked .tmx file format documentation (which also uses .csv), but I failed to understand - is there way to solve this issue there…

Please help, guys! Are there any way to customize output to pure and simple ascii map without additional symbols? So each tile (picture) would have one property (ascii character) at output file; and the same time output file won’t have commas and empty spots would be marked as spaces.

---

<div class="post-metadata">

**Author:** ![jpegsarebad](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jpegsarebad](https://discourse.mapeditor.org/u/jpegsarebad)\
**Post date:** [February 18, 2019, 10:25pm UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/2 "2019-02-18T22:25:00Z")

</div>

The easiest way to do this is with [Python scripting](https://doc.mapeditor.org/en/stable/manual/python/).

The example in the docs shows a basic example, pretty much the same as a csv. All you would have to do is slightly modify that script to do what you want. Now, depending on how familiar you are with coding (and the Python language), you may find this to be difficult to understand. If you need any assistance, let me know!

---

<div class="post-metadata">

**Author:** ![ilya\_stepanov](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@ilya\_stepanov](https://discourse.mapeditor.org/u/ilya_stepanov)\
**Post date:** [February 19, 2019, 10:51am UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/4 "2019-02-19T10:51:10Z")

</div>

Tryed it with the example script. Working on windows with Tiled v. 1.2.2, Python 3.7. installed.  
Added script to C:\Users\ \<user\> \.tiled nothing seems to happen. No new export option in Export As dialog.  
Also I see this in plugins:  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/mapeditor/original/2X/4/41d5ea7f238a379d11fc44cdb78e57a336158836.png)

---

<div class="post-metadata">

**Author:** ![tangar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/tangar/32/2217_2.png) [@tangar](https://discourse.mapeditor.org/u/tangar)\
**Post date:** [February 20, 2019, 9:41pm UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/5 "2019-02-20T21:41:20Z")

</div>

Example which output I have right now: [https://pastecode.xyz/view/73adf063](https://pastecode.xyz/view/73adf063)  
Which output I need: [https://pastecode.xyz/view/9f4f9498](https://pastecode.xyz/view/9f4f9498)  
(additionally I need to have a frame and each stroke should start with ‘D:’… I wander is it also possible somehow)?

Thank you!

p.s.  
After I’ll learn a bit, I’m going to make series of video tutorials about ‘Tiled’ at my [youtube channel](https://www.youtube.com/streamguild) 😉

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [February 21, 2019, 5:41am UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/6 "2019-02-21T05:41:28Z")

</div>

The [Python scripting](http://doc.mapeditor.org/en/stable/manual/python/) is relatively hard to get working since the upgrade to Python 3, because you need exactly the version of Python that Tiled was built against installed on your system (and it needs to match the architecture of the Tiled you installed - 32 or 64 bits).

In the meantime, the [development snapshots](https://thorbjorn.itch.io/tiled/devlog/65879/more-scriptable-development-snapshot) have gained the option of defining map export formats in JavaScript. This works on all platforms since the JavaScript engine is shipping with Tiled. The extension mechanism is subject to change, but it’s documented at:

[https://doc.mapeditor.org/en/latest/reference/scripting/#script-registermapformat](https://doc.mapeditor.org/en/latest/reference/scripting/#script-registermapformat)

The best place to define your custom format is currently in [the startup script](https://doc.mapeditor.org/en/latest/reference/scripting/#startup-script).

---

<div class="post-metadata">

**Author:** ![ilya\_stepanov](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@ilya\_stepanov](https://discourse.mapeditor.org/u/ilya_stepanov)\
**Post date:** [February 21, 2019, 6:01am UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/7 "2019-02-21T06:01:29Z")

</div>

Thanks for the answer @bjorn! Yeah I love that option. But unfortunately having problems with it too.  
Asked a question in separate thread:

> [@Trying to use scripting API](https://discourse.mapeditor.org/t/trying-to-use-scripting-api/3758):
>
> Working on Windows with 1.2.2 version of Tiled. Added startup.js with example code given here: [https://doc.mapeditor.org/en/latest/reference/scripting/#script-registermapformat](https://doc.mapeditor.org/en/latest/reference/scripting/#script-registermapformat) Paced script into C:\ProgramData\Tiled and C:\Program Files\Tiled and even C:\Users\\<user\>\.tiled But nothing seems to happen. No new format in Export As dialog. Also I only have Debug Console in Toolbars wich doesn’t have any input. So I suppose it’s not the console mentioned here [https://doc.mapeditor.org/en/latest/…](https://doc.mapeditor.org/en/latest/reference/scripting/#console-view)

---

<div class="post-metadata">

**Author:** ![ilya\_stepanov](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@ilya\_stepanov](https://discourse.mapeditor.org/u/ilya_stepanov)\
**Post date:** [February 22, 2019, 12:36pm UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/8 "2019-02-22T12:36:21Z")

</div>

[https://github.com/ilius33/TiledToAngbandExport](https://github.com/ilius33/TiledToAngbandExport) made a startup.js script for your needs.

---

<div class="post-metadata">

**Author:** ![tangar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/tangar/32/2217_2.png) [@tangar](https://discourse.mapeditor.org/u/tangar)\
**Post date:** [February 22, 2019, 2:20pm UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/9 "2019-02-22T14:20:56Z")

</div>

awesome 😃 THANKS! =)

---

<div class="post-metadata">

**Author:** ![Modanung](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/modanung/32/3100_2.png) [@Modanung](https://discourse.mapeditor.org/u/Modanung)\
**Post date:** [February 23, 2019, 7:26am UTC](https://discourse.mapeditor.org/t/how-to-map-graphic-tileset-to-ascii-symbols/3752/10 "2019-02-23T07:26:11Z")

</div>

I see there’s an upcoming game jam on [itch.io](https://itch.io/jam/7drl-challenge-2019) where this script could prove useful:

> **[7DRL Challenge 2019](https://itch.io/jam/7drl-challenge-2019)**
>
> A game jam from 2019-03-01 to 2019-05-06 hosted by Slashie, jmlait & Darren Grey. Remember the timeframe is from March 2 to March 10 in your timezone, pick max 7 days to work within these dates. History and Rationale Roguelikes are
