简体   繁体   中英

I imported a pokemon project to gmx

// but the code is throwing unexpected terminal operator new

function MovePokemon(argument0, argument1) {
    old = argument0;
    new = argument1;

    TPartyID = global.PartyID[old]
    global.PartyID[old] = global.PartyID[new]
    global.PartyID[new] = TPartyID;

new is a keyword in the current versions of GameMaker, so you'll need to rename that variable (say, to _new ).

The project in question may leave some to be desired given the complete absence of local variable declarations ( var ).

Try use this code in your script to avoid use "new"

function MovePokemon(argument0, argument1) {

    TPartyID = global.PartyID[argument0]
    global.PartyID[argument0] = global.PartyID[argument1]
    global.PartyID[argument1] = TPartyID;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM