Browse Source

removed printing of stack trace on prescript exception, print real
scriptname

Kajetan Johannes Hammerle 5 years ago
parent
commit
2bd49ea5c7

+ 1 - 1
src/me/hammerle/snuviscript/code/SnuviParser.java

@@ -137,7 +137,7 @@ public class SnuviParser
         }
         catch(PreScriptException ex)
         {
-            ex.printStackTrace();
+            //ex.printStackTrace();
             logger.print(ex.getLocalizedMessage(), ex, null, paths[0], null, ex.getEndLine() + 1);
             return null;
         }

+ 3 - 3
src/me/hammerle/snuviscript/code/SnuviUtils.java

@@ -278,16 +278,16 @@ public class SnuviUtils
                 } 
                 catch (MalformedInputException ex) 
                 {
-                    throw new PreScriptException("'" + filename + "' contains an illegal character, change file encoding", 0);
+                    throw new PreScriptException("'" + script.getPath() + "' contains an illegal character, change file encoding", 0);
                 }
                 catch (IOException ex) 
                 {
-                    throw new PreScriptException("file '" + filename + "' cannot be read", 0);
+                    throw new PreScriptException("file '" + script.getPath() + "' cannot be read", 0);
                 }
             }
             else
             {
-                throw new PreScriptException("file '" + filename + "' does not exist", 0);
+                throw new PreScriptException("file '" + script.getPath() + "' does not exist", 0);
             }
         }
         

+ 13 - 3
test.sbasic

@@ -1,8 +1,18 @@
 print("START");
 
-function wusi() 
+function onInteract(x, y)
 {
-    print(5);
+    if(x == 0 && y == 12)
+    {
+        level.setTile(level.getBackgroundIndex(), 4, 12, 6);
+        level.addMessage("Bla bla, I new block has appeared.");
+        level.addMessage("This is another page.");
+        level.addMessage("And another page.");
+    }
+    elseif(x == 2 && y == 12)
+    {
+        print("HI");
+    }
 }
 
-print("HMM");
+print("END");