Seemingly harmless Uncaught SyntaxError: Unexpected identifier

Discussion in 'Javascript/Plugin Support' started by Monkey BizNiz, Sep 18, 2017.

  1. Monkey BizNiz

    Monkey BizNiz Veteran Veteran

    Messages:
    229
    Likes Received:
    28
    First Language:
    Not English
    Primarily Uses:
    RMMV
    Hey guys,
    Basically, A plugin that gets rid of the ugly blur in full screen that ive gotten from someone; has been giving a, seemingly, harmless error, but id still like to keep my game as error free as possible. The code is pretty simple, but I dont have much coding knowledge so I dont know whats wrong with it.

    ''ImageManager.loadBitmap = function(folder, filename, hue, smooth) {
    if (filename) {
    var path = folder + encodeURIComponent(filename) + '.png'; var bitmap = this.loadNormalBitmap(path, hue || 0); //console.log("disabling smoothing for "+path); bitmap.smooth = false; return bitmap;
    }
    else {
    return this.loadEmptyBitmap();
    }
    }
    ;That will switch to nearest neighbor for all bitmap loads.''

    To add to this, I also had to put in this in the ''index.html'' file: <style type="text/css"> CANVAS{image-rendering: pixelated;}</style>

    This is the error: Smooth_Fullscreen.js:9 Uncaught SyntaxError: Unexpected identifier
     
    #1
  2. Kyo Panda

    Kyo Panda Veteran Veteran

    Messages:
    34
    Likes Received:
    24
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Could you please repost the code using the [code][/code] tag? Unexpected identifier is most likely to be a syntax error, like an extra symbol or an unclosed tag.
     
    #2
    Monkey BizNiz likes this.
  3. Monkey BizNiz

    Monkey BizNiz Veteran Veteran

    Messages:
    229
    Likes Received:
    28
    First Language:
    Not English
    Primarily Uses:
    RMMV
    oh yes, sure
    Code:
    ImageManager.loadBitmap = function(folder, filename, hue, smooth) {
    if (filename) {
    var path = folder + encodeURIComponent(filename) + '.png'; var bitmap = this.loadNormalBitmap(path, hue || 0); //console.log("disabling smoothing for "+path); bitmap.smooth = false; return bitmap;
    }
    else {
    return this.loadEmptyBitmap();
    }
    }
    ;That will switch to nearest neighbor for all bitmap loads.
     
    #3
  4. Kyo Panda

    Kyo Panda Veteran Veteran

    Messages:
    34
    Likes Received:
    24
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Try replacing with this one:

    Code:
    ImageManager.loadBitmap = function(folder, filename, hue, smooth) {
        if (!filename) {
            return this.loadEmptyBitmap();
        }
    
        var path = folder + encodeURIComponent(filename) + '.png';
      
        var bitmap = this.loadNormalBitmap(path, hue || 0);
        bitmap.smooth = false;
      
        return bitmap;
    };
     
    #4
    Monkey BizNiz likes this.
  5. Monkey BizNiz

    Monkey BizNiz Veteran Veteran

    Messages:
    229
    Likes Received:
    28
    First Language:
    Not English
    Primarily Uses:
    RMMV
    works like a charm, thanks buddy!
     
    #5

Share This Page