HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

PathMapper

03-20-2010, 10:06 PM#1
TheKid
In a blank map, I pasted this script into the custom code:

Collapse JASS:
//! external PathMapper Vrck 2 1 |

It gave me an error, so I thought I was doing something wrong. I went to check out the implementation in the GrimEx manual and it seems I was doing it properly. I copied the code provided by the manual and pasted it into my map (which worked). Then I changed the line of code that I had pasted to what I had before, and PathMapper didn't give me any errors.

So, my question is, why is it that my line of code did not work? I shouldn't have to paste code to the external path-mapper to make it compile in order to be able to use it properly... it really doesn't make any sense that the line of code I had didn't work the first try since I have the same line of code in 2 other maps.

What baffles me is why it only worked after a copied and pasted different code, and then replaced the code with my original code.

****
After reading through the PathMapper manual I found it extremely hard to follow --there are a total of 4 examples that look/act completely different, and the only explanation seems to be tables of hexadecimal numbers. The logic in which these numbers are used to determine the resulting pathability is very unclear.

Quote:
Originally Posted by Grim Manual
Now to modify the pathing map, you'll need a way to specify which cells will be changed and a way to apply flag values to the existing value of each cell. For the latter there are four different apply modes that you can use.
* | binary or -> flag is added
* & binary and -> common flags remain
* ^ binary xor -> common flags are removed
* default set -> value is overwritten

Quote:
Originally Posted by Grim Manual
To be able to use it you'll need a bit more information. First of all you'll need to know the tile ids, which you can obtain from TerrainArt\Terrain.slk or from this list. Then you'll need the pathability flag table to determine which values you want to apply to the pathing map.

This is the example associated with this section:

Collapse JASS:
//! external PathMapper LdrtLgrsLgrd 2 |

Quote:
Originally Posted by Grim Manual
02 1=no walk 0=walk ok

There is absolutely no explanation on how you go from "02" and "1" or "0" to simply "2". The consistency of this manual is lacking, I don't know how anybody could actually follow this (yet there are lots who know how to use it, *sigh*). It doesn't help when code that should work returns compile errors, either.
03-20-2010, 10:55 PM#2
Ammorth
The 2 going to 1, 0 is actually just binary.

When writing code, sometimes you can use the binary values of an integer as flags (so you can have x flags for x bit integers). 1 is on and 0 is off.

0110 = 6; from right to left, the flags are: off, on, on, off
1101 = 13; on, off, on, on

The operations, "|" (or), "&" (and) and "^" (xor) can modify this flags using a "mask" (aka another integer value with corresponding 1's and 0's.

"Or"ing a number will "add flags that are on". Example:

0100 | 1001 = 1101
0010 | 1000 = 1010
1000 | 0000 = 1000

"And"ing will require both flags to be on, example:

0100 & 0101 = 0100
1011 & 0110 = 0010
1100 & 1011 = 1000

"Xor"ing (exclusive or) requires 1 flag, or the other flag, but not both flags. (aka, its an "(A or B) and not (A and B)"), example:

0110 ^ 1100 = 1010
0011 ^ 1010 = 1001
1001 ^ 0001 = 1000

As for why it works after copying and pasting, im not to sure.. Hopefully this will help you understand the manual better.

So basically you can do
Collapse JASS:
//! external PathMapper <tile1><tile2><tile3>...<tileN> <integer representation of binary mask> <operation>

Edit: Stuff above was only speculation and is not correct. Please ignore.
03-20-2010, 11:02 PM#3
TheKid
Okay, I understand that much.

How this is used in the PathMapper is still a little hazy for me though. How is something like this evaluated?

Collapse JASS:
//! external PathMapper Vrck 2 1

What does the "2" refer to, and how is it that the "1" is applied to the 2 specifically. I don't know, its a little hard to explain and it wouldn't be such a pain in the ass if it didn't give me compile problems for code that theoretically should work.

Quote:
Originally Posted by Ammorth
The 2 going to 1, 0 is actually just binary.

What do you mean? The "02" and "1/0" are separate.
03-21-2010, 12:09 AM#4
Anitarf
Quote:
Originally Posted by TheKid
How this is used in the PathMapper is still a little hazy for me though. How is something like this evaluated?

Collapse JASS:
//! external PathMapper Vrck 2 1

What does the "2" refer to, and how is it that the "1" is applied to the 2 specifically. I don't know, its a little hard to explain and it wouldn't be such a pain in the ass if it didn't give me compile problems for code that theoretically should work.
"2" is your pathability bitflag written in hex, it means: not walkable, flyable, buildable, not blighted, floatable, pathable. It represents what the pathability of all "Vrck" tiles will be set to (since you are using the default apply mode, the pathability of those tiles will be simply overwritten with "2"). "1" means nothing and shouldn't be there. The only thing you can put after "2" is either a symbol that specifies the apply mode (|, &, and ^) or a symbol that specifies the check mode (!).
03-21-2010, 02:17 AM#5
TheKid
How does it know whether or not to be walkable/unwalkable?
03-21-2010, 05:32 AM#6
Ammorth
I think I figured it out TheKid... (someone correct me if I am wrong)...

Based on the following table:
  • 01 0=unused
  • 02 1=no walk 0=walk ok
  • 04 1=no fly 0=fly ok
  • 08 1=no build 0=build ok
  • 10 0=unused
  • 20 1=blight 0=normal
  • 40 1=no water 0=water
  • 80 1=unpathable 0=normal

the 0's are "default" aka, the default values if you passed a mask of 0. Ifyou want to change certain flags, you add the designated number to your current number (start at 0), but as hexidecimal (after 9 you count from A to F).

So, if you wanted to make it unbuildable and unflyable, you would start with 0, add 04 for no fly and then add 08 for no build.

04 + 08 = 0(12) = 0C

If you wanted it to be blight and no walk, you would start with 0 and add 02 for no walk and 20 for no blight.

02 + 20 = 22

Making no walk no fly and no build would be:

02 + 04 + 08 = 0(14) = 0E

Some "Default" values are as follows:
  • 00 bridge doodad
  • 08 shallow water
  • 0A deep water
  • 40 normal ground
  • 48 water ramp, unbuildable grounds, unbuildable parts of doodads
  • CA cliff edges, solid parts of doodads
  • CE map boundaries
03-21-2010, 09:03 PM#7
TheKid
This actually helps quite a bit and I cannot rep you or I would; I think that just one more question and I'll know roughly what I'm doing.

Say I wanted:
  • Walk Ok
  • Fly Ok
  • No Build

What would be the external call for that?
03-21-2010, 09:32 PM#8
Ammorth
Collapse JASS:
//! external PathMapper <tiles> 48

08 for no build and 40 for no water.
03-21-2010, 10:06 PM#9
TheKid
Oh okay I get it now. Thanks for your time.

When I copy+paste the code you just wrote directly into custom script and save, it gives me this error:
"Invalid apply flags 48//============================================================= specified"

It seems like this error goes away when I put a couple of extra lines after the external call. Oh I see why. After its converted to plain old JASS for some reason it adds the big "=" bar comment to the apply flag, screwing things up.