You can play run the applet here:
http://gamejolt.com/games/rpg/jevaengine-project-d0/16225/
It’s a pre-release (I.e, this is hidden content) so don’t rate it etc I don’t really want a lot of people catching wind of it’s accessibility.
I mainly do this because its at a stage where it is worth playing with. Here is the guide for the command line system and some notes:
-
Only map/almostatcontrol.jmp has a script which relates world time with an ambient lighting. So if you want to see the effects of world time, you must be on that map to do it.
-
Precaching isn’t fully implemented since it hasn’t been an issue until now - essentially this means that you might get temporary pauses in the game as it prepares and caches resources that haven’t yet been accessed but are just then being accessed via a script etc.
-
Any textarea can be scrolled through with the middle mouse scroll AFTER selecting the textarea
Command Terminal Menu:
-
Visibility can be toggled by using the ~ key - except when an editable text-area is selected
-
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:
-
This doesn’t disclose all available commands because it would take a while to write that up…
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.
CTRL + L - Loads the script so that any scripts there on out are executed in the context of what you’ve just typed in.
- 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)
There are three global variables accessible by the command like:
game
- Used to acquire world script bridge, to load a world and to get the player entity
core
- Used for nothing other than debugging purposes.
me
- 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
Functions exposed by ‘me’ in command console
clear(); - clears the console’s output textarea
echo(message); - Echos message to output console.
i.e:
me.clear();
me.echo(‘hello’);
Functions exposed by ‘game’ in command console
getPlayer() returns an instance of player’s script bridge. Refer to ‘Commands Exposed by Player ScriptBridge’
getWorld() returns an instnace of world’s script bridge. Refer to ‘Commands Exposed by World ScriptBridge’
loadWorld(url) loads the world located at the given URL.
There are three maps that exist in the game’s File-System:
map/almostatcontrol.jmp
map/firstencounter.jmp
map/enterance.jmp
Functions exposed by Player ScriptBridge in command console & All NPCs
Just For Player:
getQuest(questName) returns an instance of the given quest tailored to that player. Provides ability to check and set quest states.
For All NPCs & Player:
getLocation() returns a Vector of integer components X, Y describing the player’s location.
Example:
me.echo('Players X location is: ' + game.getPlayer().getLocation().x);
setLocation(x, y) Sets the world location to (x, y)
Example:
game.getPlayer().setLocation(0, 0);
var eric = game.getWorld().getEntity('eric');
if(eric != null)
game.getPlayer().setLocation(eric.getLocation().x, eric.getLocation().y + 1);
else
me.echo('The NPC Eric could not be found!');
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.
Example:
game.getPlayer().moveTo(0, 0, 1);
attack(target) - en-queues asynchronous task to attack the given target, or fails if equip weapon allows for such range
Example:
var player = game.getPlayer();
var spider = game.getWorld().getEntity('spider');
spider.moveTo(player.getLocation().x, player.getLocation().y, 1);
spider.attack(player);
player.attack(spider);
leave() - En-queues asynchronous task to have the character leave the scene
Example:
var eric = game.getWorld().getEntity('eric');
//Tell eric, first move to the coordinate 0,0
eric.moveTo(0,0,1);
//Then once you arrive (or if the move tasks is otherwise 'completed') leave the world
eric.leave();
isConflictingAllegiance(target) - Returns true if is in conflicting allegiance with target (I.E target is enemy)
Example:
var spider = game.getWorld().getEntity('spider');
if(spider.isConflictingAllegiance(game.getPlayer())
{
spider.moveTo(game.getPlayer().getLocation().x, game.getPlayer().getLocation().y, 1);
spider.attack(game.getPlayer());
}
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.
setHealth(health) Sets the health of the character.
example:
if(game.getPlayer().getHealth() < 20);
game.getPlayer().setHealth(100);
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.
hasItem(itemDescriptor, quantity) - returns true of the player is in possession of quantity number of itemDescriptor
[b]removeItem(itemDescriptor, quantity)[b] - Behaves exactly has addItem only removes item. Returned value can differ from quantity if less than quantity of itemDescriptor is contained in inventory
Example
var player = game.getPlayer();
var eric = game.getWorld().getEntity('eric');
if(player.hasItem('item/healthpack.jitm', 1))
{
me.echo('Fair trade!');
if(eric.hasItem('item/rifle.jitm', 1)
{
player.removeItem('item/healthpack.jitm', 1);
player.addItem('item/rifle.jitm', 1);
eric.addItem('item/healthpack.jitm');
}else
me.echo('Looks like eric doesnt have anything left to trade!');
}
wonder(radius) En-queues asynchronous wonder task to randomly move around.
distance(target) Returns the distance (in tiles) from the given target
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.
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.
saveState(path) Saves the state of the entity to the given path.
Functions exposed by World ScriptBridge in command console
setAmbientLight(r, g, b, a) - Configure’s world’s ambient light.
setHour(hour) - Sets world’s time
setMinute(minute)
setSecond(second)
setHour(hour) - 24 hour time
getHour, minute etc…
setTimeMultiplier(multiplier)
Example
game.getWorld().setTimeMultiplier(10000);
createEntity(name, className, npcFile)
- className has to be jevarpg.RpgCharacter
- npcFile can be:
npcs/innocentspider.jnpc
npcs/player.jnpc
npcs/spider_almostatcontrol.jnpc
getEntity(entityName)