admin管理员组

文章数量:1320815

Where can I find a list of the constants for the Game object like Game.HOSTILE_CREEPS, Game.MOVE and Game.ATTACK?

I cannot find it on /

Where can I find a list of the constants for the Game object like Game.HOSTILE_CREEPS, Game.MOVE and Game.ATTACK?

I cannot find it on http://screeps./docs/

Share Improve this question edited Nov 21, 2014 at 14:34 zisoft 23.1k10 gold badges64 silver badges74 bronze badges asked Nov 21, 2014 at 8:47 LapuLapu 771 silver badge3 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

They can be found at the game docs (bottom of the page)

Constants

Result Codes

  • Game.OK 0
  • Game.ERR_NOT_OWNER -1
  • Game.ERR_NO_PATH -2
  • Game.ERR_NAME_EXISTS -3
  • Game.ERR_BUSY -4
  • Game.ERR_NOT_FOUND -5
  • Game.ERR_NOT_ENOUGH_ENERGY -6
  • Game.ERR_INVALID_TARGET -7
  • Game.ERR_FULL -8
  • Game.ERR_NOT_IN_RANGE -9
  • Game.ERR_INVALID_ARGS -10
  • Game.ERR_TIRED -11
  • Game.ERR_NO_BODYPART -12
  • Game.ERR_NOT_ENOUGH_EXTENSIONS -13

Room.find() constants

  • Game.CREEPS 1
  • Game.MY_CREEPS 2
  • Game.HOSTILE_CREEPS 3
  • Game.SOURCES_ACTIVE 4
  • Game.SOURCES 5
  • Game.DROPPED_ENERGY 6
  • Game.STRUCTURES 7
  • Game.MY_STRUCTURES 8
  • Game.HOSTILE_STRUCTURES 9
  • Game.FLAGS 10
  • Game.CONSTRUCTION_SITES 11
  • Game.MY_SPAWNS 12
  • Game.HOSTILE_SPAWNS 13
  • Game.EXIT_TOP 14
  • Game.EXIT_RIGHT 15
  • Game.EXIT_BOTTOM 16
  • Game.EXIT_LEFT 17

Directions

  • Game.TOP 1
  • Game.TOP_RIGHT 2
  • Game.RIGHT 3
  • Game.BOTTOM_RIGHT 4
  • Game.BOTTOM 5
  • Game.BOTTOM_LEFT 6
  • Game.LEFT 7
  • Game.TOP_LEFT 8

Body Parts

  • Game.MOVE "move"
  • Game.WORK "work"
  • Game.CARRY "carry"
  • Game.ATTACK "attack"
  • Game.RANGED_ATTACK "ranged_attack"
  • Game.TOUGH "tough"
  • Game.HEAL "heal"

Structure Types

  • Game.STRUCTURE_EXTENSION "extension"
  • Game.STRUCTURE_RAMPART "rampart"
  • Game.STRUCTURE_ROAD "road"
  • Game.STRUCTURE_SPAWN "spawn"
  • Game.STRUCTURE_WALL "constructedWall"

Colors

  • Game.COLOR_RED "red"
  • Game.COLOR_PURPLE "purple"
  • Game.COLOR_BLUE "blue"
  • Game.COLOR_CYAN "cyan"
  • Game.COLOR_GREEN "green"
  • Game.COLOR_YELLOW "yellow"
  • Game.COLOR_ORANGE "orange"
  • Game.COLOR_BROWN "brown"
  • Game.COLOR_GREY "grey"
  • Game.COLOR_WHITE "white"

Room Modes

  • Game.MODE_SIMULATION "simulation"
  • Game.MODE_SURVIVAL "survival"
  • Game.MODE_WORLD "world"

Depends on what you're looking for:

  1. This is the list of constants used for finding stuff, expand find(type, [opts]) (ex: Game.HOSTILE_CREEPS)
  2. This is the list for game constants, expand createCreep(body, [name], [memory]) (ex: Game.ATTACK)
  3. This is a list of option parameters for some functions, expand findPath(fromPos, toPos, [opts]) (ex:ignoreCreeps: boolean)

This is what I was able to find, hope it helps! The documentation kinda hard to sort through!

They are not bundled together in the docs. They are described under the methods that use them.

The ones you asked for are at:

http://screeps./docs/Room.php#find

http://screeps./docs/Spawn.php#createCreep

本文标签: javascriptScreepsWhere to find constants of Game ObjectStack Overflow