Terrain codes

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
hyper_cubed
Posts: 32
Joined: March 31st, 2018, 7:52 pm
Location: USA

Terrain codes

Post by hyper_cubed » April 22nd, 2018, 7:43 pm

Hey guys, does anyone have any precompiled lists of terrain codes? I work as a database developer and have very little time after work. I am about 3-5k lines into my mod and want to create a terrain resource I just don't have the time to list out all the possibilities. If anyone has a resource, could you please respond?

User avatar
Pentarctagon
Forum Administrator
Posts: 3543
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Terrain codes

Post by Pentarctagon » April 22nd, 2018, 7:46 pm

You mean something like this?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

hyper_cubed
Posts: 32
Joined: March 31st, 2018, 7:52 pm
Location: USA

Re: Terrain codes

Post by hyper_cubed » April 22nd, 2018, 8:39 pm

Pentarctagon wrote:
April 22nd, 2018, 7:46 pm
You mean something like this?
Doh,

now I feel dumb.

hyper_cubed
Posts: 32
Joined: March 31st, 2018, 7:52 pm
Location: USA

Re: Terrain codes

Post by hyper_cubed » April 23rd, 2018, 12:00 am

Pentarctagon wrote:
April 22nd, 2018, 7:46 pm
You mean something like this?
This may not be suitable for everyone, but I intend to build a string builder that initializes variables so an individual can build terrain string definitions as needed.

I will post my code later but in the mean time if it helps anybody, I built an array out of the information that pentarctagon pointed me to.

This is untested, but should be error free.

Code: Select all

