| 03-20-2010, 10:06 PM | #1 | |||
In a blank map, I pasted this script into the custom code: 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:
Quote:
This is the example associated with this section: JASS://! external PathMapper LdrtLgrsLgrd 2 |Quote:
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 |
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 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 | |
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? JASS://! external PathMapper Vrck 2 1What 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:
What do you mean? The "02" and "1/0" are separate. |
| 03-21-2010, 12:09 AM | #4 | |
Quote:
|
| 03-21-2010, 02:17 AM | #5 |
How does it know whether or not to be walkable/unwalkable? |
| 03-21-2010, 05:32 AM | #6 |
I think I figured it out TheKid... (someone correct me if I am wrong)... Based on the following table:
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:
|
| 03-21-2010, 09:03 PM | #7 |
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:
What would be the external call for that? |
| 03-21-2010, 09:32 PM | #8 |
JASS://! external PathMapper <tiles> 4808 for no build and 40 for no water. |
| 03-21-2010, 10:06 PM | #9 |
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. |
