Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commands

Tyly04 edited this page May 6, 2016 · 6 revisions
edit(text);
systems.combat(enemyName, enemyHealth, enemyAttack, enemyDefense, combatEnd);
systems.travel(place, placeName, distance);
pages.buttonCreate(value, onClick);

edit(text); creates a string of text that the player can see.

clear(); clears the page of all text. As of now, clear has exceeded the maximum call stack size. Use instead:

document.body.innerHTML = "";

systems.combat(enemyName, enemyHealth, enemyAttack, enemyDefense, combatEnd); starts a combat encounter with the assigned variables. Remember to put enemyName and combatEnd into a string. enemyName is the name players see when they are attacked, and combatEnd is part of the switch statement in CombatSystem.js. Add your own case depending on combatEnd, but if you are confused, contact tyly04 for help.

systems.travel(place, placeName, distance); has the player travel between places, be sure to have place and placeName as strings. place is called in a switch statement in Travel.js, which executes the function. Add your own case depending on place, but if you are confused, contact tyly04 for help.

pages.buttonCreate(value, onClick); Creates a button and puts it into the body tag, right after your code.

##Command Examples: ###Edit:

function caveSpiders(){
edit("You come upon a spider cave.");
edit("Suddenly, spiders attack!");
spiderAttack();
}

###Clear:

###Document.body.innerHTML:

function spiderQueen(){
document.body.innerHTML = "";
edit("The giant spider queen comes out and screeches at you!");
}

###Systems.combat

function spiderAttack(){
systems.combat(15,20,20,5,"spiderQueen");
}

###Systems.travel

function goToSpiderCave(){
systems.travel("spiderCave","Spider Cave", 20);
}

###Pages.buttonCreate

clear();
edit("You discover a chest in the spider cave! <p>");
pages.buttonCreate("Open", "caveSpiders()");
edit("</p><p>");
pages.buttonCreate("Leave", "leaveSpiderCave()");
edit("</p>");
Clone this wiki locally