forked from marva/sumorobot-web
		
	fix Python code upload
This commit is contained in:
		
							
								
								
									
										10
									
								
								sumorobot.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								sumorobot.js
									
									
									
									
									
								
							@@ -408,9 +408,17 @@ window.onload = function() {
 | 
				
			|||||||
    /* start button listener */
 | 
					    /* start button listener */
 | 
				
			||||||
    $(".btn-start").click(function() {
 | 
					    $(".btn-start").click(function() {
 | 
				
			||||||
        sumostart = true;
 | 
					        sumostart = true;
 | 
				
			||||||
 | 
					        /* if we are in Python mode */
 | 
				
			||||||
        if (pythonEnabled) {
 | 
					        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 {
 | 
					        } else {
 | 
				
			||||||
 | 
					            /* send the code to the SumoRobot */
 | 
				
			||||||
            sumorobot.send("start:" + sumocode.replace(/sumorobot./g, ""));
 | 
					            sumorobot.send("start:" + sumocode.replace(/sumorobot./g, ""));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user