[set_variables]
	name=terrain_data
	[value]
		name=Gray_Deep_Water
		string=Wog
		alias_of=Wdt
		editor_group=water
	[/value]
	[value]
		name=Medium_Deep_Water
		string=Wo
		alias_of=Wdt
		editor_group=water
	[/value]
	[value]
		name=Tropical_Deep_Water
		string=Wot
		alias_of=Wdt
		editor_group=water
	[/value]
	[value]
		name=Gray_Shallow_Water
		string=Wwg
		alias_of=Wst
		editor_group=water
	[/value]
	[value]
		name=Medium_Shallow_Water
		string=Ww
		alias_of=Wst
		editor_group=water
	[/value]
	[value]
		name=Tropical_Shallow_Water
		string=Wwt
		alias_of=Wst
		editor_group=water
	[/value]
	[value]
		name=Ford
		string=Wwf
		alias_of=Gt,Wst
		editor_group=water
	[/value]
	[value]
		name=Gray_Coastal_Reef
		string=Wwrg
		alias_of=Wrt
		editor_group=water
	[/value]
	[value]
		name=Medium_Coastal_Reef
		string=Wwr
		alias_of=Wrt
		editor_group=water
	[/value]
	[value]
		name=Tropical_Coastal_Reef
		string=Wwrt
		alias_of=Wrt
		editor_group=water
	[/value]
	[value]
		name=Swamp_Water_Reed
		string=Ss
		alias_of=St
		editor_group=water
	[/value]
	[value]
		name=Muddy_Quagmire
		string=Sm
		alias_of=St
		editor_group=water
	[/value]
	[value]
		name=Green_Grass
		string=Gg
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Semi-dry_Grass
		string=Gs
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Dry_Grass
		string=Gd
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Leaf_Litter
		string=Gll
		alias_of=Gt
		editor_group=flat,fall
	[/value]
	[value]
		name=Dark_Dirt
		string=Rb
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Regular_Dirt
		string=Re
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Dry_Dirt
		string=Rd
		alias_of=Gt
		editor_group=desert,flat
	[/value]
	[value]
		name=Regular_Cobbles
		string=Rr
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Clean_Gray_Cobbles
		string=Rrc
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Overgrown_Cobbles
		string=Rp
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Ice
		string=Ai
		alias_of=At
		editor_group=frozen
	[/value]
	[value]
		name=Snow
		string=Aa
		alias_of=At
		editor_group=frozen
	[/value]
	[value]
		name=Desert_Sands
		string=Dd
		alias_of=Dt
		editor_group=desert
	[/value]
	[value]
		name=Beach_Sands
		string=Ds
		alias_of=Dt
		editor_group=desert
	[/value]
	[value]
		name=Oasis
		string=^Do
		alias_of=_bas
		editor_group=desert,forest
	[/value]
	[value]
		name=Rubble
		string=^Dr
		alias_of=_bas,Ht
		editor_group=desert,rough
	[/value]
	[value]
		name=Crater
		string=Dd^Dc
		alias_of=Dt
		editor_group=desert
	[/value]
	[value]
		name=Mixed_Flowers
		string=^Efm
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Farmland
		string=^Gvs
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Stones
		string=^Es
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Small_Mushrooms
		string=^Em
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Mushroom_Farm
		string=^Emf
		alias_of=_bas
		editor_group=embellishments,cave
	[/value]
	[value]
		name=Desert_Plants
		string=^Edp
		alias_of=_bas
		editor_group=embellishments,desert
	[/value]
	[value]
		name=Desert_Plants_without_Bones
		string=^Edpp
		alias_of=_bas
		editor_group=embellishments,desert
	[/value]
	[value]
		name=Windmill
		string=^Wm
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Campfire
		string=^Ecf
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Fence
		string=^Eff
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Stones_with_Sand_Drifts
		string=^Esd
		alias_of=_bas
		editor_group=embellishments,desert
	[/value]
	[value]
		name=Water_Lilies
		string=^Ewl
		alias_of=_bas
		editor_group=water,embellishments
	[/value]
	[value]
		name=Flowering_Water_Lilies
		string=^Ewf
		alias_of=_bas
		editor_group=water,embellishments
	[/value]
	[value]
		name=Trash
		string=^Edt
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Remains
		string=^Edb
		alias_of=_bas
		editor_group=embellishments
	[/value]
	[value]
		name=Great_Tree
		string=^Fet
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Dead_Great_Tree
		string=^Fetd
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Tropical_Forest
		string=^Ft
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Rainforest
		string=^Ftr
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Palm_Forest
		string=^Ftd
		alias_of=_bas,Ft
		editor_group=forest,desert
	[/value]
	[value]
		name=Dense_Palm_Forest
		string=^Ftp
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Savanna
		string=^Fts
		alias_of=_bas,Ft
		editor_group=forest,desert
	[/value]
	[value]
		name=Pine_Forest
		string=^Fp
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Snowy_Pine_Forest
		string=^Fpa
		alias_of=_bas,At,Ft
		editor_group=frozen,forest
	[/value]
	[value]
		name=Summer_Deciduous_Forest
		string=^Fds
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Fall_Deciduous_Forest
		string=^Fdf
		alias_of=_bas,Ft
		editor_group=forest,fall
	[/value]
	[value]
		name=Winter_Deciduous_Forest
		string=^Fdw
		alias_of=_bas,Ft
		editor_group=forest,fall
	[/value]
	[value]
		name=Snowy_Deciduous_Forest
		string=^Fda
		alias_of=_bas,At,Ft
		editor_group=frozen,forest
	[/value]
	[value]
		name=Summer_Mixed_Forest
		string=^Fms
		alias_of=_bas,Ft
		editor_group=forest
	[/value]
	[value]
		name=Fall_Mixed_Forest
		string=^Fmf
		alias_of=_bas,Ft
		editor_group=forest,fall
	[/value]
	[value]
		name=Winter_Mixed_Forest
		string=^Fmw
		alias_of=_bas,Ft
		editor_group=forest,fall
	[/value]
	[value]
		name=Snowy_Mixed_Forest
		string=^Fma
		alias_of=_bas,At,Ft
		editor_group=frozen,forest
	[/value]
	[value]
		name=Regular_Hills
		string=Hh
		alias_of=Ht
		editor_group=rough
	[/value]
	[value]
		name=Dry_Hills
		string=Hhd
		alias_of=Ht
		editor_group=fall,rough
	[/value]
	[value]
		name=Dunes
		string=Hd
		alias_of=Dt,Ht
		editor_group=desert,rough
	[/value]
	[value]
		name=Snow_Hills
		string=Ha
		alias_of=At,Ht
		editor_group=frozen,rough
	[/value]
	[value]
		name=Regular_Mountains
		string=Mm
		alias_of=Mt
		editor_group=rough
	[/value]
	[value]
		name=Dry_Mountains
		string=Md
		alias_of=Mt
		editor_group=rough,desert
	[/value]
	[value]
		name=Snowy_Mountains
		string=Ms
		alias_of=At,Mt
		editor_group=rough,frozen
	[/value]
	[value]
		name=Basic_Wooden_Floor
		string=Iwr
		alias_of=Gt
		editor_group=flat
	[/value]
	[value]
		name=Beam_of_Light
		string=^Ii
		alias_of=_bas
		editor_group=cave
	[/value]
	[value]
		name=Cave_Floor
		string=Uu
		alias_of=Ut
		editor_group=cave
	[/value]
	[value]
		name=Earthy_Cave_Floor
		string=Uue
		alias_of=Ut
		editor_group=cave
	[/value]
	[value]
		name=Dark_Flagstones
		string=Urb
		alias_of=Gt
		editor_group=cave,flat
	[/value]
	[value]
		name=Cave_Path
		string=Ur
		alias_of=Gt
		editor_group=cave,flat
	[/value]
	[value]
		name=Mushroom_Grove
		string=^Uf
		alias_of=Uft
		editor_group=cave,forest
	[/value]
	[value]
		name=Lit_Mushroom_Grove
		string=^Ufi
		alias_of=Uft
		editor_group=cave
	[/value]
	[value]
		name=Rockbound_Cave
		string=Uh
		alias_of=Ut,Ht
		editor_group=cave,rough
	[/value]
	[value]
		name=Mine_Rail
		string=^Br|
		alias_of=_bas,Rt
		editor_group=cave
	[/value]
	[value]
		name=Mine_Rail
		string=^Br/
		alias_of=_bas,Rt
		editor_group=cave
	[/value]
	[value]
		name=Mine_Rail
		string=^Br\
		alias_of=_bas,Rt
		editor_group=cave
	[/value]
	[value]
		name=Regular_Chasm
		string=Qxu
		alias_of=Qt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Earthy_Chasm
		string=Qxe
		alias_of=Qt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Ethereal_Abyss
		string=Qxua
		alias_of=Qt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Lava_Chasm
		string=Ql
		alias_of=Qt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Lava
		string=Qlf
		alias_of=Qt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Volcano
		string=Mv
		alias_of=Qt
		editor_group=rough,obstacle
	[/value]
	[value]
		name=Regular_Impassable_Mountains
		string=Mm^Xm
		alias_of=-,Mt,Xt
		editor_group=rough,obstacle
	[/value]
	[value]
		name=Desert_Impassable_Mountains
		string=Md^Xm
		alias_of=-,Mt,Xt
		editor_group=rough,obstacle,desert
	[/value]
	[value]
		name=Snowy_Impassable_Mountains
		string=Ms^Xm
		alias_of=-,Mt,Xt
		editor_group=rough,obstacle,frozen
	[/value]
	[value]
		name=Natural_Cave_Wall
		string=Xu
		alias_of=Xt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Hewn_Cave_Wall
		string=Xuc
		alias_of=Xt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Natural_Earthy_Cave_Wall
		string=Xue
		alias_of=Xt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Reinforced_Earthy_Cave_Wall
		string=Xuce
		alias_of=Xt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Stone_Wall
		string=Xos
		alias_of=Xt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Lit_Stone_Wall
		string=Xol
		alias_of=Xt
		editor_group=cave,obstacle
	[/value]
	[value]
		name=Impassable_Overlay
		string=^Xo
		alias_of=_bas,Xt
		editor_group=obstacle,special
	[/value]
	[value]
		name=Unwalkable_Overlay
		string=^Qov
		alias_of=_bas,Qt
		editor_group=obstacle,special
	[/value]
	[value]
		name=Void
		string=Xv
		alias_of=Xt
		editor_group=obstacle,special
	[/value]
	[value]
		name=Adobe_Village
		string=^Vda
		alias_of=_bas,Vt
		editor_group=village,desert
	[/value]
	[value]
		name=Desert_Tent_Village
		string=^Vdt
		alias_of=_bas,Vt
		editor_group=village,desert
	[/value]
	[value]
		name=Tent_Village
		string=^Vct
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Orcish_Village
		string=^Vo
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Snowy_Orcish_Village
		string=^Voa
		alias_of=_bas,Vt
		editor_group=village,frozen
	[/value]
	[value]
		name=Snowy_Elven_Village
		string=^Vea
		alias_of=_bas,Vt
		editor_group=village,frozen
	[/value]
	[value]
		name=Elven_Village
		string=^Ve
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Cottage
		string=^Vh
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Snowy_Cottage
		string=^Vha
		alias_of=_bas,Vt
		editor_group=village,frozen
	[/value]
	[value]
		name=Ruined_Cottage
		string=^Vhr
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Human_City
		string=^Vhc
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Windmill_Village
		string=^Vwm
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Snowy_Human_City
		string=^Vhca
		alias_of=_bas,Vt
		editor_group=village,frozen
	[/value]
	[value]
		name=Ruined_Human_City
		string=^Vhcr
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Hill_Stone_Village
		string=^Vhh
		alias_of=_bas,Vt
		editor_group=village,rough
	[/value]
	[value]
		name=Snowy_Hill_Stone_Village
		string=^Vhha
		alias_of=_bas,Vt
		editor_group=village,frozen,rough
	[/value]
	[value]
		name=Ruined_Hill_Stone_Village
		string=^Vhhr
		alias_of=_bas,Vt
		editor_group=village,rough
	[/value]
	[value]
		name=Tropical_Village
		string=^Vht
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Drake_Village
		string=^Vd
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Cave_Village
		string=^Vu
		alias_of=_bas,Vt
		editor_group=village,cave
	[/value]
	[value]
		name=Dwarven_Village
		string=^Vud
		alias_of=_bas,Vt
		editor_group=village,cave
	[/value]
	[value]
		name=Hut
		string=^Vc
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Snowy_Hut
		string=^Vca
		alias_of=_bas,Vt
		editor_group=village,frozen
	[/value]
	[value]
		name=Log_Cabin
		string=^Vl
		alias_of=_bas,Vt
		editor_group=village
	[/value]
	[value]
		name=Snowy_Log_Cabin
		string=^Vla
		alias_of=_bas,Vt
		editor_group=village,frozen
	[/value]
	[value]
		name=Igloo
		string=^Vaa
		alias_of=_bas,Vt
		editor_group=village,frozen
	[/value]
	[value]
		name=Swamp_Village
		string=^Vhs
		alias_of=_bas,Vt
		editor_group=water,village
	[/value]
	[value]
		name=Merfolk_Village
		string=^Vm
		alias_of=_bas
		editor_group=water,village
	[/value]
	[value]
		name=Village_Overlay
		string=^Vov
		alias_of=_bas
		editor_group=village,special
	[/value]
	[value]
		name=Encampment
		string=Ce
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Snowy_Encampment
		string=Cea
		alias_of=Ct,At
		editor_group=castle,frozen
	[/value]
	[value]
		name=Orcish_Castle
		string=Co
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Snowy_Orcish_Castle
		string=Coa
		alias_of=Ct,At
		editor_group=castle,frozen
	[/value]
	[value]
		name=Human_Castle
		string=Ch
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Snowy_Human_Castle
		string=Cha
		alias_of=Ct,At
		editor_group=castle,frozen
	[/value]
	[value]
		name=Elven_Castle
		string=Cv
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Dwarven_Castle
		string=Cud
		alias_of=Ct
		editor_group=castle,cave
	[/value]
	[value]
		name=Ruined_Human_Castle
		string=Chr
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Sunken_Human_Ruin
		string=Chw
		alias_of=Ct,Wst
		editor_group=castle,water
	[/value]
	[value]
		name=Swamp_Human_Ruin
		string=Chs
		alias_of=Ct,St
		editor_group=castle,water
	[/value]
	[value]
		name=Desert_Castle
		string=Cd
		alias_of=Ct
		editor_group=castle,desert
	[/value]
	[value]
		name=Ruined_Desert_Castle
		string=Cdr
		alias_of=Ct
		editor_group=castle,desert
	[/value]
	[value]
		name=Encampment_Keep
		string=Ke
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Tall_Encampment_Keep
		string=Ket
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Snowy_Encampment_Keep
		string=Kea
		alias_of=Ct,At
		editor_group=castle,frozen
	[/value]
	[value]
		name=Orcish_Keep
		string=Ko
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Snowy_Orcish_Keep
		string=Koa
		alias_of=Ct,At
		editor_group=castle,frozen
	[/value]
	[value]
		name=Human_Castle_Keep
		string=Kh
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Snowy_Human_Castle_Keep
		string=Kha
		alias_of=Ct,At
		editor_group=castle,frozen
	[/value]
	[value]
		name=Elven_Castle_Keep
		string=Kv
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Dwarven_Castle_Keep
		string=Kud
		alias_of=Ct
		editor_group=castle,cave
	[/value]
	[value]
		name=Ruined_Human_Castle_Keep
		string=Khr
		alias_of=Ct
		editor_group=castle
	[/value]
	[value]
		name=Sunken_Human_Castle_Keep
		string=Khw
		alias_of=Ct,Wst
		editor_group=castle,water
	[/value]
	[value]
		name=Swamp_Human_Castle_Keep
		string=Khs
		alias_of=Ct,St
		editor_group=castle,water
	[/value]
	[value]
		name=Desert_Keep
		string=Kd
		alias_of=Ct
		editor_group=castle,desert
	[/value]
	[value]
		name=Ruined_Desert_Keep
		string=Kdr
		alias_of=Ct
		editor_group=castle,desert
	[/value]
	[value]
		name=Castle_Overlay
		string=^Cov
		alias_of=_bas
		editor_group=castle,special
	[/value]
	[value]
		name=Keep_Overlay
		string=^Kov
		alias_of=_bas
		editor_group=castle,special
	[/value]
	[value]
		name=Wooden_Bridge
		string=^Bw|
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Wooden_Bridge
		string=^Bw/
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Wooden_Bridge
		string=^Bw\
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Rotting_Bridge
		string=^Bw|r
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Rotting_Bridge
		string=^Bw/r
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Rotting_Bridge
		string=^Bw\r
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Basic_Stone_Bridge
		string=^Bsb|
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Basic_Stone_Bridge
		string=^Bsb\
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Basic_Stone_Bridge
		string=^Bsb/
		alias_of=_bas,Gt
		editor_group=bridge,water
	[/value]
	[value]
		name=Cave_Chasm_Bridge
		string=^Bs|
		alias_of=Ut,_bas
		editor_group=bridge,cave
	[/value]
	[value]
		name=Cave_Chasm_Bridge
		string=^Bs/
		alias_of=Ut,_bas
		editor_group=bridge,cave
	[/value]
	[value]
		name=Cave_Chasm_Bridge
		string=^Bs\
		alias_of=Ut,_bas
		editor_group=bridge,cave
	[/value]
	[value]
		name=Hanging_Bridge
		string=^Bh\
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Hanging_Bridge
		string=^Bh/
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Hanging_Bridge
		string=^Bh|
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Stone_Chasm_Bridge
		string=^Bcx\
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Stone_Chasm_Bridge
		string=^Bcx/
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Stone_Chasm_Bridge
		string=^Bcx|
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Plank_Bridge
		string=^Bp\
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Plank_Bridge
		string=^Bp/
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Plank_Bridge
		string=^Bp|
		alias_of=_bas,Gt
		editor_group=bridge,cave
	[/value]
	[value]
		name=Off_Map
		string=_off^_usr
		alias_of=
		editor_group=special,obstacle
	[/value]
	[value]
		name=Experimental_Fake_Map_Edge
		string=^_fme
		alias_of=
		editor_group=special,obstacle
	[/value]
	[value]
		name=Shroud
		string=_s
		alias_of=
		editor_group=special
	[/value]
	[value]
		name=Fog
		string=_f
		alias_of=
		editor_group=special
	[/value]
