Skip to content

getting started

Leo Yulin Li edited this page Mar 19, 2016 · 1 revision

EVENTS{}

What is an event?

Event in WHAS has nothing to do with JavaScript Event... Instead, it refers to the event of the game. To avoid the confusion, now we would just call it Event Object. Currently, Event Object are objects that contain a function run() for execution and store in const EVENTS{} as values. Events will run line by line in EVENTS{} and stop when save.eventBreak is true. Below is a basic structure of const EVENTS{}.

const EVENTS = {
	lineNumber : new eventObject(Object parameter),
	lineNumber2 : new anotherEventObject(Object parameter)
}

We are not sure if we still want to use the key value pair since there is not really a point for using it.

List of useable Event Object

  • RefreshDisplay(String) Update element with id="display" to String.
  • Choice([arrayOfOptions]) Clear element with id="options", and loop arrayOfOptions.
  • Option([]) Intake an array, and print the first element of the array to HTML element with id="options" as a button. When user click on the button, the rest of the array will run as Event Object.
  • gotoLine(lineNumber) jump to event object on that lineNumber.
  • weaponEquip(weaponID) update inventory with weapon with weaponID

Clone this wiki locally