function fac(path, x, y, s = 0.9, reg) {
    requestScreenCapture();
    var img = images.read(path);
    var p;
    
    if (typeof reg === 'undefined') {
      p = findImage(captureScreen(), img, { threshold: s });
    } else if (typeof reg !== 'undefined') {
      p = findImage(captureScreen(), img, { region: reg, threshold: s });
    }
    
    if (p) {
      toast("找到");
      
      if (x === 0 && y === 0) {
        click(p.x, p.y);
      } else {
        click(p.x + x, p.y + y);
      }
    } else {
      toast("沒找到");
    }
    
    sleep(1000);
  };
  
  fac("./1.png", 391, 82);

以上是代碼,但報錯
23:00:14.496/E: missing ) after formal parameters (/storage/emulated/0/脚本/SpringValley/main.js#1)
missing ) after formal parameters
請各位大神解惑

last edited by andrewo77o