[/set_variables]

Shiki
Developer
Posts: 224
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: Terrain codes

Post by Shiki » April 23rd, 2018, 12:22 am

This is the script which created the wiki page, maybe you want to have a look:
https://github.com/wesnoth/wesnoth/blob ... in2wiki.py
Maintainer of Era of Myths.
Introduction to WML filtering and WML variables.

hyper_cubed
Posts: 32
Joined: March 31st, 2018, 7:52 pm
Location: USA

Re: Terrain codes

Post by hyper_cubed » April 23rd, 2018, 2:23 am

Shiki wrote:
April 23rd, 2018, 12:22 am
This is the script which created the wiki page, maybe you want to have a look:
https://github.com/wesnoth/wesnoth/blob ... in2wiki.py
EDIT: for some reason, it is double building the string. Gotta look into it, but almost done. Also the fail string isn't working all the way yet.

Edit: I fixed the issues and set it to produce two variables. One for the passing string and one for the failing string, that way you can filter on pass and fail in events (see attached pictures). I re-uploaded Terrain_Data.cfg with the fixed code. I am fairly certain that it is working properly, but I am untrained with terrain codes and not sure if everything is right with the codes themselves.

Last Edit: Created a second function to search in the "name" field as well. Re-uploaded Terrain_Data.cfg. This allows you to create a string that passes that looks at both the terrain tags and the label. This would be useful if you wanted cave terrain but wanted to exclude terrain that had "lit_" or "light" in the label. Attached result of my macro call below.


