ScriptCraft

ScriptCraft

14.6k Downloads

Trouble with variables

Mark-van-Dyke opened this issue ยท 4 comments

commented

I'm following the "Young person's guide to Programming in Minecraft". I followed the instructions to execute the command:

/js echo( self, location )

while 'location' was 'Mahon Point'.
But instead of displaying Mahon Point in the chat, it returned

CraftPlayer{name=Acetas} (Acetas is my Minecraft username, in case you wonder)

After that, I tested around for a bit with commands like "/js echo ( self, self.name )" . I also tried the "greet.js" thing mentioned in the "Your first Minecraft Mod" section. I'm sure I did everything correct, but still, when I executed "/js greet(self)" it also just displayed "CraftPlayer{name=Acetas}" .

Long story short, whenever I execute a command that contains a variable like "self" or "player", it returns "CraftPlayer{name=Acetas}" no matter what the actual command is.

Edit: I have tested the above by literally copy-pasting the code from the instruction pages into my Minecraft chat. The result didn't change.

commented

Which version of Java are you using? java -version
Which OS are you using?
Which Modding lib are you using - SpigotMC or CanaryMod?

commented

I'm actually running Scriptcraft on a SERVER, with SpigotMC, Linux and Java 8.

commented

I've tried to reproduce this with Spigot 1.9, Linux and Java 8. I cannot reproduce this issue.

commented

I cannot reproduce the error either

/js greet('Mahon Point',self)

works fine with Spigot 1.9