12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- var Story = function(player, messager) {
- var tickEvents = [ {
- "tickvalue" : 1,
- "eventcall" : "blank"
- }, {
- "tickvalue" : 30,
- "eventcall" : "greet1"
- }, {
- "tickvalue" : 38,
- "eventcall" : "greet2"
- }, {
- "tickvalue" : 45,
- "eventcall" : "greet3"
- }, {
- "tickvalue" : 48,
- "eventcall" : "greet4"
- } ];
- this.update = function() {
- var ticks = Math.floor((new Date().getTime() - player.getData('started')) / 1000) || 0;
- for ( var index in tickEvents) {
- var event = tickEvents[index];
- if (event.tickvalue == ticks) {
- var eventcall = this[event.eventcall];
- eventcall();
- }
- }
- };
- this.blank = function() {
- document.getElementById("travel").style.visibility = "hidden";
- };
- this.greet1 = function() {
- messager.transmission("Transmission: Hello, is anyone there?");
- };
- this.greet2 = function() {
- messager.transmission(
- "Transmission: You seem to be having a bit of trouble.");
- };
- this.greet4 = function() {
- messager.transmission(
- "Transmission: There's a station not too far from you.");
- document.getElementById("travel").style.visibility = "visible";
- };
- this.greet3 = function() {
- messager.transmission(
- "Transmission: You'll have to repair and fuel up, but");
- };
- };
- var story = new Story(player, messager);
|