Game Stages

Game Stages

41M Downloads

issue using hasGamestage in zenscript

Saereth opened this issue ยท 3 comments

commented

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. (CraftTweaker/CraftTweaker#700)

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2782
  • Crafttweaker: 4.1.13
commented

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?

commented

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.

commented

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