Regarding your first problem: It seems that you are missing a closing parenthesis. creep.attack(hostile[0] == ERR_NOT_IN_RANGE
should be creep.attack(hostile[0]) == ERR_NOT_IN_RANGE
.
Coelso
@Coelso
3
Posts
991
Profile views
0
Followers
0
Following
Posts made by Coelso
-
RE: This weird error.
-
RE: Unexpected Syntax error
Create a RoomPosition object like this:
const buildPos = new RoomPosition(pos.x + x, pos.y + y, pos.roomName);
-
RE: Id<T>
@adeptofnone said in Id<T>:
OK, let one rephrase one's question. Imagine one was storing a bunch of id-s, let's say for structures to be maintained, and imagine that this list would include walls and ramparts.
How would one go about invoking the magicks of getObjectById of this list w/o incurring the wrath of tslint (pbuh)?The
T
inId<T>
can be a union type. So you can do something like:let id: Id<StructureWall | StructureRampart>; let wallOrRampart: StructureWall | StructureRampart | null = Game.getObjectById(id);
You can read more about union types here: https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html