Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 17th, 2013  |  syntax: None  |  size: 6.57 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. Command Terminal Menu:
  3.  
  4. - Visibility can be toggled by using the ~ key - except when an editable text-area is selected
  5.  
  6. - The command line uses JavaScript, there is a text area adjacent to the red pointer, select it and write your scripts. After you entered your script, there are two commands you can use:
  7.  
  8. - This doesn't disclose all available commands because it would take a while to write that up...
  9.  
  10. CTRL + E (probably the only one you need) executes the script you've entered. If you're script declares functions or variables, they will be added to the global scope so they can be used later.
  11.  
  12. CTRL + L - Loads the script so that any scripts there on out are executed in the context of what you've just typed in.
  13.  
  14. - The green text of the text-area will spit out notes when executing your script - and if it evaluates to something, it will print out the evaluation. If there is an error in your script, it will display a cryptic error message (the output textarea does not scroll automatically, you must select it and scroll via middle mouse wheel)
  15.  
  16. There are three global variables accessible by the command like:
  17. game
  18.     - Used to acquire world script bridge, to load a world and to get the player entity
  19. core
  20.     - Used for nothing other than debugging purposes.
  21. me
  22.     - Used to access commands that are relevant to the console (or executing object) kind of like the 'this' keyword. In the command console you can use it to echo and clear
  23.  
  24. Functions exposed by 'me' in command console
  25. clear(); - clears the console's output textarea
  26. echo(message); - Echos message to output console.
  27.  
  28. i.e:
  29. me.clear();
  30. me.echo('hello');
  31.  
  32.  
  33. Functions exposed by 'game' in command console
  34. getPlayer() returns an instance of player's script bridge. Refer to 'Commands Exposed by Player ScriptBridge'
  35. getWorld() returns an instnace of world's script bridge. Refer to 'Commands Exposed by World ScriptBridge'
  36. loadWorld(url) loads the world located at the given URL.
  37.  
  38. There are three maps that exist in the game's File-System:
  39. map/almostatcontrol.jmp
  40. map/firstencounter.jmp
  41. map/enterance.jmp
  42.  
  43. Functions exposed by Player ScriptBridge in command console & All NPCs
  44.  
  45. Just For Player:
  46. getQuest(questName) returns an instance of the given quest tailored to that player. Provides ability to check and set quest states.
  47.  
  48. For All NPCs & Player:
  49.  
  50. getLocation() returns a Vector of integer components X, Y describing the player's location.
  51.  
  52. Example:
  53. me.echo('Players X location is: ' + game.getPlayer().getLocation().x);
  54.  
  55.  
  56. setLocation(x, y) Sets the world location to (x, y)
  57.  
  58. Example:
  59. game.getPlayer().setLocation(0, 0);
  60.  
  61. var eric = game.getWorld().getEntity('eric');
  62.  
  63. if(eric != null)
  64.     game.getPlayer().setLocation(eric.getLocation().x, eric.getLocation().y + 1);
  65. else
  66.     me.echo('The NPC Eric could not be found!');
  67.  
  68.  
  69. moveTo(x, y, tolerance) - Entity en-queues asynchronous task to walk to location (x, y) with an acceptable 'tolerance' i.e radius they are allowed to be in before declaring failure to accomplish task.
  70.  
  71. Example:
  72.  
  73. game.getPlayer().moveTo(0, 0, 1);
  74.  
  75.  
  76. attack(target) - en-queues asynchronous task to attack the given target, or fails if equip weapon allows for such range
  77.  
  78. Example:
  79.  
  80. var player = game.getPlayer();
  81. var spider = game.getWorld().getEntity('spider');
  82. spider.moveTo(player.getLocation().x, player.getLocation().y, 1);
  83. spider.attack(player);
  84. player.attack(spider);
  85.  
  86.  
  87. leave() - En-queues asynchronous task to have the character leave the scene
  88.  
  89. Example:
  90. var eric = game.getWorld().getEntity('eric');
  91. //Tell eric, first move to the coordinate 0,0
  92. eric.moveTo(0,0,1);
  93. //Then once you arrive (or if the move tasks is otherwise 'completed') leave the world
  94. eric.leave();
  95.  
  96.  
  97. isConflictingAllegiance(target) - Returns true if is in conflicting allegiance with target (I.E target is enemy)
  98. Example:
  99. var spider = game.getWorld().getEntity('spider');
  100. if(spider.isConflictingAllegiance(game.getPlayer())
  101. {
  102.     spider.moveTo(game.getPlayer().getLocation().x, game.getPlayer().getLocation().y, 1);
  103.     spider.attack(game.getPlayer());
  104. }
  105.  
  106.  
  107. getHealth() Returns an integer value which is the current health of the character, all characters have a health between 0 and 100 as of now - though that can change depending on the character's configuration file.
  108.  
  109. setHealth(health) Sets the health of the character.
  110.  
  111. example:
  112. if(game.getPlayer().getHealth() < 20);
  113.     game.getPlayer().setHealth(100);
  114.  
  115.  
  116. addItem(itemDescriptor, quantity) - Adds an item to character's inventory. Returns the number of that item added which can differ from quantity if the inventory is full before quantity is reached.
  117.  
  118. hasItem(itemDescriptor, quantity) - returns true of the player is in possession of quantity number of itemDescriptor
  119.  
  120. removeItem(itemDescriptor, quantity) - Behaves exactly has addItem only removes item. Returned value can differ from quantity if less than quantity of itemDescriptor is contained in inventory
  121.  
  122. Example
  123. var player = game.getPlayer();
  124. var eric = game.getWorld().getEntity('eric');
  125.  
  126. if(player.hasItem('item/healthpack.jitm', 1))
  127. {
  128.     me.echo('Fair trade!');
  129.     if(eric.hasItem('item/rifle.jitm', 1)
  130.     {
  131.         player.removeItem('item/healthpack.jitm', 1);
  132.         player.addItem('item/rifle.jitm', 1);
  133.         eric.addItem('item/healthpack.jitm');
  134.     }else
  135.         me.echo('Looks like eric doesnt have anything left to trade!');
  136. }
  137.  
  138.  
  139. wonder(radius) En-queues asynchronous wonder task to randomly move around.
  140.  
  141. distance(target) Returns the distance (in tiles) from the given target
  142.  
  143. look() Has the character look around it's given area (using is sight properties described in its configuration file). Any found objects cause the object to invoke a onFound() routine - you can't really use this via the command console only via entity scripts.
  144.  
  145. loadState(path) Restores the state of the entity as described by the state located at the given path. The current release uses memory states so this is sort of like a memory virtual filesystem.
  146.  
  147. saveState(path) Saves the state of the entity to the given path.
  148.  
  149.  
  150. Functions exposed by World ScriptBridge in command console
  151.  
  152. setAmbientLight(r, g, b, a) - Configure's world's ambient light.
  153.  
  154. setHour(hour) - Sets world's time
  155. setMinute(minute)
  156. setSecond(second)
  157. setHour(hour) - 24 hour time
  158.  
  159. getHour, minute etc...
  160.  
  161. setTimeMultiplier(multiplier)
  162.  
  163. Example
  164. game.getWorld().setTimeMultiplier(10000);
  165.  
  166. createEntity(name, className, npcFile)
  167.  - className has to be jevarpg.RpgCharacter
  168.  - npcFile can be:
  169.     npcs/innocentspider.jnpc
  170.     npcs/player.jnpc
  171.     npcs/spider_almostatcontrol.jnpc
  172.  
  173. getEntity(entityName)
clone this paste RAW Paste Data