fix Python code upload

This commit is contained in:
Silver Kuusik 2018-01-06 11:55:13 +01:00
parent fabb2cf09c
commit 13d9a967d9
1 changed files with 9 additions and 1 deletions

View File

@ -408,9 +408,17 @@ window.onload = function() {
/* start button listener */
$(".btn-start").click(function() {
sumostart = true;
/* if we are in Python mode */
if (pythonEnabled) {
sumorobot.send("start:" + $("#blocklyCode").val().replace(/sumorobot./g, "").replace(/\)/g, ", \"\")"));
/* add the an empty block ID to the functions */
var code = $("#blocklyCode").val().replace(/sumorobot./g, "").replace(/\)/g, ", \"\")");
/* is_enemy doesn't need the , */
code = code.replace(/\(, ""\)/g, "(\"\")");
/* send the code to the SumoRobot */
sumorobot.send("start:" + code);
/* otherwise when we are in blockly mode */
} else {
/* send the code to the SumoRobot */
sumorobot.send("start:" + sumocode.replace(/sumorobot./g, ""));
}
});