Darkhax-Minecraft / Game-Stages

An API for universal player based progression.
https://minecraft.curseforge.com/projects/game-stages
GNU Lesser General Public License v2.1
64 stars 17 forks source link

issue using hasGamestage in zenscript #37

Closed Saereth closed 5 years ago

Saereth commented 5 years ago

I'm try to run this zenscript with gamestages installed

import crafttweaker.player.IPlayer;
import crafttweaker.events.IEventManager;
import crafttweaker.event.PlayerChangedDimensionEvent;

events.onPlayerChangedDimension(function(event as crafttweaker.event.PlayerChangedDimensionEvent){

    if (!event.player.hasGameStage("one")){
    //do something
    }
    return;
});

`

crafttweaker reports correct syntax but when the game loads it errors out in the logs and does not work and crafttweaker throws this error: https://hastebin.com/mevabicihu.pl

I'm wasnt sure if this was a CT issue or gamestage issue (or plain old user error) so Im submitting to both gits. (https://github.com/CraftTweaker/CraftTweaker/issues/700)

Darkhax commented 5 years ago

This seems to be a user error. The syntax is correct however the logic isn't. Does your script run fine if you remove the hasGameStage code?

Saereth commented 5 years ago

yes without the hasGameStage code it doesnt error

just to be safe I disabled my script, made a new script (test.zs) with exactly the codeblock I listed in the original report, and it errors. Commenting out the

    if (!event.player.hasGameStage("one")){
    //do something
    }

lines and just leaving the returns does not error.

Saereth commented 5 years ago

kindlich helped me track down the logic errors, all good now!