I finished my resource. I am obviously not super versed in lua (still learning). I wrote this in wml mainly. This is pretty much my first time looking at terrain data, but this may be helpful if you wanted to create a terrain list for use in events and or effects. The idea would be to set a global type variable on scenario start.

Basically the idea is a string lookup that switches on a pass fail basis. The result is a recursively built terrain string. The editor group tags are used as comma delimited strings that pass to "pass" "fail" in the macro.

I did a quick test in my mod in the inspector to see if it created a proper terrain string variable.

Code is attached. Both the Terrain_Data.cfg, Find_string.cfg, and Concatenate.cfg files are required. The main loop is at the bottom of Terrain_Data.cfg if you are curious about how it works.
This is how I called it where test_terrain_data is my desired variable name, and pass and fail represent my query.

Code: Select all

{terrain_data}
	{terrain_string test_terrain_data tags "desert,cave" "obstacle,embellishment,village,bridge,water,rough" label "crater" "lit_,light"}
	{CLEAR_VARIABLE terrain_data}
	{clear_terrain_data test_terrain_data}
Attachments
Terrain_Data.cfg
(21.04 KiB) Downloaded 26 times
Pass.PNG
Fail.PNG
Find_String.cfg
(450 Bytes) Downloaded 23 times
Concatenate.cfg
(328 Bytes) Downloaded 27 times

Post Reply