07-05-2021, 05:44 PM
I wonder if it would be possible to have a direction function that combines directions, like (directions {<absoluteDirection>}) and (directions {<relativeDirection>}), but which works for all directions.
I wanted to combine (directions Cell from:(last From) to:(last To)) and some function of that direction ("NextDirectionCW" (directions Cell from:(last From) to:(last To))), but ended up having to use (difference <direction> <direction>) in order to combine them. It seems to me to be logically equivalent to what I am suggesting, but it is not pretty, and not very readable:
I cannot be sure I that my workaround works at all, though, because the scripts I have tried it in reports an error:
I wanted to combine (directions Cell from:(last From) to:(last To)) and some function of that direction ("NextDirectionCW" (directions Cell from:(last From) to:(last To))), but ended up having to use (difference <direction> <direction>) in order to combine them. It seems to me to be logically equivalent to what I am suggesting, but it is not pretty, and not very readable:
Code:
(difference
Orthogonal
(difference
(difference
Orthogonal
(directions Cell from:(last From) to:(last To))
)
("NextDirectionCW" (directions Cell from:(last From) to:(last To)))
)
)
I cannot be sure I that my workaround works at all, though, because the scripts I have tried it in reports an error:
Quote:Exception during game creation: java.lang.reflect.InvocationTargetExceptionThis is the same error I reported here, and I suspect this very bit of code is the problem.