1. plu
  2. Overige versies
  3. zondag 19 mei 2013
An implementation of Robowars (http://robowar.sourceforge.net/RoboWar5/index.html) in Javascript (http://statico.github.io/jsrobowar/) is running online without problems in IE, Google Chrome and Firefox.

The code can be downloaded from GitHub
(https://github.com/statico/jsrobowar) as jsrobowar-master.zip.

After unpacking the off-line program only runs in IE; Firefox shows
error messages "errror compiling ..." , Google Chrome ".... error at
line undefined, undefined at".

It seems that the robotcode text files in the robots
subdirectory can only be read correctly by IE in HTML TEXTAREA 's and
transmitted to the robot code compiler in js/jsrobowar.js
(see code fragment from js/gui.js).

--------------------------------------------------------------------
.......................
/ / Load robot code into the editor when a robot is selected.
select.change (function () {
var name = $ (this) val ().;
if (name) {
var path = 'robots /' + name + 'txt.';
textarea.val ((Loading '+ path +') ');
textarea.attr ('disabled', 'disabled');
$. get (path, function (src) {
textarea.val (src);
textarea.attr ("disabled", null);
});
}
});
...................
--------------------------------------------------------------

Cleaning up the javascript code in both files with JSLint and JSHint
offers no solace.
On Internet forums I found items about problems with TEXTAREA in
Javascript, but as a newbie I found no solution there.

I want to start a jsrobowar programming competition, and want to have a
browser-independent implementation.

Is there anyone who knows of this problem and has a solution for it?

aTdHvAaNnKcSe.
Reacties (0)


Er zijn nog geen reacties op dit bericht.
Reageer als een van de eersten op dit bericht!
Nog geen HCC-gebruikersaccount aangemaakt? Klik dan hier.

Inloggen